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
  • #8278
Closed
Open
Issue created Dec 28, 2020 by Administrator@rootContributor

[DART] Add null-safety for dart 2.12+

Created by: harsimranmaan

Is your feature request related to a problem? Please describe.

Starting with DART 2.12 dart packages support sound null-safety making it easy to detect common pitfalls during static analysis.

The current implementation of DART2 does not follow null-safety principles.

Describe the solution you'd like

The generated code should follow sound null-safety as per https://dart.dev/null-safety.

If an openapi field is not marked as required, it should be nullable by default: eg:

    Customer:
      type: object
      required:
        - name
        - tenant_id
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        created_at:
          type: string
          format: date-time
          readOnly: true
        updated_at:
          type: string
          format: date-time
          readOnly: true
        created_by:
          type: string
          format: uuid
          readOnly: true
        tenant_id:
          type: string
          format: uuid
        name:
          type: string
          minLength: 3
          maxLength: 50

should generate a class Customer with fields like String? id, String tenantId, String name, Datetime? createdAt ...

Describe alternatives you've considered

Use the legacy mode until null-safety is supported.

Additional context

Required by https://github.com/gibahjoe/openapi-generator-dart/issues/26

Assignee
Assign to
Time tracking