@@ -1153,6 +1153,42 @@ public void testNormalizerClass() {
11531153 assertEquals (requiredProperties .getRequired (), null );
11541154 }
11551155
1156+
1157+ @ Test
1158+ public void testRemoveXInternalFromInlineProperties () {
1159+ OpenAPI openAPI = TestUtils .parseSpec ("src/test/resources/3_0/inline_x_internal_test.yaml" );
1160+ Schema parentSchema = openAPI .getComponents ().getSchemas ().get ("ParentSchema" );
1161+ Schema inlineProperty = (Schema ) parentSchema .getProperties ().get ("inlineXInternalProperty" );
1162+
1163+ // Before normalization: x-internal should be present on inline property
1164+ assertNotNull (inlineProperty .getExtensions ());
1165+ assertEquals (inlineProperty .getExtensions ().get ("x-internal" ), true );
1166+
1167+ // Run normalizer with REMOVE_X_INTERNAL=true
1168+ Map <String , String > options = new HashMap <>();
1169+ options .put ("REMOVE_X_INTERNAL" , "true" );
1170+ OpenAPINormalizer openAPINormalizer = new OpenAPINormalizer (openAPI , options );
1171+ openAPINormalizer .normalize ();
1172+
1173+ // After normalization: x-internal should be removed from inline property
1174+ Schema parentSchemaAfter = openAPI .getComponents ().getSchemas ().get ("ParentSchema" );
1175+ Schema inlinePropertyAfter = (Schema ) parentSchemaAfter .getProperties ().get ("inlineXInternalProperty" );
1176+
1177+ // x-internal extension should be removed (null or not present in map)
1178+ if (inlinePropertyAfter .getExtensions () != null ) {
1179+ assertNull (inlinePropertyAfter .getExtensions ().get ("x-internal" ));
1180+ }
1181+
1182+ // The property itself should still exist (we're removing the flag, not the property)
1183+ assertNotNull (inlinePropertyAfter );
1184+ assertEquals (inlinePropertyAfter .getType (), "object" );
1185+
1186+ // Nested properties should still exist
1187+ assertNotNull (inlinePropertyAfter .getProperties ());
1188+ assertNotNull (inlinePropertyAfter .getProperties ().get ("nestedField" ));
1189+ assertNotNull (inlinePropertyAfter .getProperties ().get ("nestedNumber" ));
1190+ }
1191+
11561192 public static class RemoveRequiredNormalizer extends OpenAPINormalizer {
11571193
11581194 public RemoveRequiredNormalizer (OpenAPI openAPI , Map <String , String > inputRules ) {
0 commit comments