You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
I'm trying to define a property in a schema that can be one of two types - a single date-time string or an array of strings. I'm using oneOf without a discriminator to do this. Also, in this same (rather large) schema, we have a few other instances of oneOf that do use discriminators, so we're setting useOneOfDiscriminatorLookup to true. The generated code looks something like this:
Note that json[]string isn't a valid variable name.
When I try it with useOneOfDiscriminatorLookup set to false, json[]string is named jsonArrayOfString, which compiles fine - this is what I'd expect the fix to do. In general, I'd expect the value of useOneOfDiscriminatorLookup to be irrelevant to code generated from a oneOf with no discriminator (more or less like what the linked issue seems to suggest).
I'm currently testing out just calling lambda.type-to-name in modules/openapi-generator/src/main/resources/go/model_oneof.mustache; specifically replacing the json{{.}} on line 61 with json{{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}}.
The text was updated successfully, but these errors were encountered:
Bug Report Checklist
Description
I'm trying to define a property in a schema that can be one of two types - a single date-time string or an array of strings. I'm using
oneOf
without a discriminator to do this. Also, in this same (rather large) schema, we have a few other instances ofoneOf
that do use discriminators, so we're settinguseOneOfDiscriminatorLookup
totrue
. The generated code looks something like this:Note that
json[]string
isn't a valid variable name.When I try it with
useOneOfDiscriminatorLookup
set tofalse
,json[]string
is namedjsonArrayOfString
, which compiles fine - this is what I'd expect the fix to do. In general, I'd expect the value ofuseOneOfDiscriminatorLookup
to be irrelevant to code generated from aoneOf
with no discriminator (more or less like what the linked issue seems to suggest).openapi-generator version
7.5.0-SNAPSHOT
OpenAPI declaration file content or url
oneOf-array-of-strings.yaml
Generation Details
Steps to reproduce
Related issues/PRs
[BUG][Go] UnmarshalJson has unused variable err if spec has oneOf without discriminator
Suggest a fix
I'm currently testing out just calling
lambda.type-to-name
inmodules/openapi-generator/src/main/resources/go/model_oneof.mustache
; specifically replacing thejson{{.}}
on line 61 withjson{{#lambda.type-to-name}}{{{.}}}{{/lambda.type-to-name}}
.The text was updated successfully, but these errors were encountered: