Skip to content

Commit e209467

Browse files
committed
Keep nullability when inlining ref
1 parent 777b7ee commit e209467

File tree

1 file changed

+6
-1
lines changed
  • modules/openapi-generator/src/main/java/org/openapitools/codegen/utils

1 file changed

+6
-1
lines changed

modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,12 @@ public static Schema unaliasSchema(OpenAPI openAPI,
14101410
schemaMappings);
14111411
}
14121412
} else {
1413-
return unaliasSchema(openAPI, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())), schemaMappings);
1413+
Schema unaliased = unaliasSchema(openAPI, allSchemas.get(ModelUtils.getSimpleRef(schema.get$ref())), schemaMappings);
1414+
// Preserve nullable property from the original schema reference
1415+
if (Boolean.TRUE.equals(schema.getNullable())) {
1416+
unaliased.setNullable(true);
1417+
}
1418+
return unaliased;
14141419
}
14151420
}
14161421
return schema;

0 commit comments

Comments
 (0)