Openapi-generator: [BUG] OpenAPI 4.0.2 not able to generate anyOf models.

Created on 22 Nov 2019  路  7Comments  路  Source: OpenAPITools/openapi-generator

Description

I have created a swagger file openapi: 3.0.0 having Account and Contact as references in anyOf something like this:

anyOf:
              - $ref: "#/components/schemas/Account"
              - $ref: "#/components/schemas/Contact"
openapi-generator version

4.0.2

Steps to reproduce

After running mvn generate-sources command swagger generates models in /target folder. The issue here is that swagger is not able to generate class AnyOfAccountContact which it should be.

The error looks like this:
error

Bug

Most helpful comment

I have the same issue. Generating for Javascript. AnyOf file which is required in the model just doesn't exist. Looks like the generator does not generate it. No errors and warnings during the generation process.

5.0.0-beta3

Doesn't solves the problem

All 7 comments

have you tried the latest version?

yes the problem still exists with version 4.2.3
The anyOf.... model classes are not generated at all.
Maybe the length of the path together with the model name is longer then allowed and the file can not be created?

I'm also seeing this in 4.2.3.

I'm seeing this in the latest using the typescript-fetch generator.

It improperly returns invalid javascript that points to a class, a typescript single pipe, and a function that isn't actually defined.

'item': Item | numberToJSON(value.itemId),

I am also getting inappropriate model generated for anyOf in golang generators,

// Schematics location where action data will be saved and jobs executed
    Location AnyOfServerLocation `json:"location,omitempty"`

It is generated like this. Any fix for this?

Still seeing this in 5.0.0-beta2 - will https://github.com/OpenAPITools/openapi-generator/pull/7263 fix this?

I have the same issue. Generating for Javascript. AnyOf file which is required in the model just doesn't exist. Looks like the generator does not generate it. No errors and warnings during the generation process.

5.0.0-beta3

Doesn't solves the problem

Was this page helpful?
0 / 5 - 0 ratings