OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
The purpose of this pull request is to fix an issue where the TypeScript + fetch generated code with oneOf does not properly check the dto type.
Description
The issue was that the generated instanceOfXXX() functions did not properly check the type property to determine which model instance it is. This caused bugs in production where Payload2 and Payload3 were never matched.
The changes in this pull request update the modelGeneric.mustache template to generate the instanceOfXXX() functions that properly check the type property against the enum values.
Summary
Updated the modelGeneric.mustache template to generate instanceOfXXX() functions that properly check the type property against the enum values for oneOf models.
Added logic to handle both discriminator-based and non-discriminator-based oneOf models.
Fixes #1.
[!TIP]
To get Sweep to edit this pull request, you can:
Comment below, and Sweep can edit the entire PR
Comment on a file, Sweep will only modify the commented file
Edit the original issue to get Sweep to recreate the PR from scratch
This is an automated message generated by Sweep AI.
Purpose
The purpose of this pull request is to fix an issue where the TypeScript + fetch generated code with
oneOf
does not properly check the dto type.Description
The issue was that the generated
instanceOfXXX()
functions did not properly check thetype
property to determine which model instance it is. This caused bugs in production wherePayload2
andPayload3
were never matched.The changes in this pull request update the
modelGeneric.mustache
template to generate theinstanceOfXXX()
functions that properly check thetype
property against the enum values.Summary
modelGeneric.mustache
template to generateinstanceOfXXX()
functions that properly check thetype
property against the enum values foroneOf
models.oneOf
models.Fixes #1.
This is an automated message generated by Sweep AI.