OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
a oneOf schema that has a primitive type, such as string, as one of the options generates invalid typescript code that doesn't compile, (but can be fixed with a couple small manual tweaks)
(I think this also applies to anyOf)
openapi-generator version
typescript-fetch, using openapi-generator version 6.2.1
Description
a
oneOf
schema that has a primitive type, such asstring
, as one of the options generates invalid typescript code that doesn't compile, (but can be fixed with a couple small manual tweaks)(I think this also applies to
anyOf
)openapi-generator version
typescript-fetch, using openapi-generator version
6.2.1
OpenAPI declaration file content or url
this generates code that looks like:
Also, the JSON-serialization function that gets generated (
FooEntityToJSON
) is invalid too.Steps to reproduce
generate a typescript client using from the given example schemas above ☝️
Related issues/PRs
Suggest a fix
import
s generated for them.typeof(...) === "string"
instead ofinstanceOfstring
if
checks for primtives should be moved to be before theif
s of objects