Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty array as default value in Open API Specification 3.0 #119

Open
dabwali opened this issue Mar 12, 2019 · 1 comment
Open

empty array as default value in Open API Specification 3.0 #119

dabwali opened this issue Mar 12, 2019 · 1 comment

Comments

@dabwali
Copy link

dabwali commented Mar 12, 2019

Hi Team,

Is there any way to define empty array as default value in Open API Specification.
I want the below localConnections array to be initialized as empty array rather than null.

Port:
  type: object
  properties:
    id:
      type: string
    value:
      type: string
    localConnections:
      type: array
      items:
        $ref: '#/definitions/Connection'
@macisamuele
Copy link
Collaborator

Hey @dabwali the library does not support Open Api version 3.
It does handles Swagger 1.2 and 2.0 only.

If your specs are Swagger 2.0 you could define the default value at type: array level

Port:
  type: object
  properties:
    id:
      type: string
    value:
      type: string
    localConnections:
      type: array
      default: []
      items:
        $ref: '#/definitions/Connection'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants