-
Notifications
You must be signed in to change notification settings - Fork 10.7k
Add special handling for array types in OpenAPI schema references. #66583
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,14 @@ internal static string GetSchemaReferenceId(this Type type, JsonSerializerOption | |
| return type.GetGenericArguments()[0].GetSchemaReferenceId(options); | ||
| } | ||
|
|
||
| // Special handling for array types which use '[]' in their name that is not | ||
| // valid in OpenAPI schema keys (must match ^[a-zA-Z0-9\.\-_]+$). | ||
| if (type.IsArray) | ||
| { | ||
| var elementType = type.GetElementType()!; | ||
| return $"{elementType.GetSchemaReferenceId(options)}Array"; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure if this should be @mikekistler Any thoughts?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with either, though I agree that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @Youssef1313 @mikekistler done. |
||
| } | ||
|
|
||
| // Special handling for generic types that are collections | ||
| // Generic types become a concatenation of the generic type name and the type arguments | ||
| if (type.IsGenericType) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.