-
-
Save jointhejourney/13b4cd7feba0864f11c8fd42fd069890 to your computer and use it in GitHub Desktop.
@ApiHeader() schema override behavior
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/test: | |
post: | |
operationId: TestController_testRequest | |
parameters: | |
- name: Journey-Version | |
in: header | |
description: Journey API version. | |
required: false | |
schema: | |
enum: | |
- '1' | |
type: string | |
default: '1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/test: | |
post: | |
operationId: TestController_testRequest | |
parameters: | |
- name: Journey-Version | |
in: header | |
description: Journey API version. | |
required: false | |
schema: | |
enum: | |
- '1' | |
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Controller, Headers } from '@nestjs/common'; | |
import { ApiHeader } from '@nestjs/swagger'; | |
@Controller() | |
export class TestController { | |
@Post('test') | |
@ApiHeader({ | |
name: 'Journey-Version', | |
description: 'API version', | |
enum: ['1'], | |
schema: { | |
default: '1', | |
} | |
}) | |
async testRequest( | |
@Headers('Journey-Version') versionId?: string, | |
) { | |
// endpoint | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment