-
Notifications
You must be signed in to change notification settings - Fork 230
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
adds support for OpenAPI 3.1 descriptions #5936
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
fix: missing descriptions Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
and the unit tests are impacted by this bug microsoft/OpenAPI.NET#2150 |
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
Signed-off-by: Vincent Biret <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏼
for anybody following along, we'll need to wait for the release of this fix. |
{ | ||
if (string.IsNullOrEmpty(x?.Reference?.Id) || string.IsNullOrEmpty(y?.Reference?.Id)) return object.Equals(x, y); | ||
return _stringComparer.Equals(x.Reference.Id, y.Reference.Id); | ||
if (x is not OpenApiSchemaReference xRef || y is not OpenApiSchemaReference yRef) return object.Equals(x, y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If Id can be null, then the existing condition may change the behavior of this comparer.
if (x is not OpenApiSchemaReference xRef || y is not OpenApiSchemaReference yRef) return object.Equals(x, y); | |
if (x is not OpenApiSchemaReference xRef || string.IsNullOrEmpty(xRef.Reference?.Id) || y is not OpenApiSchemaReference yRef || string.IsNullOrEmpty(yRef.Reference?.Id)) return object.Equals(x, y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is temporary so the compiler doesn't yell at me. We're having a conversation about this here when it's fixed, I suspect the compiler will yell at me for using null propagation where not needed, at which point I'll remove it.
@@ -19,7 +20,7 @@ internal static void InitializeInheritanceIndex(this OpenApiDocument openApiDocu | |||
{ | |||
inheritanceIndex.TryAdd(entry.Key, new(StringComparer.OrdinalIgnoreCase)); | |||
if (entry.Value.AllOf != null) | |||
foreach (var allOfEntry in entry.Value.AllOf.Where(static x => !string.IsNullOrEmpty(x.Reference?.Id))) | |||
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In case the Id could be null?
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>()) | |
foreach (var allOfEntry in entry.Value.AllOf.Where(static x => x is OpenApiSchemaReference xRef && !string.IsNullOrEmpty(x.Reference?.Id)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we need to maintain the OfType for the rest of the code.
So I'm going to reply with this suggestion
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>()) | |
foreach (var allOfEntry in entry.Value.AllOf.OfType<OpenApiSchemaReference>().Where(static x => x !string.IsNullOrEmpty(x.Reference?.Id)) |
|
fixes #3914
depends on microsoft/OpenAPI.NET#2023
In addition to "supporting the new format" this PR does a couple of things:
["number", "string"]
) and projects them as union types.