ApiHeader default value not working
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
I want to set a default value to my header property(requestId) using ApiHeader
decorator.
So, i’ve set a value. but not showing my swagger page.
Minimal reproduction of the problem with instructions
import { applyDecorators } from '@nestjs/common';
import { ApiHeader } from '@nestjs/swagger';
import { v4 as uuidv4 } from 'uuid';
export function CommonHeaderReceiptDecorator() {
return applyDecorators(
ApiHeader({
name: 'requestId',
description: 'Definition of the requestId header A unique request ID, represented by a UUID.',
required: true,
allowEmptyValue: false,
schema: {
default: uuidv4()
}
}),
);
}
Environment
Nest version: 6.14.2
For Tooling issues:
- Node version: v13.12.0
- Platform: MAC
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
ApiHeader default value doesn't work · Issue #666 - GitHub
I'd like to set a default value to a @ApiHeader but it's not working. The default value is not set on the json...
Read more >Is there a way to declare a default value when using ...
Answer detailed at the bottom. The NestJS website has documentation to [declare default values][1] when using @ApiBody(), is there a way to do ......
Read more >Describing Parameters - Swagger
The default value is the one that the server uses if the client does not supply the parameter value in the request. The...
Read more >Amazon API Gateway API request and response data ...
When the Accept header is not specified in the request, API Gateway assumes that its default value is application/json . In this case,...
Read more >Swagger documentation - Flask-RESTX - Read the Docs
You can specify a default response sent without knowing the response code: ... This parameter accepts the same values as the Api.doc() decorator....
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 FreeTop 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
Top GitHub Comments
Fixed in 4.5.11
@kamilmysliwiec https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#schemaObject
default
property is defined on schema object level. Please reopen.