Ask a Question

API response type backwards compatible?

jbao81
New Member

API response type backwards compatible?

Right now, I have a POST endpoint schema returning an empty 200 response.

 

      responses:
        '200':
          description: The resource was found.

 

I want to make the change in the schema to return a response object now.

 

      responses:
        '200':
          description: The resource was found.
          content:
            application/json:
              schema: {}

 

I want to know if what I'm trying to do in the schema is possible in a backwards compatible way as logic currently sends '200' and I don't want anything to break by rolling out schema changes first. I want to specify the schema in a way that allows both cases to be valid: the server can either send an empty 200 response (not an empty object, but None) OR it can send an actual response object as well.

Is this possible? Would appreciate any insight 🙂

1 REPLY 1
chichepo
Champion Level 3

Hi @jbao81 

Your changes seems to be correct in order to address your new requirement.
Be aware that the response is not validated against any rules and can include unwanted data.

cancel
Showing results for 
Search instead for 
Did you mean: