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
  • Merge requests
  • !13177

[rust] Fix generation for optional and nullable fields (double option pattern)

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jacob-pro/Issue-13174 into master Aug 13, 2022
  • Overview 4
  • Commits 2
  • Pipelines 0
  • Changes 31

Created by: jacob-pro

Solution to: https://github.com/OpenAPITools/openapi-generator/issues/13174

Where a field is both nullable and not-required it will now be represented using the double optional pattern. This is useful for partial update APIs where ignoring a field and setting it to null are two very different things.

It also makes a technical correction to the unusual case where a field is both required and nullable, such that deserializing now requires the field to be present in the JSON (though it can be null).

Rust technical committee tags: @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05)

For context, this feature is already supported in rust-server, however rust-server uses a special purpose utility crate. In the case of the Rust client I think it makes sense to use the general purpose serde extension serde_with.

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jacob-pro/Issue-13174