Skip to content

Fix OpenApiJsonSchema array parsing #62051

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 2 commits into from
May 27, 2025
Merged

Fix OpenApiJsonSchema array parsing #62051

merged 2 commits into from
May 27, 2025

Conversation

BrennanConroy
Copy link
Member

Fixes #62023

We weren't reading before calling the recursive function which meant we'd never advance the Utf8JsonReader and always be in the state reader.TokenType == JsonTokenType.StartArray

@BrennanConroy BrennanConroy requested a review from a team as a code owner May 21, 2025 18:27
@github-actions github-actions bot added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label May 21, 2025
Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Comment inline about possibly adding coverage for custom converts that emit objects instead of arrays.

@BrennanConroy BrennanConroy merged commit bfcfefa into main May 27, 2025
27 checks passed
@BrennanConroy BrennanConroy deleted the brecon/overflow branch May 27, 2025 18:30
@BrennanConroy
Copy link
Member Author

/backport to release/9.0

@dotnet-policy-service dotnet-policy-service bot added this to the 10.0-preview6 milestone May 27, 2025
Copy link
Contributor

Started backporting to release/9.0: https://github.com/dotnet/aspnetcore/actions/runs/15282951411

Copy link
Contributor

@BrennanConroy backporting to "release/9.0" failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix OpenApiJsonSchema array parsing
Using index info to reconstruct a base tree...
M	src/OpenApi/src/Schemas/OpenApiJsonSchema.Helpers.cs
M	src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiSchemaService/OpenApiSchemaService.ParameterSchemas.cs
Falling back to patching base and 3-way merge...
Auto-merging src/OpenApi/test/Microsoft.AspNetCore.OpenApi.Tests/Services/OpenApiSchemaService/OpenApiSchemaService.ParameterSchemas.cs
Auto-merging src/OpenApi/src/Schemas/OpenApiJsonSchema.Helpers.cs
CONFLICT (content): Merge conflict in src/OpenApi/src/Schemas/OpenApiJsonSchema.Helpers.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Fix OpenApiJsonSchema array parsing
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates feature-openapi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OpenAPI Schema generation stackoverflow when converting Flags enum to a string array & is used in API models with default value
2 participants