Code Monkey home page Code Monkey logo

Comments (8)

darioxtx avatar darioxtx commented on May 10, 2024 2

You should use @ApiModelPropertyOptional()

from swagger.

NiklasMencke avatar NiklasMencke commented on May 10, 2024 1

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.

myflowpl avatar myflowpl commented on May 10, 2024

@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.

NiklasMencke avatar NiklasMencke commented on May 10, 2024

In our project we discovered the same issue and would be very happy about a fix

from swagger.

kamilmysliwiec avatar kamilmysliwiec commented on May 10, 2024

Thanks, fixed. I'll publish it soon. 🔥

from swagger.

cristiboariu avatar cristiboariu commented on May 10, 2024

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.

kamilmysliwiec avatar kamilmysliwiec commented on May 10, 2024

Fixed in 2.1.0

from swagger.

lock avatar lock commented on May 10, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.