@@ -635,16 +635,16 @@ public void setParameterExampleValue(CodegenParameter codegenParameter, Paramete
635635
636636 if (parameter .getExample () != null ) {
637637 codegenParameter .example = parameter .getExample ().toString ();
638- codegenParameter .vendorExtensions .put ("x-py-example" , toPythonLiteral (parameter .getExample ()));
638+ codegenParameter .vendorExtensions .put (X_PY_EXAMPLE , toPythonLiteral (parameter .getExample ()));
639639 } else if (parameter .getExamples () != null && !parameter .getExamples ().isEmpty ()) {
640640 Example example = parameter .getExamples ().values ().iterator ().next ();
641641 if (example .getValue () != null ) {
642642 codegenParameter .example = example .getValue ().toString ();
643- codegenParameter .vendorExtensions .put ("x-py-example" , toPythonLiteral (example .getValue ()));
643+ codegenParameter .vendorExtensions .put (X_PY_EXAMPLE , toPythonLiteral (example .getValue ()));
644644 }
645645 } else if (schema != null && schema .getExample () != null ) {
646646 codegenParameter .example = schema .getExample ().toString ();
647- codegenParameter .vendorExtensions .put ("x-py-example" , toPythonLiteral (schema .getExample ()));
647+ codegenParameter .vendorExtensions .put (X_PY_EXAMPLE , toPythonLiteral (schema .getExample ()));
648648 }
649649
650650 setParameterExampleValue (codegenParameter );
@@ -1040,13 +1040,13 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
10401040 }
10411041
10421042 String typing = pydantic .generatePythonType (cp );
1043- cp .vendorExtensions .put ("x-py-typing" , typing );
1043+ cp .vendorExtensions .put (X_PY_TYPING , typing );
10441044
10451045 // setup x-py-name for each oneOf/anyOf schema
10461046 if (!model .oneOf .isEmpty ()) { // oneOf
1047- cp .vendorExtensions .put ("x-py-name" , String .format (Locale .ROOT , "oneof_schema_%d_validator" , property_count ++));
1047+ cp .vendorExtensions .put (X_PY_NAME , String .format (Locale .ROOT , "oneof_schema_%d_validator" , property_count ++));
10481048 } else if (!model .anyOf .isEmpty ()) { // anyOf
1049- cp .vendorExtensions .put ("x-py-name" , String .format (Locale .ROOT , "anyof_schema_%d_validator" , property_count ++));
1049+ cp .vendorExtensions .put (X_PY_NAME , String .format (Locale .ROOT , "anyof_schema_%d_validator" , property_count ++));
10501050 }
10511051 }
10521052
@@ -1061,13 +1061,13 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
10611061 if (model .isEnum ) {
10621062 for (Map <String , Object > enumVars : (List <Map <String , Object >>) model .getAllowableValues ().get ("enumVars" )) {
10631063 if ((Boolean ) enumVars .get ("isString" )) {
1064- model .vendorExtensions .putIfAbsent ("x-py-enum-type" , "str" );
1064+ model .vendorExtensions .putIfAbsent (X_PY_ENUM_TYPE , "str" );
10651065 // Do not overwrite the variable name if already set through x-enum-varnames
10661066 if (model .vendorExtensions .get (X_ENUM_VARNAMES ) == null ) {
10671067 enumVars .put ("name" , toEnumVariableName ((String ) enumVars .get ("value" ), "str" ));
10681068 }
10691069 } else {
1070- model .vendorExtensions .putIfAbsent ("x-py-enum-type" , "int" );
1070+ model .vendorExtensions .putIfAbsent (X_PY_ENUM_TYPE , "int" );
10711071 // Do not overwrite the variable name if already set through x-enum-varnames
10721072 if (model .vendorExtensions .get (X_ENUM_VARNAMES ) == null ) {
10731073 enumVars .put ("name" , toEnumVariableName ((String ) enumVars .get ("value" ), "int" ));
@@ -1077,7 +1077,7 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
10771077 }
10781078
10791079 // set the extensions if the key is absent
1080- model .getVendorExtensions ().putIfAbsent ("x-py-readonly" , readOnlyFields );
1080+ model .getVendorExtensions ().putIfAbsent (X_PY_READONLY , readOnlyFields );
10811081
10821082 // remove the items of postponedModelImports in modelImports to avoid circular imports error
10831083 if (!modelImports .isEmpty () && !postponedModelImports .isEmpty ()) {
@@ -1096,12 +1096,12 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
10961096 }
10971097
10981098 if (!modelsToImport .isEmpty ()) {
1099- model .getVendorExtensions ().putIfAbsent ("x-py-model-imports" , modelsToImport );
1099+ model .getVendorExtensions ().putIfAbsent (X_PY_MODEL_IMPORTS , modelsToImport );
11001100 }
11011101 }
11021102
11031103 if (!moduleImports .isEmpty ()) {
1104- model .getVendorExtensions ().putIfAbsent ("x-py-other-imports" , moduleImports .exports ());
1104+ model .getVendorExtensions ().putIfAbsent (X_PY_OTHER_IMPORTS , moduleImports .exports ());
11051105 }
11061106
11071107
@@ -1115,7 +1115,7 @@ private ModelsMap postProcessModelsMap(ModelsMap objs) {
11151115 modelsToImport .add ("from " + packageName + ".models." + underscore (modelImport ) + " import " + modelImport );
11161116 }
11171117
1118- model .getVendorExtensions ().putIfAbsent ("x-py-postponed-model-imports" , modelsToImport );
1118+ model .getVendorExtensions ().putIfAbsent (X_PY_POSTPONED_MODEL_IMPORTS , modelsToImport );
11191119 }
11201120 }
11211121
@@ -1326,7 +1326,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
13261326 null
13271327 );
13281328 String typing = pydantic .generatePythonType (cp );
1329- cp .vendorExtensions .put ("x-py-typing" , typing );
1329+ cp .vendorExtensions .put (X_PY_TYPING , typing );
13301330 }
13311331
13321332 // update typing import for operation return type
@@ -1367,7 +1367,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
13671367 for (String exampleImport : exampleImports ) {
13681368 imports .add ("from " + packageName + ".models." + underscore (exampleImport ) + " import " + exampleImport );
13691369 }
1370- operation .vendorExtensions .put ("x-py-example-import" , imports );
1370+ operation .vendorExtensions .put (X_PY_EXAMPLE_IMPORT , imports );
13711371 }
13721372
13731373 if (!postponedExampleImports .isEmpty ()) {
@@ -1376,7 +1376,7 @@ public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<Mo
13761376 imports .add ("from " + packageName + ".models." + underscore (exampleImport ) + " import "
13771377 + exampleImport );
13781378 }
1379- operation .vendorExtensions .put ("x-py-example-import" , imports );
1379+ operation .vendorExtensions .put (X_PY_EXAMPLE_IMPORT , imports );
13801380 }
13811381
13821382 // Remove constant params from allParams list and add to constantParams
@@ -1462,7 +1462,7 @@ public void postProcessPattern(String pattern, Map<String, Object> vendorExtensi
14621462 }
14631463
14641464 vendorExtensions .put (X_REGEX , regex .replace ("\" " , "\\ \" " ));
1465- vendorExtensions .put ("x-pattern" , pattern .replace ("\" " , "\\ \" " ));
1465+ vendorExtensions .put (X_PATTERN , pattern .replace ("\" " , "\\ \" " ));
14661466 vendorExtensions .put (X_MODIFIERS , modifiers );
14671467 }
14681468 }
0 commit comments