question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add decorator to allow specification of the schema type name

See original GitHub issue

I’m submitting a…


[ ] Regression 
[ ] Bug report
[X] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

The Open API schema type name is the same as the type name.

Expected behavior

Add a decorator to allow specification of a schema type name that is different from the type name.

For example:

@ApiSchema({ name: 'MyType' })
class MyTypeDto {
}

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Type names often have suffixes such as Entity or Dto that represent internal implementation choices. Allowing explicit specification of the schema type name would avoid leaking these choices into the public interface.

Environment


Nest swagger version: 4.5.12

 
For Tooling issues:
- Node version: 12.13  
- Platform: Mac 

Others:

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
libertysoftwarecommented, Oct 1, 2020

Would you like to create a PR for this?

May I try?

0reactions
kamilmysliwieccommented, Nov 10, 2020
Read more comments on GitHub >

github_iconTop Results From Across the Web

GraphQL schema decorators
Schema decorators will allow you to do both of these things and more! ... You can create custom types and combine them into...
Read more >
OpenAPI Decorators | LoopBack Documentation
The model decorators allow type information of the model to be visible to the spec generator so that @requestBody can be used on...
Read more >
typestack/class-validator: Decorator-based property ... - GitHub
Allows use of decorator and non-decorator based validation. Internally uses validator.js to perform validation. Class-validator works on both browser and node. ...
Read more >
Decorators | tsoa - GitHub Pages
The @Security decorator can be used above controller methods to indicate that there ... OpenAPI allows you to deprecate operations, parameters, and schemas....
Read more >
Decorators | Sanic Framework
The primary mechanism for adding content to your schema is by ... The @openapi.definition decorator allows you to define all parts of an ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found