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.

[discussion]: add decorator for setting the description for a schema

See original GitHub issue

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

OpenAPI allows a description not only for single properties but also for a complete schema. This can be optionally validated via no_schema_description in OpenAPI validator. Currently I see no way to set this description via a decorator.

Describe the solution you’d like

In correspondence with (PR 983)[https://github.com/nestjs/swagger/pull/983], where ApiSchema would be used with property name, this could work with a decorator named ApiSchema and a property named description, e.g.

@ApiSchema({ description: "Describing my schema" })
class MyDto {}

Teachability, documentation, adoption, migration strategy

No response

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

Richer OpenAPI documentation with descriptions for schemata

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
kamilmysliwieccommented, Oct 18, 2021

Use #983 as a base branch and create a PR to that branch

1reaction
raplemiecommented, Nov 1, 2021

Could the “title” be included as well ?

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! They enable you to add features to your schemas with...
Read more >
Primer on Python Decorators
By definition, a decorator is a function that takes another function and extends the behavior of the latter function without explicitly modifying it....
Read more >
JS Decorators for mongoose model from scratch - Medium
Decorator is pretty simple, it just gets target what is class constructor function and it invokes typeMetadaStorage.addSchemaMetadata method ...
Read more >
DRF Function Based View custom schema decorator for query ...
and yes i looking through [django-rest-framework] tag on stackoverflow too and yes i open a discussion on DRF google community (but no answers ......
Read more >
@index | typegoose
IndexOptions<T>): ClassDecorator. Parameters: Name, Type, Description ... @index is used to set indices on the schema, this decorator acts like ...
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