Skip to content
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

OpenAPI schema transformers not working correctly for types #56899

Closed
martincostello opened this issue Jul 19, 2024 · 1 comment · Fixed by #56905
Closed

OpenAPI schema transformers not working correctly for types #56899

martincostello opened this issue Jul 19, 2024 · 1 comment · Fixed by #56905
Labels
area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels feature-openapi
Milestone

Comments

@martincostello
Copy link
Member

There seems to be an issue with the new OpenAPI schema transformers with regards to top-level schemas for object types using the latest bits from main for preview 7.

I've pushed the code up here if you want to take a look: martincostello/api@12237af

It seems like when I get the first call into my transformer, which is the schema for a the full containing type TimeResponse, instead of getting the type info for that, I instead get the property info for the first property universalFull which is a string. This is then returned 5 calls later as the schema for that property itself.

This then leads me to incorrectly assign the summary for the last property in the schema for the object as the summary for the schema object itself.

Feels like there's a bug and the context for the top-level schema objects is incorrect.

This is the TimeResponse schema I get from that commit:

      "TimeResponse": {
        "type": "object",
        "properties": {
          "timestamp": {
            "type": "string",
            "description": "The timestamp for the response for which the times are generated.",
            "format": "date-time"
          },
          "rfc1123": {
            "type": "string",
            "description": "The current UTC date and time in RFC1123 format."
          },
          "unix": {
            "type": "integer",
            "description": "The number of seconds since the UNIX epoch.",
            "format": "int64"
          },
          "universalSortable": {
            "type": "string",
            "description": "The current UTC date and time in universal sortable format."
          },
          "universalFull": {
            "type": "string",
            "description": "The current UTC date and time in universal full format."
          }
        },
        "description": "The current UTC date and time in universal full format."
      }

Originally posted by @martincostello in #56318 (comment)

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically label Jul 19, 2024
@martincostello martincostello added feature-openapi area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels and removed needs-area-label Used by the dotnet-issue-labeler to label those issues which couldn't be triaged automatically labels Jul 19, 2024
@captainsafia
Copy link
Member

Found the bug 😸

Thanks as always for your work here, @martincostello! I think I can get this fix in for preview7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-frameworks *DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels feature-openapi
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants