Skip to content

[BUG][cpp-restsdk] Numbers without dots (integers) are not converted to double #7751

@tzickel

Description

@tzickel

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

Trying to use the cpp-restsdk client generator I have a few issues. I'll write them in order of importance:

  1. If I define a property as a type number, format double, it will only accept JSON numbers with dot, and not parse integers!!. The csharp-nancyfx server encodes 0 as 0 and not 0.0 which ofcourse causes this not to work. I guess the ModelBase for float/double should need a check for double casting and if not, than int casting.

  2. The modelbase seems to ignore required flags in the model, and in the situation above it will put NaNs in the model instead of erroring that not all required fields have been set (in this case it's a bug, bug in other cases where it can't convert?). The ok result of fromJson should be checked, and an exception raised if the required fields have been specified ?

  3. The new CMake modifications for this client for some reason declare the model/modules header files as private and require manual addition of them in the client that uses the autogen code, is that a mistake ? (why would I want to use this generated code, if not to use it's header files, and those I don't want I can disable in generation part ?) Make them non-private in the cmake script ?

openapi-generator version

master

OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Related issues/PRs
Suggest a fix

Written above.

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