mirror of
				https://github.com/Redocly/redoc.git
				synced 2025-11-04 01:37:32 +03:00 
			
		
		
		
	Add demo to show capability of oneOf attribute
This commit is contained in:
		
							parent
							
								
									074872b7ee
								
							
						
					
					
						commit
						133f1ab77d
					
				| 
						 | 
					@ -292,6 +292,76 @@ paths:
 | 
				
			||||||
        - petstore_auth:
 | 
					        - petstore_auth:
 | 
				
			||||||
            - 'write:pets'
 | 
					            - 'write:pets'
 | 
				
			||||||
            - 'read:pets'
 | 
					            - 'read:pets'
 | 
				
			||||||
 | 
					  '/pet/{petId}/behaviors':
 | 
				
			||||||
 | 
					    put:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Change behaviors
 | 
				
			||||||
 | 
					      description: Update the pet's behaviors
 | 
				
			||||||
 | 
					      operationId: updateBehavior
 | 
				
			||||||
 | 
					      produces:
 | 
				
			||||||
 | 
					        - application/xml
 | 
				
			||||||
 | 
					        - application/json
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: petId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: ID of pet to return
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        - name: body
 | 
				
			||||||
 | 
					          in: body
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            oneOf:
 | 
				
			||||||
 | 
					              - $ref: "#/definitions/CatBehavior"
 | 
				
			||||||
 | 
					              - $ref: "#/definitions/DogBehavior"
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '200':
 | 
				
			||||||
 | 
					          description: successful operation
 | 
				
			||||||
 | 
					          schema:
 | 
				
			||||||
 | 
					            $ref: '#/definitions/Pet'
 | 
				
			||||||
 | 
					        '400':
 | 
				
			||||||
 | 
					          description: Invalid ID supplied
 | 
				
			||||||
 | 
					        '404':
 | 
				
			||||||
 | 
					          description: Pet not found
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - api_key: []
 | 
				
			||||||
 | 
					    post:
 | 
				
			||||||
 | 
					      tags:
 | 
				
			||||||
 | 
					        - pet
 | 
				
			||||||
 | 
					      summary: Updates a pet in the store with form data
 | 
				
			||||||
 | 
					      description: ''
 | 
				
			||||||
 | 
					      operationId: updatePetWithForm
 | 
				
			||||||
 | 
					      consumes:
 | 
				
			||||||
 | 
					        - application/x-www-form-urlencoded
 | 
				
			||||||
 | 
					      produces:
 | 
				
			||||||
 | 
					        - application/xml
 | 
				
			||||||
 | 
					        - application/json
 | 
				
			||||||
 | 
					      parameters:
 | 
				
			||||||
 | 
					        - name: petId
 | 
				
			||||||
 | 
					          in: path
 | 
				
			||||||
 | 
					          description: ID of pet that needs to be updated
 | 
				
			||||||
 | 
					          required: true
 | 
				
			||||||
 | 
					          type: integer
 | 
				
			||||||
 | 
					          format: int64
 | 
				
			||||||
 | 
					        - name: name
 | 
				
			||||||
 | 
					          in: formData
 | 
				
			||||||
 | 
					          description: Updated name of the pet
 | 
				
			||||||
 | 
					          required: false
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					        - name: status
 | 
				
			||||||
 | 
					          in: formData
 | 
				
			||||||
 | 
					          description: Updated status of the pet
 | 
				
			||||||
 | 
					          required: false
 | 
				
			||||||
 | 
					          type: string
 | 
				
			||||||
 | 
					      responses:
 | 
				
			||||||
 | 
					        '405':
 | 
				
			||||||
 | 
					          description: Invalid input
 | 
				
			||||||
 | 
					      security:
 | 
				
			||||||
 | 
					        - petstore_auth:
 | 
				
			||||||
 | 
					            - 'write:pets'
 | 
				
			||||||
 | 
					            - 'read:pets'
 | 
				
			||||||
  /pet/findByStatus:
 | 
					  /pet/findByStatus:
 | 
				
			||||||
    get:
 | 
					    get:
 | 
				
			||||||
      tags:
 | 
					      tags:
 | 
				
			||||||
| 
						 | 
					@ -653,12 +723,34 @@ definitions:
 | 
				
			||||||
        type: string
 | 
					        type: string
 | 
				
			||||||
      message:
 | 
					      message:
 | 
				
			||||||
        type: string
 | 
					        type: string
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  CatBehavior:
 | 
				
			||||||
 | 
					    type: object
 | 
				
			||||||
 | 
					    properties:
 | 
				
			||||||
 | 
					      mainTrait:
 | 
				
			||||||
 | 
					        type: string
 | 
				
			||||||
 | 
					        enum:
 | 
				
			||||||
 | 
					          - cuddly
 | 
				
			||||||
 | 
					          - aggressive
 | 
				
			||||||
 | 
					          - lazy
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      dangerous:
 | 
				
			||||||
 | 
					        type: boolean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Cat:
 | 
					  Cat:
 | 
				
			||||||
    description: A representation of a cat
 | 
					    description: A representation of a cat
 | 
				
			||||||
    allOf:
 | 
					    allOf:
 | 
				
			||||||
      - $ref: '#/definitions/Pet'
 | 
					      - $ref: '#/definitions/Pet'
 | 
				
			||||||
      - type: object
 | 
					      - type: object
 | 
				
			||||||
        properties:
 | 
					        properties:
 | 
				
			||||||
 | 
					          behaviors:
 | 
				
			||||||
 | 
					            type: array
 | 
				
			||||||
 | 
					            default: []
 | 
				
			||||||
 | 
					            description: A list of behaviors for this Cat
 | 
				
			||||||
 | 
					            items:
 | 
				
			||||||
 | 
					              $ref: "#/definitions/CatBehavior"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          huntingSkill:
 | 
					          huntingSkill:
 | 
				
			||||||
            type: string
 | 
					            type: string
 | 
				
			||||||
            description: The measured skill for hunting
 | 
					            description: The measured skill for hunting
 | 
				
			||||||
| 
						 | 
					@ -668,6 +760,7 @@ definitions:
 | 
				
			||||||
              - lazy
 | 
					              - lazy
 | 
				
			||||||
              - adventurous
 | 
					              - adventurous
 | 
				
			||||||
              - aggressive
 | 
					              - aggressive
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        required:
 | 
					        required:
 | 
				
			||||||
          - huntingSkill
 | 
					          - huntingSkill
 | 
				
			||||||
  Category:
 | 
					  Category:
 | 
				
			||||||
| 
						 | 
					@ -690,12 +783,32 @@ definitions:
 | 
				
			||||||
            description: Dumb Property
 | 
					            description: Dumb Property
 | 
				
			||||||
    xml:
 | 
					    xml:
 | 
				
			||||||
      name: Category
 | 
					      name: Category
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  DogBehavior:
 | 
				
			||||||
 | 
					    type: object
 | 
				
			||||||
 | 
					    properties:
 | 
				
			||||||
 | 
					      mainTrait:
 | 
				
			||||||
 | 
					        type: string
 | 
				
			||||||
 | 
					        enum:
 | 
				
			||||||
 | 
					          - noisy
 | 
				
			||||||
 | 
					          - slimy
 | 
				
			||||||
 | 
					          - dependent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					      dangerous:
 | 
				
			||||||
 | 
					        type: boolean
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Dog:
 | 
					  Dog:
 | 
				
			||||||
    description: A representation of a dog
 | 
					    description: A representation of a dog
 | 
				
			||||||
    allOf:
 | 
					    allOf:
 | 
				
			||||||
      - $ref: '#/definitions/Pet'
 | 
					      - $ref: '#/definitions/Pet'
 | 
				
			||||||
      - type: object
 | 
					      - type: object
 | 
				
			||||||
        properties:
 | 
					        properties:
 | 
				
			||||||
 | 
					          behaviors:
 | 
				
			||||||
 | 
					            type: array
 | 
				
			||||||
 | 
					            default: []
 | 
				
			||||||
 | 
					            description: A list of behaviors for this Dog
 | 
				
			||||||
 | 
					            items:
 | 
				
			||||||
 | 
					              $ref: "#/definitions/DogBehavior"
 | 
				
			||||||
          packSize:
 | 
					          packSize:
 | 
				
			||||||
            type: integer
 | 
					            type: integer
 | 
				
			||||||
            format: int32
 | 
					            format: int32
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user