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

ExternalRefProcessor incorrectly handles composed schemas in array items #2071

Closed
chimmi opened this issue Mar 30, 2024 · 2 comments
Closed
Assignees

Comments

@chimmi
Copy link
Contributor

chimmi commented Mar 30, 2024

If we have following spec:

openapi: 3.0.1
info:
  title: API
  description: API
  version: LATEST
paths:
  /test-path:
    post:
      requestBody:
        required: true
        content:
          text/plain:
            schema:
              type: string
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: 'definitions.yaml#/components/schemas/Response'

And corresponding definitions.yaml:

components:
  schemas:
    Response:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/ProductRow'
        discriminator:
          propertyName: type
          mapping:
            'product': '#/components/schemas/ProductRow'
    ProductRow:
      type: object
      additionalProperties: false
      required:
        - type
      properties:
        type:
          $ref: '#/components/schemas/ProductsRowType'
        payload:
          type: string
    ProductsRowType:
      type: string
      enum:
        - product

ExternalRefProcessor will fail to resolve all necessary references, which results in only Response model being loaded.

@chimmi
Copy link
Contributor Author

chimmi commented Mar 30, 2024

[PR] (#2072)

@frantuma frantuma self-assigned this Apr 3, 2024
@frantuma
Copy link
Member

frantuma commented Apr 5, 2024

fixed in #2072, thanks!

@frantuma frantuma closed this as completed Apr 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants