-
Notifications
You must be signed in to change notification settings - Fork 279
Define JSON schema's Type property as a flaggable enum to allow storing multiple values #1897
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
MaggieKimani1
merged 19 commits into
release/2.0.0
from
mk/define-json-schema-type-as-enum
Oct 31, 2024
Merged
Changes from 7 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
79f3e94
Define JSON schema type as a flaggable enum to allow storing strings …
MaggieKimani1 8c9047f
Implement helper methods for switching between enum types and their e…
MaggieKimani1 2e03505
Refactor tests to reflect change
MaggieKimani1 d0fb2c7
Update API interface
MaggieKimani1 42614be
Resolve merge conflicts
MaggieKimani1 314880d
Fix failing tests
MaggieKimani1 b2e1026
code cleanup
MaggieKimani1 924ff0d
Merge remote-tracking branch 'origin/release/2.0.0' into mk/define-js…
MaggieKimani1 56c47cb
Remove JsonSchemaType.Any type
MaggieKimani1 5af79d4
Add condition to check whether the flag matches the type before appen…
MaggieKimani1 e12301c
Add test for sample document with 3.1 features
MaggieKimani1 e13fb01
throw OpenApiException for it to be caught gracefully and appended to…
MaggieKimani1 2e2ad57
Fix string formatting
MaggieKimani1 656259a
Fix failing tests
MaggieKimani1 07987ae
Update src/Microsoft.OpenApi/Models/OpenApiSchema.cs
MaggieKimani1 3abe36c
Convert the JsonSchemaType helper methods to extensions
MaggieKimani1 38954dc
Add null check for type; simplify condition to verify flag has been set
MaggieKimani1 b806323
Clean up tests
MaggieKimani1 5eb0010
Add null check
MaggieKimani1 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
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 |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT license. | ||
|
|
||
| using System; | ||
|
|
||
| namespace Microsoft.OpenApi.Models | ||
| { | ||
| /// <summary> | ||
| /// Represents the type of a JSON schema. | ||
| /// </summary> | ||
| [Flags] | ||
| public enum JsonSchemaType | ||
| { | ||
| /// <summary> | ||
| /// Represents any type. | ||
| /// </summary> | ||
| Any = 0, | ||
|
|
||
| /// <summary> | ||
| /// Represents a null type. | ||
| /// </summary> | ||
| Null = 1, | ||
|
|
||
| /// <summary> | ||
| /// Represents a boolean type. | ||
| /// </summary> | ||
| Boolean = 2, | ||
|
|
||
| /// <summary> | ||
| /// Represents an integer type. | ||
| /// </summary> | ||
| Integer = 4, | ||
|
|
||
| /// <summary> | ||
| /// Represents a number type. | ||
| /// </summary> | ||
| Number = 8, | ||
|
|
||
| /// <summary> | ||
| /// Represents a string type. | ||
| /// </summary> | ||
| String = 16, | ||
|
|
||
| /// <summary> | ||
| /// Represents an object type. | ||
| /// </summary> | ||
| Object = 32, | ||
|
|
||
| /// <summary> | ||
| /// Represents an array type. | ||
| /// </summary> | ||
| Array = 64, | ||
| } | ||
| } |
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.
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.