forked from nestjs/swagger
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(@nestjs/swagger): Allow custom schema naming
You can use @ApiSchema to set a custom schema name. Custom schema names are not inherited.
- Loading branch information
1 parent
be70eb0
commit aad9825
Showing
5 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { DECORATORS } from '../constants'; | ||
import { SchemaObjectMetadata } from '../interfaces/schema-object-metadata.interface'; | ||
import { createClassDecorator, createPropertyDecorator } from './helpers'; | ||
|
||
export interface ApiSchemaOptions extends Pick<SchemaObjectMetadata, 'name'> { | ||
/** | ||
* Name of the schema. | ||
*/ | ||
name: string; | ||
} | ||
|
||
export function ApiSchema(options: ApiSchemaOptions): ClassDecorator { | ||
return createApiSchemaDecorator(options); | ||
} | ||
|
||
export function createApiSchemaDecorator( | ||
options: ApiSchemaOptions | ||
): ClassDecorator { | ||
return createClassDecorator(DECORATORS.API_SCHEMA, [options]); | ||
} |
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
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
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