Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2269
Closed
Open
Issue created Feb 28, 2019 by Administrator@rootContributor

[BUG][C#] Dto properties can't be made non-nullable

Created by: sturlath

Description

If I try to generate aspnetcore dto's the nullable = false is alwasy ignored and all the properties created are created nullable.

If I have nullable field in my api.yaml file (skipping allot for brevity)

        expireDateOfOffer:
          type: string
          format: date
          nullable: false (toggling/skipping this doesn't change anything! )

and then run the following

java -DdebugModels -jar openapi-generator-cli-4.0.0-20181226.105224-120.jar generate -i api.yaml -g aspnetcore -o c:\Temp -t templates\aspnetcore\controller -Dapis

I get

        /// <summary>
        /// Gets or Sets ExpireDateOfOffer
        /// </summary>
        [DataMember(Name="expireDateOfOffer")]
        public DateTime? ExpireDateOfOffer { get; set; }

I can't seem to get rid off the ? (nullable) after the DateTime. I don't want it to be nullable!

openapi-generator version

4.0.0-20181226.105224-120

Command line used for generation

java -DdebugModels -jar openapi-generator-cli-4.0.0-20181226.105224-120.jar generate -i api.yaml -g aspnetcore -o c:\Temp -t templates\aspnetcore\dtos -Dapis

Steps to reproduce

Run the previous command line on a yaml file with property you want to have as non-nullable and see if you can make it so.

Related issues/PRs

Couldn't find anything except maybe this one

Assignee
Assign to
Time tracking