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

Extend OpenApiAnyFactory to support array-type schemas and multivalued defaults #1283

Conversation

jimfrederic
Copy link

Using 5.0.0-rc3, I had an Operation with a Parameter that was multivalued. I wanted to generate a swagger doc with a default for the parameter, and the default should be an array with a single value. However the OpenApiAnyFactory does not handle arrays. This PR adds that support.

As a result I can annotate my parameter

[DefaultValue(25)] int[] distance,

and it will now now generate

{
  "name": "distance",
  "in": "query",
  "description": "An array of distances",
  "schema": {
    "type": "array",  
    "items": {
      "type": "integer",
	  "format": "int32"
    },
    "default": [
      25
    ]
  }
}

@domaindrivendev
Copy link
Owner

domaindrivendev commented Oct 19, 2020

Closing in favor of #1866

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

Successfully merging this pull request may close these issues.

None yet

2 participants