-
Notifications
You must be signed in to change notification settings - Fork 275
fix: implement unevaluatedProperties as schema per JSON Schema 2020-12 #2728
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
48e997f
Initial plan
Copilot 46291b9
feat: add UnevaluatedPropertiesSchema support to IOpenApiSchema
Copilot ea1d6eb
test: add comprehensive tests for UnevaluatedProperties
Copilot bab4256
fix: correct deserialization and test for UnevaluatedPropertiesSchema
Copilot 964c7be
fix: address PR feedback on UnevaluatedProperties implementation
Copilot 3d6f1e2
refactor: use OpenApiConstants for extension name
Copilot 870baa4
chore: reverts dotnet version change
baywet 00da964
chore: update benchmark reports
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| { | ||
| "sdk": { | ||
| "version": "8.0.418" | ||
| "version": "8.0.417" | ||
| } | ||
| } | ||
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
32 changes: 32 additions & 0 deletions
32
src/Microsoft.OpenApi/Models/Interfaces/IOpenApiSchemaWithUnevaluatedProperties.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| namespace Microsoft.OpenApi; | ||
|
|
||
| /// <summary> | ||
| /// Compatibility interface for UnevaluatedProperties schema support. | ||
| /// This interface provides access to the UnevaluatedPropertiesSchema property, which represents | ||
| /// the schema for unevaluated properties as defined in JSON Schema draft 2020-12. | ||
| /// | ||
| /// NOTE: This is a temporary compatibility solution. In the next major version: | ||
| /// - This interface will be merged into IOpenApiSchema | ||
| /// - The UnevaluatedPropertiesSchema property will be renamed to UnevaluatedProperties | ||
| /// - The current UnevaluatedProperties boolean property will be renamed to UnevaluatedPropertiesAllowed | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// TODO: Remove this interface in the next major version and merge its content into IOpenApiSchema. | ||
| /// </remarks> | ||
| public interface IOpenApiSchemaWithUnevaluatedProperties | ||
| { | ||
| /// <summary> | ||
| /// Follow JSON Schema definition: https://json-schema.org/draft/2020-12/json-schema-core#name-unevaluatedproperties | ||
| /// This is a schema that unevaluated properties must validate against. | ||
| /// When serialized, this takes precedence over the UnevaluatedProperties boolean property. | ||
| /// </summary> | ||
| /// <remarks> | ||
| /// NOTE: This property differs from the naming pattern of AdditionalProperties/AdditionalPropertiesAllowed | ||
| /// for binary compatibility reasons. In the next major version: | ||
| /// - This property will be renamed to UnevaluatedProperties | ||
| /// - The current boolean UnevaluatedProperties property will be renamed to UnevaluatedPropertiesAllowed | ||
| /// | ||
| /// TODO: Rename this property to UnevaluatedProperties in the next major version. | ||
| /// </remarks> | ||
| IOpenApiSchema? UnevaluatedPropertiesSchema { get; } | ||
| } |
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,7 @@ | ||
| #nullable enable | ||
| const Microsoft.OpenApi.OpenApiConstants.UnevaluatedPropertiesExtension = "x-jsonschema-unevaluatedProperties" -> string! | ||
| Microsoft.OpenApi.IOpenApiSchemaWithUnevaluatedProperties | ||
| Microsoft.OpenApi.IOpenApiSchemaWithUnevaluatedProperties.UnevaluatedPropertiesSchema.get -> Microsoft.OpenApi.IOpenApiSchema? | ||
| Microsoft.OpenApi.OpenApiSchema.UnevaluatedPropertiesSchema.get -> Microsoft.OpenApi.IOpenApiSchema? | ||
| Microsoft.OpenApi.OpenApiSchema.UnevaluatedPropertiesSchema.set -> void | ||
| Microsoft.OpenApi.OpenApiSchemaReference.UnevaluatedPropertiesSchema.get -> Microsoft.OpenApi.IOpenApiSchema? |
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.