@@ -59,6 +59,7 @@ public final class GeneratorSettings implements Serializable {
5959 private final Map <String , String > modelNameMappings ;
6060 private final Map <String , String > enumNameMappings ;
6161 private final Map <String , String > operationIdNameMappings ;
62+ private final Map <String , String > injectModelVendorExtensions ;
6263 private final Map <String , String > openapiNormalizer ;
6364 private final Set <String > languageSpecificPrimitives ;
6465 private final Set <String > openapiGeneratorIgnoreList ;
@@ -327,6 +328,15 @@ public Map<String, String> getOperationIdNameMappings() {
327328 return operationIdNameMappings ;
328329 }
329330
331+ /**
332+ * Gets inject model vendor extensions.
333+ *
334+ * @return a map of ModelName.x-extension-name or ModelName.propertyBaseName.x-extension-name to extension value
335+ */
336+ public Map <String , String > getInjectModelVendorExtensions () {
337+ return injectModelVendorExtensions ;
338+ }
339+
330340 /**
331341 * Gets OpenAPI normalizer rules
332342 *
@@ -469,6 +479,7 @@ private GeneratorSettings(Builder builder) {
469479 modelNameMappings = Collections .unmodifiableMap (builder .modelNameMappings );
470480 enumNameMappings = Collections .unmodifiableMap (builder .enumNameMappings );
471481 operationIdNameMappings = Collections .unmodifiableMap (builder .operationIdNameMappings );
482+ injectModelVendorExtensions = Collections .unmodifiableMap (builder .injectModelVendorExtensions );
472483 openapiNormalizer = Collections .unmodifiableMap (builder .openapiNormalizer );
473484 languageSpecificPrimitives = Collections .unmodifiableSet (builder .languageSpecificPrimitives );
474485 openapiGeneratorIgnoreList = Collections .unmodifiableSet (builder .openapiGeneratorIgnoreList );
@@ -550,6 +561,7 @@ public GeneratorSettings() {
550561 modelNameMappings = Collections .unmodifiableMap (new HashMap <>(0 ));
551562 enumNameMappings = Collections .unmodifiableMap (new HashMap <>(0 ));
552563 operationIdNameMappings = Collections .unmodifiableMap (new HashMap <>(0 ));
564+ injectModelVendorExtensions = Collections .unmodifiableMap (new HashMap <>(0 ));
553565 openapiNormalizer = Collections .unmodifiableMap (new HashMap <>(0 ));
554566 languageSpecificPrimitives = Collections .unmodifiableSet (new HashSet <>(0 ));
555567 openapiGeneratorIgnoreList = Collections .unmodifiableSet (new HashSet <>(0 ));
@@ -630,6 +642,9 @@ public static Builder newBuilder(GeneratorSettings copy) {
630642 if (copy .getOperationIdNameMappings () != null ) {
631643 builder .operationIdNameMappings .putAll (copy .getOperationIdNameMappings ());
632644 }
645+ if (copy .getInjectModelVendorExtensions () != null ) {
646+ builder .injectModelVendorExtensions .putAll (copy .getInjectModelVendorExtensions ());
647+ }
633648 if (copy .getOpenapiNormalizer () != null ) {
634649 builder .openapiNormalizer .putAll (copy .getOpenapiNormalizer ());
635650 }
@@ -684,6 +699,7 @@ public static final class Builder {
684699 private Map <String , String > modelNameMappings ;
685700 private Map <String , String > enumNameMappings ;
686701 private Map <String , String > operationIdNameMappings ;
702+ private Map <String , String > injectModelVendorExtensions ;
687703 private Map <String , String > openapiNormalizer ;
688704 private Set <String > languageSpecificPrimitives ;
689705 private Set <String > openapiGeneratorIgnoreList ;
@@ -712,6 +728,7 @@ public Builder() {
712728 modelNameMappings = new HashMap <>();
713729 enumNameMappings = new HashMap <>();
714730 operationIdNameMappings = new HashMap <>();
731+ injectModelVendorExtensions = new HashMap <>();
715732 openapiNormalizer = new HashMap <>();
716733 languageSpecificPrimitives = new HashSet <>();
717734 openapiGeneratorIgnoreList = new HashSet <>();
@@ -1193,6 +1210,32 @@ public Builder withOperationIdNameMapping(String key, String value) {
11931210 return this ;
11941211 }
11951212
1213+ /**
1214+ * Sets the {@code injectModelExtensions} and returns a reference to this Builder so that the methods can be chained together.
1215+ *
1216+ * @param injectModelExtensions the {@code injectModelExtensions} to set
1217+ * @return a reference to this Builder
1218+ */
1219+ public Builder withInjectModelVendorExtensions (Map <String , String > injectModelVendorExtensions ) {
1220+ this .injectModelVendorExtensions = injectModelVendorExtensions ;
1221+ return this ;
1222+ }
1223+
1224+ /**
1225+ * Sets a single {@code injectModelVendorExtension} and returns a reference to this Builder so that the methods can be chained together.
1226+ *
1227+ * @param key A key in the format ModelName.x-extension-name or ModelName.propertyBaseName.x-extension-name
1228+ * @param value The extension value
1229+ * @return a reference to this Builder
1230+ */
1231+ public Builder withInjectModelVendorExtension (String key , String value ) {
1232+ if (this .injectModelVendorExtensions == null ) {
1233+ this .injectModelVendorExtensions = new HashMap <>();
1234+ }
1235+ this .injectModelVendorExtensions .put (key , value );
1236+ return this ;
1237+ }
1238+
11961239 /**
11971240 * Sets the {@code openapiNormalizer} and returns a reference to this Builder so that the methods can be chained together.
11981241 *
0 commit comments