Both oneOf and anyOf are valid and supported – they just have a different 
meaning.

 

 

From: <swagger-swaggersocket@googlegroups.com> on behalf of 
"amcmani...@pindrop.com" <amcmani...@pindrop.com>
Reply-To: "swagger-swaggersocket@googlegroups.com" 
<swagger-swaggersocket@googlegroups.com>
Date: Monday, April 30, 2018 at 16:14
To: Swagger <swagger-swaggersocket@googlegroups.com>
Subject: Is anyOf Allowed With Array Items

 

Hi Everyone, 

 

Is the following snippet valid OAS 3.0? I'm mainly wondering about healthSigns. 
According to the spec documentation oneOf is valid for use in arrays. However 
anyOf appears to work just fine with the swagger editor.

 

PetCreatePartTwo:
  type: object
  x-model: PetCreatePartTwo
  properties:
    position:
      $ref: "#/components/schemas/Position"
    healthy:
      type: boolean
    healthSigns:
      type: array
      items:
        anyOf:
          - $ref: '#/components/schemas/FreshBreath'
          - $ref: '#/components/schemas/ShinyCoat'
          - $ref: '#/components/schemas/EyesBright'

    animalType:
      oneOf:
        - $ref: '#/components/schemas/MammalDetails'
        - $ref: '#/components/schemas/AvianDetails'
 
MammalDetails:
  type: object
  properties:
    breed:
      type: string
AvianDetails:
  type: object
  properties:
    species:
      type: string
FreshBreath:
  type: object
  properties:
    freshBreath:
      type: boolean
ShinyCoat:
  type: object
  properties:
    shinyCoat:
      type: boolean
EyesBright:
  type: object
  properties:
    eyesBright:
      type: boolean
 


Here is the entire spec in case it's necessary.
https://gist.github.com/AMcManigal/b9932f18bd98ba6e2316a1b566321b62

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to