NSwag: property 'required' of response header in OAS 3 yaml files returns error on code generation
We have a OAS 3 yaml file with the following response header:
X_Pagination_Page:
required: true
schema:
type: integer
description: Current page.
example: 3
I download the latest NSwag studio for windows and when I try to generate client code, I get the following error:
Error converting value “true” to type ‘System.Collections.Generic.ICollection`1[System.String]’
The same happens when I change ‘true’ into ‘false’
Is this property not supported in the current version?
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 1
- Comments: 16 (7 by maintainers)
Commits related to this issue
- [pull] master from RicoSuter:master (#2) * Bump y18n from 3.2.1 to 3.2.2 in /src/NSwag.Sample.NetCoreAngular Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2. - [Release notes](https:... — committed to InfoTrackGlobal/NSwag by pull[bot] 3 years ago
- [pull] master from RicoSuter:master (#3) * Bump y18n from 3.2.1 to 3.2.2 in /src/NSwag.Sample.NetCoreAngular Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2. - [Release notes](https:... — committed to InfoTrackGlobal/NSwag by pull[bot] 3 years ago
Why is this closed? Is there another bug open? Is there a disagreement over the open API spec?
https://github.com/RicoSuter/NSwag/issues/2576#issuecomment-613146417
This comment would indicate the issue needs re-opening.
EDIT: The example for parameters in the link below, documents the required value as a boolean, not as a collection: https://swagger.io/docs/specification/describing-parameters/
The swagger output I have appears to have the same format (with some $refs) and is giving me this error.
@RicoSuter
The components object examples has a required:true https://swagger.io/specification/#componentsObject The header object https://swagger.io/specification/#header-object follows structure of a Parameter object https://swagger.io/specification/#parameter-object which has a “required” boolean. Also says here that it is a boolean: https://swagger.io/docs/specification/describing-parameters/#header-parameters
This “Simple Model” structure from the picture doesn’t seem to apply to headers I suppose? Or maybe this has changed recently?