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

Attributes like readOnly and description not rendered correctly for allOf types in 2.0.0-rc.72 #2079

Closed
austpaul opened this issue Jul 13, 2022 · 1 comment · Fixed by #2083
Assignees

Comments

@austpaul
Copy link

Describe the bug
allOf types are not rendered properly in rc.72.

Attributes like readOnly and description seem to be applied from the last item in the allOf list, and not taken from the allOf type itself.

Expected behavior
Attributes like readOnly and description should rendered properly if defined for an allOf type, and not always applied/inherited from the base type(s).

Given the specification below, billingAccountId should have been visible in the request body. All attribute descriptions should have had other values in both the request and response body.

Minimal reproducible OpenAPI snippet(if possible)

openapi: 3.0.3
info:
  version: 0.0.1
  title: Test API
servers: []
tags:
  - name: Order
paths:
  /orders:
    summary: Product ordering
    post:
      tags:
        - Order
      summary: Create order
      description: |
        Create an order
      operationId: createProductOrder
      requestBody:
        $ref: "#/components/requestBodies/Order"
      responses:
        "201":
          $ref: "#/components/responses/OrderCreated"
components:
  schemas:
    ProductOfferingId:
      description: Original description for type `ProductOfferingId` which should have
        been overridden
      type: string
      example: SOME_PRODUCT
    AccountId:
      description: >
        Original description for type `AccountId` which should have been
        overridden (type with `readOnly: true`)
      type: string
      readOnly: true
      example: "123456789"
    ProductOrder:
      description: |
        Represents an order
      type: object
      properties:
        offeringId:
          description: |
            Overidden description for `offeringId`
          allOf:
            - $ref: "#/components/schemas/ProductOfferingId"
        billingAccountId:
          description: >
            Overridden description for `billingAccountId` (type with `readOnly:
            false`)
          readOnly: false
          allOf:
            - $ref: "#/components/schemas/AccountId"
  requestBodies:
    Order:
      required: true
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ProductOrder"
  responses:
    OrderCreated:
      description: Created
      content:
        application/json:
          schema:
            $ref: "#/components/schemas/ProductOrder"

Screenshots
Rendered as expected in RC 59.

rc 59

Error in RC 72. billingAccountId not visible in the request body. All descriptions are wrong.

rc 72

Additional context
Not sure exactly which version the bug was introduced in. I'm sure it works properly in some later versions than rc59 as well.

The specification is rendered correctly in 42crunch openapi editor and in the Redocly openAPI plugin for VisualCode.

@AlexVarchuk
Copy link
Collaborator

Hi @austpaul. Thank you for the reporting. We'll fix that.

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

Successfully merging a pull request may close this issue.

2 participants