You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
resources/static/openapis/users.yaml (path from content root)
openapi: 3.1.0# (...)components:
schemas:
User:
# Separate the schema specification into a separate file and reference it using $ref$ref: 'components/schemas/users/user.yaml#/components/schemas/User'
resources/static/openapis/components/schemas/users/user.yaml (path from content root)
components:
schemas:
User:
# The type was specified in the separated schema file,# but it is not read during the initial rendering in Swagger UI type: objectproperties:
id:
type: stringformat: uuidname:
type: stringemail:
type: stringformat: emailpassword:
type: string
Describe the bug you're encountering
I'm developing an API server based on Spring Boot and providing OAS 3.1 with Springdoc. Instead of using annotations, I configured OAS 3.1 in YAML format. I successfully modularized the schema specifications by separating them into different files and using the $ref property.
However, as shown in the screenshot below, the initial type rendered in the Schema tab of Swagger UI appears as any. At first, I thought it might be because Any is the top-level type in Kotlin, but when toggling the schema, the any type changes to object. I suspect that before finding the file via the $ref property, the modularized schema is not read, resulting in the initial type being any.
When I first modularized, my intention was to set only the $ref property in the OAS file. However, due to the issue mentioned above, I'm temporarily setting the type property as well. I'm registering this issue to see if there is a nicer solution.
To reproduce...
Steps to reproduce the behavior:
Run the Spring Boot application.
Navigate to the default path {origin}:{port}/swagger-ui/index.html.
Scroll down to the Schemas tab.
Verify that the type in the schema defined with OAS 3.1 is set to any.
Select 'Expand all'.
Confirm that the type has changed to object, then select 'Collapse all' again.
From this point on, the type will continue to be displayed as object.
Expected behavior
The expected result is that the specified schema type should be rendered as object, but the actual result is that it is rendered as any.
Screenshots
Initial Swagger UI rendering
When selecting Expand All
When selecting Collapse again
Additional context or thoughts
I initially registered this issue with springdoc-openapi. I was advised to seek feedback here since the issue appears to occur during UI rendering.
I confirmed that the issue persists with the following dependencies as well:
I also found a temporary solution as shown below, but I'm not sure if I should continue using it this way.
resources/static/openapis/users.yaml (path from content root)
openapi: 3.1.0# (...)components:
schemas:
User:
# Instead of specifying the type in the separated file,# it works if the type is specified at the same location as the $ref property.type: object$ref: 'components/schemas/users/user.yaml#/components/schemas/User'
The text was updated successfully, but these errors were encountered:
@ekasnh Hi. I thought I had provided enough context in the description, but what additional information do you need?
Please let me know and I'll respond.
Q&A (please complete the following information)
Content & configuration
To reproduce, create a simple file structure in a Spring Boot project with application.yaml, users.yaml (OAS 3.1), and user.yaml (schema file).
application.yaml
resources/static/openapis/users.yaml (path from content root)
resources/static/openapis/components/schemas/users/user.yaml (path from content root)
Describe the bug you're encountering
I'm developing an API server based on Spring Boot and providing OAS 3.1 with Springdoc. Instead of using annotations, I configured OAS 3.1 in YAML format. I successfully modularized the schema specifications by separating them into different files and using the
$ref
property.However, as shown in the screenshot below, the initial type rendered in the Schema tab of Swagger UI appears as
any
. At first, I thought it might be becauseAny
is the top-level type in Kotlin, but when toggling the schema, theany
type changes toobject
. I suspect that before finding the file via the$ref
property, the modularized schema is not read, resulting in the initial type beingany
.When I first modularized, my intention was to set only the
$ref
property in the OAS file. However, due to the issue mentioned above, I'm temporarily setting thetype
property as well. I'm registering this issue to see if there is a nicer solution.To reproduce...
Steps to reproduce the behavior:
any
.object
, then select 'Collapse all' again.object
.Expected behavior
The expected result is that the specified schema type should be rendered as
object
, but the actual result is that it is rendered asany
.Screenshots
Additional context or thoughts
I initially registered this issue with springdoc-openapi. I was advised to seek feedback here since the issue appears to occur during UI rendering.
I confirmed that the issue persists with the following dependencies as well:
I also found a temporary solution as shown below, but I'm not sure if I should continue using it this way.
resources/static/openapis/users.yaml (path from content root)
The text was updated successfully, but these errors were encountered: