OpenAPITools / openapi-generator

OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
https://openapi-generator.tech
Apache License 2.0
21.77k stars 6.57k forks source link

[BUG][Python] - Output format is not same for all the endpoints #16138

Open parthibann opened 1 year ago

parthibann commented 1 year ago
Description

The output format differs for diffenent endpoints and clients unable to read it. some of the response containing “oneof_schema_1_validator” and “actual_instance" objects and other response do not contain those objects.

openapi-generator version

openapi-generator-cli 7.0.0-SNAPSHOT commit : e8422b3

OpenAPI declaration file content or url

https://cdn.intersight.com/components/an-apidocs/1.0.11-12738/model/intersight-openapi-v3-1.0.11-12738.json

Configuration file

useOneOfDiscriminatorLookup: true packageName: intersight projectName: Intersight-OpenAPI packageVersion: 1.0.0.0

Generation Details

java -jar openapi-generator-cli.jar generate -i intersight-openapi-v3-1.0.11-12738.json -g python -o python_sdk

Steps to reproduce

Generate SDK using useOneOfDiscriminatorLookup flag and try making request to multiple endpoints (GET, POST, PUT, DELETE) and observe.

wing328 commented 1 year ago

I assume your endpoint returns oneOf schema (let's called it OneOfResult, which can be Dog, Cat, Bird for example).

The result can be Dog, Cat or Bird and to get the result you will need to access it via actual_instance property/attribute in the oneOf object (OneOfResult in this example).

parthibann commented 1 year ago

actual_instance property/attribute itself is missing in few outputs, we are getting the result directly. we expect all the outputs to either contain actual_instance property or the result directly

wing328 commented 1 year ago

actual_instance property/attribute itself is missing in few outputs

are those "output" defined as oneOf/anyOf in your openapi spec?