fix - move allOf before the typed shape - #57
Merged
Conversation
added test_allof_with_redundant_type_object_sibling test snapshot to make avoid regression later on
|
@mwja is attempting to deploy a commit to the lbl-rd Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
|
@mwja nice! Thanks for this- will release it shortly. |
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.
Summary
Fixes #56 by allowing
AllOfto matchtype: objectdefinitions (even if it is redundant, quite a few public OpenAPI specs do still provide this value), so that the following schema doesn't collapse toserde_json::Valuebecause it matchTypedand notAllOfGenerated compatibility
type: objectandallOfnow generate the correct struct instead of becomingserde_json::ValueValuetype, otherwise not much change.type: objectbut with with an arraytypestill matchesTypedMultibeforeAllOfso it still has the same issue. But this PR just bringsAllOfto the same behaviour asAnyOf. (See review notes)Validation
cargo fmt --checkcargo clippy --all-features -- -D warningscargo test --all-featuresscripts/install-smoke.shfor packaging/dependency changes.scripts/spec-compile.shfor generator changes.Notes for reviewers
The issue in #56 provides a minimal reproducible example, and should be the best to check before/after. I intentionally didn't change
AllOf/AnyOfto accept arraytype(e.g.type: [object, null]as the existing code didn't, but I'll likely make an other issue for that.I had to change one (unrelated) test as it actually required the current behaviour instead of the 'correct' behaviour this PR introduces