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
{{ message }}
Repository navigation
[BUG] OpenAPI 4.0.2 not able to generate anyOf models. #4576
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:
Reacted by Ronald, Šimon Demočko, Nikolay, Francisco Duarte Ventura, Stephan Fuhrmann, cachius, Cecilia Porro, 1mamute and Sean Rossignol
changed the title [-][BUG] OpenAPI 4.0.2 not able to generating anyOf models.[/-][+][BUG] OpenAPI 4.0.2 not able to generate anyOf models.[/+]on Nov 22, 2019
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 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
Reacted by Alexandre Del Vecchio, Niels Sandholt Busch, leonluc-dev, Charlie DiGiovanna, Lane, Francisco Duarte Ventura, Michael Bykovski and cachius
We've implemented oneOf, anyOf support in other generators such as Java, C#, Python, PowerShell, Go, Ruby and more.
If anyone has time to help with the implementation of oneOf/anyOf in the typescript generator, I can work with you to show you some good starting points and generate some files so that you can fill in the blanks (implementation details).
@DennisNilssonB3 please try 5.1.0 or the latest stable version
I've tried 5.2.1 version for generation java server (as well as swagger-codegen) - it generates interface with name AnyOfobjectobjectobjectб but no realisation for this interface :-((((
@wing328 should i use some options during generation or to do something else?
i tried simple way - "openapi-generator-cli generate -g java"
I'm running into the same issues using the Gradle plugin version 5.4.0 and the spring server generator. Anybody found a workaround for this issues perhaps?
the issue is happening for me while attempting to generate the openapi spec for Alpaca api, specifically for a java client using the resttemplate library
I'm running into the same issues using the Gradle plugin version 5.4.0 and the spring server generator. Anybody found a workaround for this issues perhaps?
After stumbling on this issue last year, I decided to create a new generator that would generate complex types (inline or not). It has been working great for me, you can find it here: https://github.com/Embraser01/typoas
Edit: It only applies to TS/JS clients, not other languages
P.S.: The main goal here isn't to advertise my project, just to propose a solution to this issue. If wanted, I can remove the link to the project and let users find it through my profile
Activity
[-][BUG] OpenAPI 4.0.2 not able to generating anyOf models.[/-][+][BUG] OpenAPI 4.0.2 not able to generate anyOf models.[/+]macjohnny commentedon Nov 22, 2019
have you tried the latest version?
Devilsmaul commentedon Feb 3, 2020
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?
conet commentedon Apr 3, 2020
I'm also seeing this in
4.2.3.jamesmfriedman commentedon Jun 25, 2020
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.
rvsingh011 commentedon Jul 24, 2020
I am also getting inappropriate model generated for anyOf in golang generators,
It is generated like this. Any fix for this?
black-snow commentedon Sep 17, 2020
Still seeing this in
5.0.0-beta2- will #7263 fix this?DenisButCheR commentedon 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.
Doesn't solves the problem
joshaq commentedon Mar 17, 2021
I stumbled on the same bug and built a minimal reproduction before I found this issue. I am using
5.0.0.OpenAPI spec:
wing328 commentedon Mar 17, 2021
We've implemented oneOf, anyOf support in other generators such as Java, C#, Python, PowerShell, Go, Ruby and more.
If anyone has time to help with the implementation of oneOf/anyOf in the
typescriptgenerator, I can work with you to show you some good starting points and generate some files so that you can fill in the blanks (implementation details).Dennis-Nilsson commentedon Mar 31, 2021
@wing328
Great job! In which version and when will it be released? (openapi-generator-maven-plugin)
wing328 commentedon Apr 30, 2021
@DennisNilssonB3 please try 5.1.0 or the latest stable version
mimkorn commentedon Jun 30, 2021
Same here, anyOf is not generating the necessary class when using spring generator spring-cloud library.
Using latest generator, also tested on 6.0.0 latest snapshot and 5.2 latest snapshot just now.
Using this schema
and this configuration of the maven plugin:
1 remaining item
iyakobson commentedon Oct 1, 2021
I've tried 5.2.1 version for generation java server (as well as swagger-codegen) - it generates interface with name AnyOfobjectobjectobjectб but no realisation for this interface :-((((
@wing328 should i use some options during generation or to do something else?
i tried simple way - "openapi-generator-cli generate -g java"
gbvanrenswoude commentedon Oct 27, 2021
@sauravInfoObject did you get a fix working yet? Could you share it, if so? Thanks a lot :)
nrbw commentedon Dec 16, 2021
I just encountered the same problem today with openapi-generator-maven-plugin version 5.3.0 for generating java with resttemplate library.
Jwely commentedon Mar 25, 2022
Same bug persists when generating java client with version 5.4
bremme commentedon Mar 29, 2022
I'm running into the same issues using the Gradle plugin version 5.4.0 and the spring server generator. Anybody found a workaround for this issues perhaps?
sweetmadhu commentedon Mar 30, 2022
@wing328 Any ETA by which the issue will be fixed?
CyberSteve738 commentedon Apr 15, 2022
the issue is happening for me while attempting to generate the openapi spec for Alpaca api, specifically for a java client using the resttemplate library
Shryne commentedon Apr 27, 2022
Happens to me with 6.0.0-beta with java...
macjohnny commentedon Apr 27, 2022
Everyone is welcome to implement a fix
Embraser01 commentedon Apr 27, 2022
After stumbling on this issue last year, I decided to create a new generator that would generate complex types (inline or not). It has been working great for me, you can find it here: https://github.com/Embraser01/typoas
Edit: It only applies to TS/JS clients, not other languages
P.S.: The main goal here isn't to advertise my project, just to propose a solution to this issue. If wanted, I can remove the link to the project and let users find it through my profile
wing328 commentedon Apr 27, 2022
resttempalte doesnt' support anyOf/oneOf yet.
Only okhttp-gson, jersey2 and native supports anyOf/oneOf.
We welcome PRs to plot the implementation of anyOf/oneOf to resttemplate or other libraries supported by the java client generator.
CyberSteve738 commentedon Apr 28, 2022
I really appreciate the response @wing328 ! was just looking to be pointed in the right direction. I will use one of the other libraries!
uri200 commentedon Jul 19, 2022
Hey @wing328 just in case to inform other people using go.
AnyOforoneOfis not fully working.For example
The result is the schema seems to generate but it looks like it is limited to the first element of the allOf or anyOff
Also we get some errors when producing
anyOforallOforoneOfelements #12920wing328 commentedon Jun 20, 2023
@uri200 can you please give it another try in the latest master or stable version v6.6.0?
I think it should be resolved.
ysulyma commentedon Jul 27, 2023
@wing328 I'm encountering a similar issue with the Go generator. The schema
run with
produces
which is invalid