ApiModelProperty groups
See original GitHub issueHi,
thank you with your contribution of nest and swagger.
I have a question, is there a possibility that the properties with the decorator @ApiModelProperty
support groups?
Similar to class-validator groups https://github.com/typestack/class-validator#validation-groups.
export class MyClass {
@ApiModelProperty({ groups: ["edit"] })
id: string;
@ApiModelProperty({ groups: ["edit", "create"] })
name: string;
@ApiModelProperty({ groups: ["edit", "create"] })
description: string;
}
in controller
@ApiImplicitBody({ required: true, type: MyClass, name: "name", groups:["create"] })
//or
@ApiResponse({ status: 200, description: "OK", type: MyClass, groups:["edit"] })
or is there an alternative to not show all the attributes in a response or body? Currently I am creating additional classes.
Thanks
Issue Analytics
- State:
- Created 6 years ago
- Reactions:19
- Comments:14 (1 by maintainers)
Top Results From Across the Web
swagger @ApiModelProperty example value for List<String ...
I managed to get this to work, generating a List of Strings. Within the ApiModelProperty with springfox 2, write your example as follows:...
Read more >ApiModelProperty considered differently for POST or for GET ...
Hi there, I am having some problems restricting the documentation for a ApiModelProperty whether the model is to be displayed for a POST...
Read more >io.swagger.annotations.ApiModelProperty Java Examples
This page shows Java code examples of io.swagger.annotations.ApiModelProperty.
Read more >@io.swagger.annotations.ApiModelProperty(value = Parent group ...
ApiModelProperty (value = Parent group name the property belongs to.). Learn how to use java api @io.swagger.annotations.ApiModelProperty(value = Parent ...
Read more >Swagger @ApiParam vs @ApiModelProperty | Baeldung
Learn the difference between Swagger's @ApiParam and @ApiModelProperty.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In the latest release (4.5.0), we added
PartialType
,OmitType
, andPickType
functions which can mimic the behavior of built-in TypeScript types (respectivelyPartial
,Omit
, andPick
).Example:
and to create the
UpdateUserDto
class based on theCreateUserDto
, but with all properties marked as optional, use the following code:If you want to exclude, let’s say, the
email
property (because, for instance, email has to be unique and cannot be modified), composeOmitType
andPartialType
functions, as follows:Its a very useful functionality. Hope will add in future.