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

More properties to DTO fields #42

Open
yeefan opened this issue Feb 19, 2021 · 4 comments
Open

More properties to DTO fields #42

yeefan opened this issue Feb 19, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@yeefan
Copy link

yeefan commented Feb 19, 2021

It seems that as of version 1.2.5, DTO_FIELD_INFO only has "description" and "pattern". Is it possible to support additional properties for DTO fields such as the following?

  • Example
  • Required
  • Default value

Thanks!

@lganzzzo lganzzzo added enhancement New feature or request and removed enhancement New feature or request labels Feb 19, 2021
@lganzzzo
Copy link
Member

Hey @yeefan ,

  • To add examples for an endpoint - see the description in this PR - Multiple example values #36
  • Default values - are auto documented based on the default values set in the DTO
    class MyDto {
      ...
      DTO_FIELD(String, myField) = "default value"; // <---the default value will be documented
    };

The Required property is a good point. We should think about how to add it

@lganzzzo lganzzzo added the enhancement New feature or request label Feb 19, 2021
@ghost
Copy link

ghost commented Sep 8, 2021

Not to increase scope too much, but adding a minimum/maximum (with inclusive/exclusive boundary) for numerical values would also be useful. Some other properties at https://swagger.io/docs/specification/data-models/data-types/#range) may be good to consider.

@Inujel
Copy link

Inujel commented Oct 11, 2022

Adding the possibility to document minimum and maximum values would be really interesting.

The range is currently included in the OpenAPI json and is displayed by some tools. The default value does not look great:
image

@almejara
Copy link

Adding the possibility to document minimum and maximum values would be really interesting.

The range is currently included in the OpenAPI json and is displayed by some tools. The default value does not look great: image

Hello. Finally it was done? If yes can I have an example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants