Skip to content

Commit dbc42d3

Browse files
committed
fix: Apply REMOVE_X_INTERNAL normalizer to nested inline properties
When REMOVE_X_INTERNAL=true is set, the normalizer removes the x-internal extension from top-level schemas in components/schemas but fails to remove it from inline object properties within those schemas. This causes issues when: 1. A schema is imported cross-file (e.g., admin.yaml imports from chat.yaml) 2. That schema has an inline object property with x-internal: true 3. The inline property has type: object with nested properties Result: TypeScript generator creates a type reference but no interface definition, causing compilation errors. This fix applies the same x-internal removal logic to normalizeProperties() that already exists in normalizeComponentsSchemas(), ensuring inline properties are handled consistently. Fixes behavior for inline schemas with x-internal in cross-file imports.
1 parent 6b1b5cc commit dbc42d3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -855,6 +855,13 @@ protected void normalizeProperties(Map<String, Schema> properties, Set<Schema> v
855855
}
856856
for (Map.Entry<String, Schema> propertiesEntry : properties.entrySet()) {
857857
Schema property = propertiesEntry.getValue();
858+
859+
// remove x-internal if needed (same logic as normalizeComponentsSchemas)
860+
if (property.getExtensions() != null && getRule(REMOVE_X_INTERNAL)) {
861+
if (Boolean.parseBoolean(String.valueOf(property.getExtensions().get(X_INTERNAL)))) {
862+
property.getExtensions().remove(X_INTERNAL);
863+
}
864+
}
858865
Schema newProperty = normalizeSchema(property, new HashSet<>());
859866
propertiesEntry.setValue(newProperty);
860867
}

0 commit comments

Comments
 (0)