question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] OpenAPI 4.0.2 not able to generate anyOf models.

See original GitHub issue
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

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:6
  • Comments:26 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
DenisButCheRcommented, Nov 24, 2020

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

3reactions
Jwelycommented, Mar 25, 2022

Same bug persists when generating java client with version 5.4

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenAPI models not being generated when using oneOf
OpenAPI models not being generated when using oneOf ... I am using OpenAPI+OpenAPI-generator with spring boot, and trying to use the schema oneof ......
Read more >
OpenAPI Specification - Version 3.0.3 - Swagger
The OpenAPI Specification defines a standard interface to RESTful APIs which ... Models are defined using the Schema Object, which is an extended...
Read more >
Documentation for the java Generator
Select the complementary documentation annotation library. none: Do not annotate Model and Api with complementary annotations. swagger1 ...
Read more >
Bug 53190 – openapi.json leads to unknown base type error ...
json, so: 1. The error is in the OpenAPITools/openapi-generator, not in OpenAPI. 2. I can successfully build the Java client using https:// ...
Read more >
Getting started tutorial: Using Stoplight Studio to create an ...
You can create an OpenAPI specification document in several ways: (a) you can ... The left pane says, “You do not have any...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found