5252import org .openapitools .codegen .config .GlobalSettings ;
5353import org .openapitools .codegen .examples .ExampleGenerator ;
5454import org .openapitools .codegen .languages .PhpNextgenClientCodegen ;
55- import org .openapitools .codegen .languages .RustAxumServerCodegen ;
5655import org .openapitools .codegen .languages .RustServerCodegen ;
5756import org .openapitools .codegen .meta .FeatureSet ;
5857import org .openapitools .codegen .meta .GeneratorMetadata ;
@@ -707,7 +706,7 @@ public Map<String, ModelsMap> updateAllModels(Map<String, ModelsMap> objs) {
707706 * Removes importToRemove from the imports of objs, if present.
708707 * This is useful to remove imports that are already present in operations-related template files, to avoid importing the same thing twice.
709708 *
710- * @param objs imports will be removed from this objs' imports collection
709+ * @param objs imports will be removed from this objs' imports collection
711710 * @param importToRemove the import statement to be removed
712711 */
713712 protected void removeImport (OperationsMap objs , String importToRemove ) {
@@ -2302,7 +2301,7 @@ public String toDefaultParameterValue(Schema<?> schema) {
23022301 * Any non-null value will cause {{#defaultValue} check to pass.
23032302 *
23042303 * @param codegenProperty Codegen Property
2305- * @param schema Parameter schema
2304+ * @param schema Parameter schema
23062305 * @return string presentation of the default value of the parameter
23072306 */
23082307 public String toDefaultParameterValue (CodegenProperty codegenProperty , Schema <?> schema ) {
@@ -2329,7 +2328,7 @@ public String toDefaultValueWithParam(String name, Schema schema) {
23292328 * Return null if you do NOT want a default value.
23302329 * Any non-null value will cause {{#defaultValue} check to pass.
23312330 *
2332- * @param schema Property schema
2331+ * @param schema Property schema
23332332 * @param codegenProperty Codegen property
23342333 * @return string presentation of the default value of the property
23352334 */
@@ -2372,7 +2371,6 @@ public String getSchemaType(Schema schema) {
23722371 }
23732372
23742373
2375-
23762374 protected Schema <?> getSchemaAdditionalProperties (Schema schema ) {
23772375 Schema <?> inner = ModelUtils .getAdditionalProperties (schema );
23782376 if (inner == null ) {
@@ -3009,6 +3007,7 @@ protected String toTestCaseName(String specTestCaseName) {
30093007 /**
30103008 * A method that allows generators to pre-process test example payloads
30113009 * This can be useful if one needs to change how values like null in string are represented
3010+ *
30123011 * @param data the test data payload
30133012 * @return the updated test data payload
30143013 */
@@ -3019,6 +3018,7 @@ protected Object processTestExampleData(Object data) {
30193018 /**
30203019 * Processes any test cases if they exist in the components.x-test-examples vendor extensions
30213020 * If they exist then cast them to java class instances and return them back in a map
3021+ *
30223022 * @param refToTestCases the component schema name that the test cases are for
30233023 */
30243024 private HashMap <String , SchemaTestCase > extractSchemaTestCases (String refToTestCases ) {
@@ -3055,7 +3055,7 @@ private HashMap<String, SchemaTestCase> extractSchemaTestCases(String refToTestC
30553055 /**
30563056 * Sets the booleans that define the model's type
30573057 *
3058- * @param model the model to update
3058+ * @param model the model to update
30593059 * @param schema the model's schema
30603060 */
30613061 protected void updateModelForString (CodegenModel model , Schema schema ) {
@@ -3313,7 +3313,6 @@ protected void setAddProps(Schema schema, IJsonSchemaValidationProperties proper
33133313 * @param sc The Schema that may contain the discriminator
33143314 * @param discPropName The String that is the discriminator propertyName in the schema
33153315 * @param visitedSchemas A set of visited schema names
3316- *
33173316 */
33183317 private CodegenProperty discriminatorFound (String composedSchemaName , Schema sc , String discPropName , Set <String > visitedSchemas ) {
33193318 if (visitedSchemas .contains (composedSchemaName )) { // recursive schema definition found
@@ -3400,7 +3399,7 @@ private CodegenProperty discriminatorFound(String composedSchemaName, Schema sc,
34003399 /**
34013400 * Recursively look in Schema sc for the discriminator and return it
34023401 *
3403- * @param sc The Schema that may contain the discriminator
3402+ * @param sc The Schema that may contain the discriminator
34043403 * @param visitedSchemas An array list of visited schemas
34053404 */
34063405 private Discriminator recursiveGetDiscriminator (Schema sc , ArrayList <Schema > visitedSchemas ) {
@@ -3620,9 +3619,9 @@ protected List<MappedModel> getAllOfDescendants(String thisSchemaName) {
36203619 Map <String , Object > vendorExtensions = cs .getExtensions ();
36213620 String mappingName =
36223621 Optional .ofNullable (vendorExtensions )
3623- .map (ve -> ve .get ("x-discriminator-value" ))
3624- .map (discriminatorValue -> (String ) discriminatorValue )
3625- .orElse (currentSchemaName );
3622+ .map (ve -> ve .get ("x-discriminator-value" ))
3623+ .map (discriminatorValue -> (String ) discriminatorValue )
3624+ .orElse (currentSchemaName );
36263625 MappedModel mm = new MappedModel (mappingName , toModelName (currentSchemaName ), !mappingName .equals (currentSchemaName ));
36273626 descendentSchemas .add (mm );
36283627 }
@@ -3649,11 +3648,11 @@ protected CodegenDiscriminator createDiscriminator(String schemaName, Schema sch
36493648 // the future..
36503649 String propertyType =
36513650 Optional .ofNullable (schema .getProperties ())
3652- .map (p -> (Schema <?>) p .get (discriminatorPropertyName ))
3653- .map (Schema ::get$ref )
3654- .map (ModelUtils ::getSimpleRef )
3655- .map (this ::toModelName )
3656- .orElseGet (() -> typeMapping .get ("string" ));
3651+ .map (p -> (Schema <?>) p .get (discriminatorPropertyName ))
3652+ .map (Schema ::get$ref )
3653+ .map (ModelUtils ::getSimpleRef )
3654+ .map (this ::toModelName )
3655+ .orElseGet (() -> typeMapping .get ("string" ));
36573656 discriminator .setPropertyType (propertyType );
36583657
36593658 // check to see if the discriminator property is an enum string
@@ -3944,8 +3943,8 @@ public CodegenProperty fromProperty(String name, Schema p, boolean required) {
39443943 * This method was kept when required was added to the fromProperty signature
39453944 * to ensure that the change was non-breaking
39463945 *
3947- * @param name name of the property
3948- * @param p OAS property schema
3946+ * @param name name of the property
3947+ * @param p OAS property schema
39493948 * @return Codegen Property object
39503949 */
39513950 public CodegenProperty fromProperty (String name , Schema p ) {
@@ -3961,9 +3960,9 @@ public CodegenProperty fromProperty(String name, Schema p) {
39613960 * Any subsequent processing of the CodegenModel return value must be idempotent
39623961 * for a given (String name, Schema schema).
39633962 *
3964- * @param name name of the property
3965- * @param p OAS property schema
3966- * @param required true if the property is required in the next higher object schema, false otherwise
3963+ * @param name name of the property
3964+ * @param p OAS property schema
3965+ * @param required true if the property is required in the next higher object schema, false otherwise
39673966 * @param schemaIsFromAdditionalProperties true if the property is a required property defined by additional properties schema
39683967 * If this is the actual additionalProperties schema not defining a required property, then
39693968 * the value should be false
@@ -4742,7 +4741,7 @@ public CodegenOperation fromOperation(String path,
47424741 if (contentType != null ) {
47434742 contentType = contentType .toLowerCase (Locale .ROOT );
47444743 }
4745- if (!( this instanceof RustAxumServerCodegen ) && contentType != null &&
4744+ if (contentType != null &&
47464745 (contentType .startsWith ("application/x-www-form-urlencoded" ) ||
47474746 contentType .startsWith ("multipart" ))) {
47484747 // process form parameters
@@ -5909,10 +5908,10 @@ protected void addImport(Set<String> importsToBeAddedTo, String type) {
59095908 /**
59105909 * Add the model name of the child schema in a composed schema to the set of imports
59115910 *
5912- * @param composed composed schema
5911+ * @param composed composed schema
59135912 * @param childSchema composed schema
5914- * @param model codegen model
5915- * @param modelName model name
5913+ * @param model codegen model
5914+ * @param modelName model name
59165915 */
59175916 protected void addImport (Schema composed , Schema childSchema , CodegenModel model , String modelName ) {
59185917 if (composed == null || childSchema == null ) {
@@ -6795,12 +6794,12 @@ protected List<Map<String, Object>> buildEnumVars(List<Object> values, String da
67956794 String enumValue = isDataTypeString (dataType )
67966795 ? enumUnknownDefaultCaseName
67976796 : // This is a dummy value that attempts to avoid collisions with previously specified cases.
6798- // Int.max / 192
6799- // The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums.
6800- // [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md)
6801- // Since this functionality was born in the Swift 5 generator and latter on broth to all generators
6802- // https://github.com/OpenAPITools/openapi-generator/pull/11013
6803- String .valueOf (11184809 );
6797+ // Int.max / 192
6798+ // The number 192 that is used to calculate this random value, is the Swift Evolution proposal for frozen/non-frozen enums.
6799+ // [SE-0192](https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md)
6800+ // Since this functionality was born in the Swift 5 generator and latter on broth to all generators
6801+ // https://github.com/OpenAPITools/openapi-generator/pull/11013
6802+ String .valueOf (11184809 );
68046803
68056804 enumVar .put ("name" , toEnumVarName (enumName , dataType ));
68066805 enumVar .put ("value" , toEnumValue (enumValue , dataType ));
@@ -7984,6 +7983,7 @@ protected String getItemsName(Schema containingSchema, String containingSchemaNa
79847983 protected String getAdditionalPropertiesName () {
79857984 return "additional_properties" ;
79867985 }
7986+
79877987 private void addJsonSchemaForBodyRequestInCaseItsNotPresent (CodegenParameter codegenParameter , RequestBody body ) {
79887988 if (codegenParameter .jsonSchema == null )
79897989 codegenParameter .jsonSchema = Json .pretty (body );
@@ -8250,8 +8250,8 @@ public void addOneOfNameExtension(Schema schema, String name) {
82508250 /**
82518251 * Add a given ComposedSchema as an interface model to be generated, assuming it has `oneOf` defined
82528252 *
8253- * @param cs ComposedSchema object to create as interface model
8254- * @param type name to use for the generated interface model
8253+ * @param cs ComposedSchema object to create as interface model
8254+ * @param type name to use for the generated interface model
82558255 */
82568256 public void addOneOfInterfaceModel (Schema cs , String type ) {
82578257 if (cs .getOneOf () == null ) {
@@ -8441,7 +8441,7 @@ private List<CodegenProperty> getComposedProperties(List<Schema> xOfCollection,
84418441 // in other sub-schemas of allOf/anyOf/oneOf
84428442 cp .vendorExtensions .putIfAbsent ("x-duplicated-data-type" , true );
84438443 } else {
8444- if (isTypeErasedGenerics ()) {
8444+ if (isTypeErasedGenerics ()) {
84458445 dataTypeSet .add (cp .baseType );
84468446 } else {
84478447 dataTypeSet .add (cp .dataType );
@@ -8472,10 +8472,14 @@ public List<VendorExtension> getSupportedVendorExtensions() {
84728472 }
84738473
84748474 @ Override
8475- public boolean getUseInlineModelResolver () { return true ; }
8475+ public boolean getUseInlineModelResolver () {
8476+ return true ;
8477+ }
84768478
84778479 @ Override
8478- public boolean getUseOpenapiNormalizer () { return true ; }
8480+ public boolean getUseOpenapiNormalizer () {
8481+ return true ;
8482+ }
84798483
84808484 @ Override
84818485 public Set <String > getOpenapiGeneratorIgnoreList () {
@@ -8492,7 +8496,9 @@ public boolean isTypeErasedGenerics() {
84928496 And convert special characters like newline, tab, carriage return
84938497 Into strings that can be rendered in the language that the generator will output to
84948498 */
8495- protected String handleSpecialCharacters (String name ) { return name ; }
8499+ protected String handleSpecialCharacters (String name ) {
8500+ return name ;
8501+ }
84968502
84978503 /**
84988504 * Used to ensure that null or Schema is returned given an input Boolean/Schema/null
0 commit comments