Forum Discussion

lkovac's avatar
lkovac
New Contributor
4 years ago
Solved

Swagger: default some object items as not specified/missing

In swagger I define JSON (i.e. object) as input request body for API. Some JSON items are mandatory, others are not, and some of those I want to default (or show example as) to not be specified in th...
  • HKosova's avatar
    4 years ago

    Hi lkovac,

    To limit the properties included in the auto-generated examples, you'll need to provide an object-level example that includes just the needed properties:

    InputJSON:
      type: object
      required:
        - item1
      properties:
        ...
      example:   # <------
        item1: some_value