Required fields are visually marked with a red asterisk (*) in the Query Parameters section to ensure users provide necessary inputs during requests.
However, for headers, even though they can be defined as required (required: true), Swagger UI does not display a red asterisk or similar indicator for them. This is by design and not an issue with the tool. The required header will still be enforced during validation.
However, for headers, even though they can be defined as required (required: true), Swagger UI does not display a red asterisk or similar indicator for them. This is by design and not an issue with the tool. The required header will still be enforced during validation.
I assume you mean required fields on headers in responses - because it works fine for headers in requests:
Hi Henrik, yes, you’re correct. The red asterix is displayed for headers in requests, as this field is required by the user of the API to fill in when sending a request.
After consulting with our product team, we found that this use case may not have been considered in the past. We’re aware that SwaggerUI might also act as a documentation tool for server developers.
This seems like a good idea for a feature request. Thank you for bringing this to our attention.