How much of OpenAPI 3 syntax is currently supported by Collections?

We use composite validations like oneOf in our OpenAPI request body definitions. So far it appears that validation isn’t reflected in Collections generated from an API or mentioned in the associated documentation. Is that correct? If so, is there any info available regarding what elements Collections are unable to reflect and what ends up in the Collection when it is not? (I.e. if oneOf isn’t supported, is it automatically treated as string?)

For any validation elements in OpenAPI that aren’t currently carried over to Collections, are there plans for adding them?

It would be ideal if we didn’t need to separately generate and publish a pretty version of the OpenAPI details, outside Postman, in addition to the pretty Collection documentation, but so far it is looking like that may be necessary. Am I missing anything?

3 Likes

I’m having what I think is the same problem. With a definition like:

 responses:
            '200': 
                description: 'Success'
                content:
                    application/json:
                        schema:
                            oneOf:
                              - $ref: '#/components/schemas/Results'
                              - $ref: '#/components/schemas/ResultsArray'

/Results is an object and /ResultsArray is an array. Which you get depends on a parameter in the request.

But in the collection if I make a request and get an response that uses the ResultsArray schema I get the error:

“The response body needs to be of type object, but we found an array instead”

Switching the order of the oneOf array items leads to the opposite behaviour

 responses:
            '200': 
                description: 'Success'
                content:
                    application/json:
                        schema:
                            oneOf:
                              - $ref: '#/components/schemas/ResultsArray'
                              - $ref: '#/components/schemas/Results'

In this case I get the schema validation error (telling me an array is expected not an object) for requests that get a response in the Results schema

1 Like