Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add decorator to allow specification of the schema type name #983

Conversation

radacovsky
Copy link

@radacovsky radacovsky commented Oct 2, 2020

You can use @ApiSchema to set a custom schema name.
Custom schema names are not inherited.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Currently when creating schema for a class the class name is taken as the schema name.

Issue Number: N/A

What is the new behavior?

A new decorator has been introduced: @ApiSchema. Using this decorator you can define custom schema name different from the class name.

e.g.
@ApiSchema({name: 'User'})
class UserDto {}

will produce a schema with name User, not UserDto.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Stefan Radacovsky added 2 commits October 2, 2020 23:59
You can use @ApiSchema to set a custom schema name.
Custom schema names are not inherited.
You can use @ApiSchema to set a custom schema name.
Custom schema names are not inherited.
@kamilmysliwiec
Copy link
Member

Thanks! Could you create a PR to the docs as well? https://github.com/nestjs/docs.nestjs.com

@radacovsky
Copy link
Author

Ok, will do!

@radacovsky
Copy link
Author

@kamilmysliwiec here is the PR for documentation update
nestjs/docs.nestjs.com#1533

Copy link
Contributor

@nartc nartc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@nartc nartc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have a question on the docs PR.

@radacovsky
Copy link
Author

@nartc I haven't noticed any question there. Can you link it here, please?

@radacovsky radacovsky requested a review from nartc November 6, 2020 20:31
@andrew-itscript
Copy link

When do you plan to merge and release it ?

@anchan828
Copy link

I can't wait for merge and release it!

@Dhiraj-JC
Copy link

This PR is very helpful. When you guys are plan to merge and release it?

@zroadhouse-rigup
Copy link

Can we release this soon please? It's been ready for quite a while now. There are other useful features that can be built on top of the ApiSchema decorator once this is merged (documentation at the type level).

@adworacz
Copy link

It looks like this branch has merge conflicts - is this all that remains to be fixed? I'm willing to assist to help get this merged.

@radacovsky
Copy link
Author

radacovsky commented Oct 27, 2021

@adworacz I doubt the maintainer of this project wants to merge this PR/functionality. If he wanted he would have merged it when it was all green.

@kamilmysliwiec
Copy link
Member

Ignore merge conflicts, I'll resolve them when I get to this PR.

@nestjs nestjs locked and limited conversation to collaborators Oct 28, 2021
@kamilmysliwiec
Copy link
Member

#2427

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants