Skip to content

OpenAPI schema transformers not working correctly for types #56899

@martincostello

Description

@martincostello

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions