New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Schema annotations 3.1 #1801
Draft
Azquelt
wants to merge
12
commits into
smallrye:main-4.0
Choose a base branch
from
Azquelt:schema-annotations-3.1
base: main-4.0
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Schema annotations 3.1 #1801
Conversation
This file contains 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
In e83724a I made some of the scanner tests output the actual JSON document in the event of a failure because it was more helpful to me during development than configuring logging and finding the logs, but that part is not relevant to the actual changes and can be dropped if desired. |
- Change schema to hold a freeform map of objects - New getters and setters added - Type now holds an array, but is output as a single string if it only contains one item - $ref is now valid with other fields so we cannot remove other fields at serialization time. - When merging objects, some array properties should be merged, but others (e.g. examples) shouldn't. - Old behaviour of setType and setNullable is maintained, as we rely on it fairly heavily to build up schema data from multiple sources
Make a copy of a ref schema before returning it to the caller after registering a new type to prevent the caller from corrupting the registry entry. This is more likely now that $ref is valid alongside other properties. We already did a copy when a ref was retrieved from the registry, but not when it was first registered.
- Type can now be an array, but will still be output as a string if it only has one element - The schema construction for "this object, but also allow null" is different. Previously we could combine a $ref with nullable = true, but nullable has been removed and we need to instead state that null is allowed as a type. This requires us to use anyOf instead. - When generating from annotations, examples is used instead of example
Existing code relying on the old semantics of these methods was changed to use static methods on SchemaImpl which preserves the old behavior.
For consistency with other model setters.
This test took a noticable amount of time and more than 50% was string contatentation building the test file.
Include the full JSON output from the scanner when a test fails, to avoid needing to search the logs and enable debug logging.
Tests for: - if/then/else - allOf/anyOf/oneOf/not - dependentSchemas - prefixItems - contains/maxContains/minContains - propertyNames - patternProperties - contentEncoding - contentMediaType - contentSchema
- examples - comment - if/then/elseSchema - dependentSchemas - prefixItems - contains/minContains/maxContains - patternProperties - propertyNames - constValue - dependentRequired - contentEncoding/contentMediaType/contentSchema
Azquelt
force-pushed
the
schema-annotations-3.1
branch
from
April 23, 2024 15:56
693e2d3
to
1d7c0a0
Compare
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.
Implement the
@Schema
and@SchemaProperty
changes from eclipse/microprofile-open-api#601.This builds on #1793, so only the last few commits are relevant.
I haven't duplicated cases which are already covered by the TCK.