@@ -667,7 +667,7 @@ private void flattenComposedChildren(String key, List<Schema> children, boolean
667667 listIterator .set (schema );
668668 } else {
669669 Schema schema = new Schema ().$ref (existing );
670- schema .addExtension ("x-alias-name" , innerModelName );
670+ schema .addExtension ("x-alias-name" , applyInlineSchemaNameMapping ( innerModelName ) );
671671 schema .setRequired (component .getRequired ());
672672 listIterator .set (schema );
673673 }
@@ -827,7 +827,7 @@ private void flattenProperties(OpenAPI openAPI, Map<String, Schema> properties,
827827 String existing = matchGenerated (model );
828828 if (existing != null ) {
829829 Schema schema = new Schema ().$ref (existing );
830- schema .addExtension ("x-alias-name" , modelName );
830+ schema .addExtension ("x-alias-name" , applyInlineSchemaNameMapping ( modelName ) );
831831 schema .setRequired (op .getRequired ());
832832 propsToUpdate .put (key , schema );
833833 } else {
@@ -848,7 +848,7 @@ private void flattenProperties(OpenAPI openAPI, Map<String, Schema> properties,
848848 String existing = matchGenerated (innerModel );
849849 if (existing != null ) {
850850 Schema schema = new Schema ().$ref (existing );
851- schema .addExtension ("x-alias-name" , modelName );
851+ schema .addExtension ("x-alias-name" , applyInlineSchemaNameMapping ( modelName ) );
852852 schema .setRequired (op .getRequired ());
853853 property .setItems (schema );
854854 } else {
@@ -879,7 +879,7 @@ private void flattenProperties(OpenAPI openAPI, Map<String, Schema> properties,
879879 String existing = matchGenerated (innerModel );
880880 if (existing != null ) {
881881 Schema schema = new Schema ().$ref (existing );
882- schema .addExtension ("x-alias-name" , modelName );
882+ schema .addExtension ("x-alias-name" , applyInlineSchemaNameMapping ( modelName ) );
883883 schema .setRequired (op .getRequired ());
884884 property .setAdditionalProperties (schema );
885885 } else {
@@ -989,6 +989,19 @@ private Schema modelFromProperty(OpenAPI openAPI, Schema object, String path) {
989989 return model ;
990990 }
991991
992+ /**
993+ * Apply inlineSchemaNameMapping if configured.
994+ *
995+ * @param name the inline schema name to map
996+ * @return the mapped name if mapping exists, otherwise the original name
997+ */
998+ private String applyInlineSchemaNameMapping (String name ) {
999+ if (inlineSchemaNameMapping .containsKey (name )) {
1000+ return inlineSchemaNameMapping .get (name );
1001+ }
1002+ return name ;
1003+ }
1004+
9921005 /**
9931006 * Move schema to components (if new) and return $ref to schema or
9941007 * existing schema.
@@ -1002,8 +1015,7 @@ private Schema makeSchemaInComponents(String name, Schema schema) {
10021015 Schema refSchema ;
10031016 if (existing != null ) {
10041017 refSchema = new Schema ().$ref (existing );
1005- // Store the name this schema would have had if not deduplicated
1006- refSchema .addExtension ("x-alias-name" , name );
1018+ refSchema .addExtension ("x-alias-name" , applyInlineSchemaNameMapping (name ));
10071019 } else {
10081020 if (resolveInlineEnums && schema .getEnum () != null && schema .getEnum ().size () > 0 ) {
10091021 LOGGER .warn ("Model " + name + " promoted to its own schema due to resolveInlineEnums=true" );
0 commit comments