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
  • #10721
Closed
Open
Issue created Oct 28, 2021 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][crystal][client] Optional properties should have nillable types in models

Created by: cyangle

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

Crystal lang supports nillable data types. When value nil or missing value is allowed for a variable, the data type for it should be nillable.

A variable or property is nillable in below scenarios:

  • It's NOT REQUIRED, in other words, it's OPTIONAL
  • It's both REQUIRED and NULLABLE nullable has been removed from OAS 3.1

When the above two types of nillable variables with nil values are serialized into json/xml, they should be handled differently:

  • The OPTIONAL variables should be omitted from the json string
  • The NULLABLE REQUIRED variables MUST be included in the json string with null values
  • REQUIRED variables CAN NOT have nil/null values, thus will never emit null values
openapi-generator version

All versions supporting crystal client generator, I'm using master branch version.

OpenAPI declaration file content or url

pet store api spec

Generation Details

Issue exists in the pet store sample code

Steps to reproduce
Related issues/PRs
Suggest a fix

Mark model properties as nillable when applicable

Assignee
Assign to
Time tracking