Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The success responses Created and No Content still would have the sample response irrespective of the API, hence these could still be included in the global components section. Example should be added for success scenario 204 Created.

But as the response body would be different for different APIs while returning status code 200(OK), this should be defined along with the API and should not be global.  We could define the response body schema under the schema section in global components.

...

This change would also introduce change in the object returned for these API implementation methods in the Controller class.

Adding Examples

You can add examples to parameters, properties and objects to make OpenAPI specification of your web service clearer. Examples can be read by tools and libraries that process your API in some way. For example, an API mocking tool can use sample values to generate mock requests. In CPS, the examples are added at object and property level.

Note: ErrorMessage is a common schema used for all error scenarios. And as the examples as defined at property level, different errors correspond to the same example.