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

feat: Add basic support for parameter properties #2687

Merged
merged 1 commit into from
Jan 15, 2024

Commits on Nov 2, 2023

  1. feat: Add basic support for parameter properties

    The feature is controlled by the `parameterProperties` option, which is disabled by default. As the feature is opt-in, it should be possible to release it as a minor version.
    
    Worth noting, that using parameter properties has some limitations compared to the regular properties, but it can still be useful for some basic scenarios.
    
    1. Can't use validation annotations as it is not supported by the class-validator - typestack/class-validator#1669.
    2. Can't use JSDoc tags, e.g. `@example` or `@deprecated`. Parsing description from the comment is not implemented in this PR, but can potentially be added from the `@param` JSDoc tag.
    3. Can't use `@ApiProperty` and `@ApiHideProperty` decorators. This can be supported by introducing a dedicated decorators which works on parameters, e.g. `@ApiParameterProperty` and `@ApiHideParameterProperty()` with the same signatures. It shouldn't be hard to add, but just wanted to hear if you're interested in adding this feature and collect feedback before I put more work into it.
    
    Features which are supported and work the same way as for regular properties:
    
    1. `required` and `nullable`
    2. `type`
    3. `enum`
    4. `default`
    
    Fixes nestjs#2056
    devoto13 committed Nov 2, 2023
    Configuration menu
    Copy the full SHA
    e3151bc View commit details
    Browse the repository at this point in the history