Fix four real-world read/write bugs found validating against the Stri… - #72
Merged
Conversation
…pe API spec Found while driving OpenAPI-Client against the actual Stripe OpenAPI spec and stripe-mock (not just the Petstore test fixture): - JSONSchemaArray>>read: computed its result but never returned it (no ^), so array-typed values always silently became the schema object itself. The tuple-validation branch also iterated the schema's own #items instead of the actual data collection. - JSONSchemaObject>>readObject: sent #ifTrue: directly to #additionalProperties, which crashes whenever a schema sets additionalProperties to a nested schema (or leaves it unset) rather than a literal boolean - both are valid per spec. Stripe's metadata schemas do exactly this. - JSONSchemaAnyObject had no #read:, hit whenever a property with no fixed shape (e.g. an anyOf collapsing to "accept anything") is read back. - JSONSchemaString/JSONPrimitiveSchema sent #ifTrue: directly to #nullable, which is nil (not a boolean) for any schema object built by NeoJSON's reflective instantiation - i.e. every schema parsed from a document, primed or not. Changed to a proper accessor that treats unset as permissive, since OpenAPI's "nullable" keyword on a property is not currently threaded through nested schema reads at all (properties are always parsed as base JSONSchemaDefinition, which does not carry it) - a separate, larger gap left for follow-up.
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.
…pe API spec
Found while driving OpenAPI-Client against the actual Stripe OpenAPI spec and stripe-mock (not just the Petstore test fixture):