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 3.1.0 modelExpandDepth not applied to oneOf/anyOf #9508

Closed
jux61 opened this issue Jan 23, 2024 · 1 comment
Closed

OpenAPI 3.1.0 modelExpandDepth not applied to oneOf/anyOf #9508

jux61 opened this issue Jan 23, 2024 · 1 comment

Comments

@jux61
Copy link
Contributor

jux61 commented Jan 23, 2024

Q&A (please complete the following information)

  • OS: windows10
  • Browser: chrome
  • Version: 120.0
  • Method of installation: npm
  • Swagger-UI version: 5.11.0
  • Swagger/OpenAPI version: OpenAPI 3.1

Content & configuration

Example Swagger/OpenAPI definition:

openapi: "3.1.0"
info:
  version: "0.0.1"
  title: "Swagger UI Webpack Setup"
  description: "Demonstrates Swagger UI"
components:
  schemas: {}
security: []
paths:
  /pets:
    get:
      responses:
        200:
          description: "OK"
          content:
            application/json:
              schema:
                allOf:
                  - oneOf:
                      - type: object
                        properties:
                          oneOf1-p1:
                            type: object
                            properties:
                              oneOf1-p1-p1:
                                type: string
                              oneOf1-p1-p2:
                                type: object
                                properties:
                                  oneOf1-p1-p2-p1:
                                    type: string
                          oneOf1-p2:
                            type: string
                      - type: object
                        properties:
                          oneOf2-p1:
                            type: string
                  - anyOf:
                      - type: object
                        properties:
                          anyOf1-p1:
                            type: object
                            properties:
                              anyOf1-p1-p1:
                                type: string
                              anyOf1-p1-p2:
                                type: object
                                properties:
                                  anyOf1-p1-p2-p1:
                                    type: string
                          anyOf1-p2:
                            type: string
                      - type: object
                        properties:
                          anyOf2-p1:
                            type: object
                            properties:
                              anyOf2-p1-p1:
                                type: string
                          anyOf2-p2:
                            type: string
                  - type: object
                    properties:
                      p1:
                        type: object
                        properties:
                          p1-p1:
                            type: string
                          p1-p2:
                            type: object
                            properties:
                              p1-p2-p1:
                                type: string
                      p2:
                        type: string
tags: []

Swagger-UI configuration options:

SwaggerUI({
    url: "./swagger-config.yaml",
    dom_id: "#swagger-ui",
    presets: [
      SwaggerUIBundle.presets.apis,
      SwaggerUIStandalonePreset
    ],
    plugins: [],
    layout: "StandaloneLayout",
    docExpansion: "full",
    defaultModelExpandDepth: 100,
    defaultModelRendering: "model"
})

Describe the bug you're encountering

For openapi 3.1 contracts, defaultModelsExpandDepth configuration is not applied to oneOf/anyOf/allOf

To reproduce...

Steps to reproduce the behavior:

  1. Start the GUI
  2. See model, schema is expanded except oneOf/anyOf part

image

Expected behavior

Expect expend depth config to also be applied to oneOf/anyOf schema
image

Screenshots

see in reproduce step

Additional context or thoughts

@char0n
Copy link
Member

char0n commented Feb 14, 2024

Addressed in #9581

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants