property 'required' of response header in OAS 3 yaml files returns error on code generation
See original GitHub issueWe 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?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:16 (7 by maintainers)
Top Results From Across the Web
open api error: request should have required property '. ...
I have no property '.headers' mentioned in the open-api.yaml file. I tried removing the validator middleware, and the request went through just ...
Read more >Describing Responses
OAS 3 This guide is for OpenAPI 3.0. ... A response is defined by its HTTP status code and the data returned in...
Read more >OpenAPI Specification v3.1.0 | Introduction, Definitions, & ...
The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.
Read more >Common Mistakes Developers Make In Their OpenAPI 3 ...
Declaring response headers as a list of Header objects. It looks like some developers are trying to generate their OAS 3 files from...
Read more >Generate Server Code Using OpenAPI Generator
OpenAPI Generator can generate code based on an OpenAPI yaml ... When the ID does not exist, a NOT FOUND response will be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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?