File tree Expand file tree Collapse file tree 4 files changed +37
-6
lines changed
modules/openapi-generator/src
main/resources/Java/libraries
test/java/org/openapitools/codegen/java Expand file tree Collapse file tree 4 files changed +37
-6
lines changed Original file line number Diff line number Diff line change 1313NOTE: this class is nullable.
1414
1515{ {/isNullable} }
16- ## Example
16+ { {^vendorExtensions.x-is-one-of-interface } } ## Example
1717```java
1818// Import classes:
1919import { {{package} }}.{ {{classname} }};
@@ -35,4 +35,4 @@ public class Example {
3535 { {/oneOf} }
3636 }
3737}
38- ```
38+ ```{ {/vendorExtensions.x-is-one-of-interface } }
Original file line number Diff line number Diff line change 1313NOTE: this class is nullable.
1414
1515{ {/isNullable} }
16- ## Example
16+ { {^vendorExtensions.x-is-one-of-interface } } ## Example
1717```java
1818// Import classes:
1919import { {{package} }}.{ {{classname} }};
@@ -35,4 +35,4 @@ public class Example {
3535 { {/oneOf} }
3636 }
3737}
38- ```
38+ ```{ {/vendorExtensions.x-is-one-of-interface } }
Original file line number Diff line number Diff line change 1313NOTE: this class is nullable.
1414
1515{ {/isNullable} }
16- ## Example
16+ { {^vendorExtensions.x-is-one-of-interface } } ## Example
1717```java
1818// Import classes:
1919import { {{package} }}.{ {{classname} }};
@@ -35,4 +35,4 @@ public class Example {
3535 { {/oneOf} }
3636 }
3737}
38- ```
38+ ```{ {/vendorExtensions.x-is-one-of-interface } }
Original file line number Diff line number Diff line change @@ -3706,4 +3706,35 @@ public void testClientWithUseOneOfInterfaceWithoutDiscriminator_issue_17419(Stri
37063706
37073707 }
37083708
3709+ @ Test (dataProvider = "allJavaClients" )
3710+ public void testClientWithUseOneOfInterfaceShouldntGenerateOneOfExample_issue_17419 (String client ) {
3711+ // given
3712+ final Path output = newTempFolder ();
3713+ final CodegenConfigurator configurator = new CodegenConfigurator ()
3714+ .setGeneratorName ("java" )
3715+ .setLibrary (client )
3716+ .setAdditionalProperties (Map .of ("useOneOfInterfaces" , "true" ))
3717+ .setInputSpec ("src/test/resources/3_0/typescript-fetch/oneOf.yaml" )
3718+ .setOutputDir (output .toString ().replace ("\\ " , "/" ));
3719+
3720+ final ClientOptInput input = configurator .toClientOptInput ();
3721+
3722+ // when
3723+ List <File > files = new DefaultGenerator ().opts (input ).generate ();
3724+
3725+ // then
3726+ validateJavaSourceFiles (files );
3727+
3728+ // must only check if the library generates the doc
3729+ if (Files .exists (output .resolve ("docs/TestResponse.md" )))
3730+ {
3731+ TestUtils .assertFileNotContains (
3732+ output .resolve ("docs/TestResponse.md" ),
3733+ "## Example" ,
3734+ "exampleTestResponse.setActualInstance(exampleTestA);"
3735+ );
3736+ }
3737+
3738+ }
3739+
37093740}
You can’t perform that action at this time.
0 commit comments