Comments (8)
You should use @ApiModelPropertyOptional()
from swagger.
Thanks for looking into the issue. Unfortunately the fix doesn't work properly and Custom Object Models are still always shown as "Required" (marked with a red star) in the SwaggerUI. I checked the commits on master and apparently you changed the code to the suggestion which was provided - so maybe this suggestion isnt correct?
@ApiModelProperty({ description: 'Process Metadata', required: true,
type: ProcessData, isArray: false })
@ValidateNested()
@Type(() => ProcessData)
processData: ProcessData;
@ApiModelPropertyOptional({ description: 'Customer Data',
type: CustomerData, isArray: false })
@ValidateNested()
@Type(() => CustomerData)
customerData: CustomerData;
@ApiModelPropertyOptional({ description: 'Vehicle Data',
type: VehicleData, isArray: false })
@ValidateNested()
@Type(() => VehicleData)
vehicleData: VehicleData;
All three attributes are still shown as "required".
from swagger.
@darioxtx it's up to you, it's the same but just shorter notation, anyway @ApiModelPropertyOptional()
has the same issue be course it's just a wrapper around @ApiModelProperty()
from swagger.
In our project we discovered the same issue and would be very happy about a fix
from swagger.
Thanks, fixed. I'll publish it soon. 🔥
from swagger.
I confirm the issue outlined by @NiklasMencke
Can a fix be provided for this too ? Basically required is still appearing for objects, eg:
@ApiModelPropertyOptional({type: ChannelDto})
channel: ChannelDto;
from swagger.
Fixed in 2.1.0
from swagger.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
from swagger.
Related Issues (20)
- The file upload example in the official document is not working properly HOT 2
- Add service to provide granular control over generated resources (like guards) HOT 1
- Circular dependency with generated swagger metadata HOT 5
- Include for controllers instead of modules HOT 1
- Some of @ApiOperation decorator options are being ignored or overwritten HOT 2
- @ApiQuery does not work properly with fastify
- Error message with Typescript < v4.8 is confusing HOT 3
- When I use SWC compilation, the service will restart twice HOT 3
- Route param does not appear in Swagger UI when handler's argument has non-primitive type
- Enum arrays values are listed instead of using reference HOT 2
- @ApiProperty - Include default value when using `enumName` HOT 2
- properties decorated with `@ApiHideProperty()` are being displayed in swagger UI HOT 1
- Detect schema in monorepo HOT 1
- Swagger decorator @ApiHeader is not including header on request HOT 2
- Introspected comment on controller class makes top-level comment the operation description then overrides it with TsDoc "remarks" directive HOT 1
- @ApiProperty() enum can display keys in the UI instead of just values. HOT 1
- CLI plugin does not appear to be working at all with swc? HOT 1
- 'name' is specified more than once, so this usage will be overwritten. HOT 1
- Compiler error "ReferenceError: require is not defined in ES module scope, you can use import instead"
- NestJS 10 is incorrectly parsing the jsdocs comments to generate swagger docs
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from swagger.