Skip to content

[BUG][Ruby] Set NULL is not possible #4363

@slemrmartin

Description

@slemrmartin

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

In Ruby client, it's not possible to set NULL on any value (I suppose it should be "nullable": true in yaml definition)

openapi-generator version

3.3.4, 4.0.0, 4.1.1, 4.2.0

OpenAPI declaration file content or url

https://github.com/ManageIQ/topological_inventory-ingress_api/blob/12b92fbdb9485d01b7840318dc42a384f557286a/public/doc/openapi-3-v0.0.2.json#L4243
https://github.com/ManageIQ/topological_inventory-ingress_api/blob/12b92fbdb9485d01b7840318dc42a384f557286a/public/doc/openapi-3-v0.0.2.json#L4252
(2nd case: Is it possible to set nullable to ref?)

Command line used for generation
java -jar openapi-generator-cli-3.4.4.jar generate -i public/doc/opeanpi-3-v0.0.2.json.generator.yaml -c .openapi_generator_config.json -g ruby -o topological_inventory-ingress_api-client-ruby

https://github.com/ManageIQ/topological_inventory-ingress_api/blob/master/.openapi_generator_config.json

with version 4.0.0 validator generates 100+ errors, version 4.1+ must be run with --skip-validate-spec

Steps to reproduce

TopologicalInventoryIngressApiClient::ServiceOffering.new(:source_ref => '123', :name => 'Sample',...).to_hash
TopologicalInventoryIngressApiClient::ServiceOffering.new(:source_ref => '123', :name => nil,...).to_hash

Related issues/PRs
Suggest a fix

Following line causes that keys with nil values are deleted, so it's not possible to recognize by server if they're not set or set to nil.

https://github.com/ManageIQ/topological_inventory-ingress_api-client-ruby/blob/8e685e8ae6b50afa69d6aa67284eea64e6da9c9b/lib/topological_inventory-ingress_api-client/models/inventory_collection_service_offering.rb#L199

This client is generated by version 4.2.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions