Conversation
4770de5 to
0e51608
Compare
0e51608 to
af9beaa
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new "strict" validation mode for OpenAPI 3.0 schemas, alongside refining how string and binary types are validated. The main improvement is the addition of
OAS30StrictValidator, which enforces the OpenAPI spec more rigorously by not allowing Pythonbytesfor string types or binary formats, and by requiring base64-encoded strings for thebinaryformat. The default validator remains pragmatic and continues to accept Pythonbytesfor compatibility. Extensive tests are added to ensure correct behavior for both modes.New strict validation mode:
OAS30StrictValidatorandoas30_strict_format_checker, which strictly enforce OpenAPI 3.0 type and format rules, disallowing Pythonbytesfor string types and requiring base64-encoded strings for thebinaryformat. These are now exported in the package API. [1] [2] [3] [4] [5]Type and format validation logic changes:
bytesfor"type": "string", "format": "binary", while the strict checker does not. Added new helper functionsis_binary_pragmaticandis_binary_strictfor these behaviors. [1] [2] [3] [4]str(notbytes) for plain string types in both modes.Testing and integration:
bytesfor string types and enforces base64 encoding for thebinaryformat. Adjusted existing tests to reflect the stricter type checks. [1] [2] [3] [4] [5] [6]