swagger 2.0 / OpenAPI 3.0 struggles (polymorphism / arrays)

514 views
Skip to first unread message

Tom Loubejac

unread,
Jul 25, 2018, 4:23:46 AM7/25/18
to Swagger
Hi everyone,

I'm still new to swagger and I have the following problems :

- Arrays are not parsed correctly
what happens is when I make a request containing any sort of non-empty array, it's rejected. So I guess it's not parsed correctly. See my yaml example below :

  Items:
    type
: array
    maxItems
: 10
    items
:
      $ref
: '#/definitions/ItemDefinition'
with ItemDefinition being a simple object with string properties.

also
- oneOf/anyOf do not work in swagger editor, this generates errors such as "should NOT have additional properties. additionalProperty : anyOf". (or oneOf)

  Identity:
    type
: object
    properties
:
     
"firstName":
        type
: string
     
"lastName":
        type
: string
     
"nationality":
        type
: string
     
"title":
        type
: string
     
"identityProof":
        type
: string
     
"identityNumber":
        type
: string


 
IdentityES:
    allOf
:
     
- $ref : '#/definitions/Identity'
     
- properties:
         
"secondaryLastName":
            type
: string


 
CustomerInformation:
    type
: object
    properties
:
     
"identity":
        anyOf
:
         
- $ref: '#/definitions/Identity'
         
- $ref: '#/definitions/IdentityES'
I've tried putting
discriminator: "identity_type"
in Identity but still the API doesn't "recognize" an incomming IdentityES, thus filtering the secundaryLastName property.

I saw that these problems should be resolved thanks to Open API 3.0, and that swagger should support this version of OpenAPI but still I cannot get this to work.

So here are my questions :
- Is OpenAPI 3.0 really supported by swagger ? I googled and found out it does, but it's not that clear (at least to me, English not being my native language // also being a newbie to swagger)
- Is there any workaround that i can do to make this work ?

I'm using swagger online editor to generate aspdotnet classes, visual studio cs for the api, soap UI for sending requests. hope everything's clear enough.

Tom Loubejac

unread,
Jul 25, 2018, 4:25:34 AM7/25/18
to Swagger
Not to mention : I didn't find any relevant solution on the net yet.

Sheila Kelly

unread,
Jul 28, 2018, 8:47:02 AM7/28/18
to swagger-sw...@googlegroups.com
Swagger editor has been working great for my openapi 3.0 spec.  Can you paste the full spec you are having problems with?

On Wed, Jul 25, 2018 at 3:25 AM Tom Loubejac <tlou...@gmail.com> wrote:
Not to mention : I didn't find any relevant solution on the net yet.

--
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-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages