Skip to content

Conversation

heitorlessa
Copy link
Contributor

@heitorlessa heitorlessa commented Jul 2, 2021

Issue #, if available: #496

Description of changes:

JSONSchema Draft 7 has support for custom built-in formats like date-time. This PR fixes a malformed input to the upstream JSON validator (fastjsonschema) which cannot differentiate between custom format and custom built-in formats.

If no custom formats are explicitly passed we default to a Dict when passing that as input to fastjsonschema. This leads to the right fallback mechanism in the upstream validator to search for built-in custom formats.

Example JSON schema field that triggered it:

"message": {
    "$id": "#/properties/message",
    "type": "string",
    "format": "date-time",
    "title": "The message",
    "examples": ["hello world"],
},

Checklist

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@boring-cyborg boring-cyborg bot added the tests label Jul 2, 2021
@pull-request-size pull-request-size bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 2, 2021
@heitorlessa heitorlessa force-pushed the fix/validator-custom-builtin-format branch from 96ed44f to 1e5c9a9 Compare July 2, 2021 07:14
@heitorlessa heitorlessa added the bug Something isn't working label Jul 2, 2021
@heitorlessa heitorlessa linked an issue Jul 2, 2021 that may be closed by this pull request
@heitorlessa heitorlessa merged commit e1511b4 into aws-powertools:develop Jul 2, 2021
@heitorlessa heitorlessa deleted the fix/validator-custom-builtin-format branch July 2, 2021 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working size/M Denotes a PR that changes 30-99 lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Validator: Date-time format fails validation
1 participant