Additional test for CustomClaims that validates unmarshalling behaviour#457
Conversation
oxisto
left a comment
There was a problem hiding this comment.
Good idea. One small nit. It does however not really increase our test coverage, since this is basically handled by encoding/json. However, there were some issues creeping up where folks didn't get their custom claims parsed, so this should help to weed out any errors here.
|
Hi @oxisto, I agree with your comment on coverage (this does not add any "additional" coverage to the package), and I've updated the PR title accordingly Please let me know if you would like any further changes 👍🏻 |
How so? Weren't most of these user errors. Not entirely sure we're adding anything here that the standard library doesn't already test. |
|
Hi @mfridman, the reasoning for adding the tests is that there is not documented proof for custom claims being marshalled currently. I agree that the std lib does this already - but as there is a wrapper function around the use of json.unmarshal, (with the parse functions), this ensures that if any changes are made to the implementation in this package, that current functionality (custom claims types) would not break. Happy to close this out if not needed or if you feel it is not warranted 👍 |
Closes #453
Adds an additional test to parser_test.go, that validates the library can parse the valid JWT Claims in the token to a custom Go struct with different types - validates:
Which should provide coverage for all valid data types as per the JSON spec