Description
I've been using the openapi generation for years. I tend to generate python and javascript client libraries.
The problem I found occurs when you have a property that uses "oneOf", and the list of types includes "type: object".
I've patched the generated code, with success. The patch is quite simple. Hence I hope that this can be quickly resolved.
The generated javascript code does a check on type. It properly checks numbers, strings, arrays, booleans, however it fails to check on the object type and hence increments match. When I patched this the problem that I saw went away.
Bug

Patch

openapi-generator version
7.3.0
OpenAPI declaration file content or url
Just recently we added a tweak to the API spec as follows:
Spec:
required:
- name
- value
type: object
properties:
name:
type: string
example: zone
value:
oneOf:
- type: string
- type: number
- type: integer
- type: boolean
- type: array
items:
type: object
- type: object
example: Critical
xml:
name: spec
Generation Details
npx ./node_modules/\@openapitools/openapi-generator-cli generate -i interface_spec.yaml -g javascript -o test_lib_javascript
Suggest a fix
try {
if (!(typeof instance === "object")) {
throw new Error(
"Invalid value. Must be object. Input: " + JSON.stringify(instance)
);
}
this.actualInstance = instance;
match++;
} catch (err) {
// json data failed to deserialize into Object
errorMessages.push("Failed to construct Object: " + err);
}
Description
I've been using the openapi generation for years. I tend to generate python and javascript client libraries.
The problem I found occurs when you have a property that uses "oneOf", and the list of types includes "type: object".
I've patched the generated code, with success. The patch is quite simple. Hence I hope that this can be quickly resolved.
The generated javascript code does a check on type. It properly checks numbers, strings, arrays, booleans, however it fails to check on the object type and hence increments match. When I patched this the problem that I saw went away.
Bug

Patch

openapi-generator version
7.3.0
OpenAPI declaration file content or url
Just recently we added a tweak to the API spec as follows:
Generation Details
Suggest a fix