Skip to content

Does schema field using oneOf support readOnly attribute? #890

Open

Description

@AlaNDGT

Does schema field using oneOf support readOnly attribute same as allOf?
oneOf fields are displayed on PUT|POST|PATCH but allOf are hidden as shown bellow:

image

Example OAS:

openapi: 3.1.0
info:
  title: test
  version: '1.0'
servers:
  - url: 'http://localhost:3000'
paths:
  /test:
    parameters: []
    put:
      summary: test
      operationId: put-test
      responses:
        '200':
          description: OK
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Pet'
      description: update
    get:
      summary: Get
      operationId: get-test
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Pet'
      description: get
components:
  schemas:
    Pet:
      title: Pet
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        testAllOf:
          allOf:
            - type: object
              properties:
                foo:
                  type: string
            - type: string
          readOnly: true
        testOneOf:
          oneOf:
            - type: object
              properties:
                foo:
                  type: string
            - type: string
            - type: 'null'
          readOnly: true

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions