File tree Expand file tree Collapse file tree 1 file changed +15
-9
lines changed
src/main/java/io/swagger/codegen/v3/generators Expand file tree Collapse file tree 1 file changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -1399,16 +1399,22 @@ else if (schema instanceof ComposedSchema) {
13991399
14001400 if (composed .getOneOf ()!=null ) {
14011401 composed .getOneOf ().forEach ( s -> {
1402- codegenModel .discriminator .getMapping ().keySet ().stream ().filter ( key -> codegenModel .discriminator .getMapping ().get (key ).equals (s .get$ref ()))
1403- .forEach (key -> {
1404- String mappingValue = codegenModel .discriminator .getMapping ().get (key );
1405- if (classnameKeys .containsKey (codegenModel .classname )) {
1406- throw new IllegalArgumentException ("Duplicate shema name in discriminator mapping" );
1407- }
1408- classnameKeys .put (toModelName (mappingValue .replace ("#/components/schemas/" , "" )),key );
1409- });
1402+ if (codegenModel .discriminator .getMapping () != null ){
1403+ codegenModel .discriminator .getMapping ().keySet ().stream ().filter ( key -> codegenModel .discriminator .getMapping ().get (key ).equals (s .get$ref ()))
1404+ .forEach (key -> {
1405+ String mappingValue = codegenModel .discriminator .getMapping ().get (key );
1406+ if (classnameKeys .containsKey (codegenModel .classname )) {
1407+ throw new IllegalArgumentException ("Duplicate shema name in discriminator mapping" );
1408+ }
1409+ classnameKeys .put (toModelName (mappingValue .replace ("#/components/schemas/" , "" )),key );
1410+ });
1411+
1412+ }
1413+
14101414 });
1411- codegenModel .discriminator .getMapping ().putAll (classnameKeys );
1415+ if (codegenModel .discriminator .getMapping () != null ) {
1416+ codegenModel .discriminator .getMapping ().putAll (classnameKeys );
1417+ }
14121418 }
14131419 }
14141420
You can’t perform that action at this time.
0 commit comments