diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java index 7f89ef738a0..1be1d2706a4 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/CodegenModel.java @@ -25,6 +25,7 @@ public class CodegenModel { public String discriminator; public String defaultValue; public String arrayModelType; + public boolean isAlias; // Is this effectively an alias of another simple type public List vars = new ArrayList(); public List requiredVars = new ArrayList(); // a list of required properties public List optionalVars = new ArrayList(); // a list of optional properties diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java index c6bb91aa715..d0f3b332c4a 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultCodegen.java @@ -116,6 +116,8 @@ public class DefaultCodegen { // They are translated to words like "Dollar" and prefixed with ' // Then translated back during JSON encoding and decoding protected Map specialCharReplacements = new HashMap(); + // When a model is an alias for a simple type + protected Map typeAliases = new HashMap<>(); protected String ignoreFilePathOverride; @@ -1210,6 +1212,18 @@ public class DefaultCodegen { return swaggerType; } + /** + * Determine the type alias for the given type if it exists. This feature + * is only used for Java, because the language does not have a aliasing + * mechanism of its own. + * @param name The type name. + * @return The alias of the given type, if it exists. If there is no alias + * for this type, then returns the input type name. + */ + public String getAlias(String name) { + return name; + } + /** * Output the API (class) name (capitalized) ending with "Api" * Return DefaultApi if name is empty @@ -1374,6 +1388,10 @@ public class DefaultCodegen { ModelImpl impl = (ModelImpl) model; if (impl.getType() != null) { Property p = PropertyBuilder.build(impl.getType(), impl.getFormat(), null); + if (!impl.getType().equals("object") && impl.getEnum() == null) { + typeAliases.put(name, impl.getType()); + m.isAlias = true; + } m.dataType = getSwaggerType(p); } if(impl.getEnum() != null && impl.getEnum().size() > 0) { @@ -2527,6 +2545,7 @@ public class DefaultCodegen { Model sub = bp.getSchema(); if (sub instanceof RefModel) { String name = ((RefModel) sub).getSimpleRef(); + name = getAlias(name); if (typeMapping.containsKey(name)) { name = typeMapping.get(name); } else { diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java index df3c0d68357..4744d1bee2e 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/DefaultGenerator.java @@ -4,6 +4,7 @@ import com.samskivert.mustache.Mustache; import com.samskivert.mustache.Template; import io.swagger.codegen.ignore.CodegenIgnoreProcessor; import io.swagger.codegen.utils.ImplementationVersion; +import io.swagger.codegen.languages.AbstractJavaCodegen; import io.swagger.models.*; import io.swagger.models.auth.OAuth2Definition; import io.swagger.models.auth.SecuritySchemeDefinition; @@ -327,7 +328,17 @@ public class DefaultGenerator extends AbstractGenerator implements Generator { if(config.importMapping().containsKey(modelName)) { continue; } - allModels.add(((List) models.get("models")).get(0)); + Map modelTemplate = (Map) ((List) models.get("models")).get(0); + if (config instanceof AbstractJavaCodegen) { + // Special handling of aliases only applies to Java + if (modelTemplate != null && modelTemplate.containsKey("model")) { + CodegenModel m = (CodegenModel) modelTemplate.get("model"); + if (m.isAlias) { + continue; // Don't create user-defined classes for aliases + } + } + } + allModels.add(modelTemplate); for (String templateName : config.modelTemplateFiles().keySet()) { String suffix = config.modelTemplateFiles().get(templateName); String filename = config.modelFileFolder() + File.separator + config.toModelFilename(modelName) + suffix; diff --git a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java index 1af538282c5..c3d8d2e4a57 100644 --- a/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java +++ b/modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/AbstractJavaCodegen.java @@ -574,6 +574,14 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code return super.getTypeDeclaration(p); } + @Override + public String getAlias(String name) { + if (typeAliases.containsKey(name)) { + return typeAliases.get(name); + } + return name; + } + @Override public String toDefaultValue(Property p) { if (p instanceof ArrayProperty) { @@ -723,6 +731,8 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code public String getSwaggerType(Property p) { String swaggerType = super.getSwaggerType(p); + swaggerType = getAlias(swaggerType); + // don't apply renaming on types from the typeMapping if (typeMapping.containsKey(swaggerType)) { return typeMapping.get(swaggerType); diff --git a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 55056c20330..5b70e910de4 100644 --- a/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/swagger-codegen/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -781,6 +781,74 @@ paths: description: User not found security: - http_basic_test: [] + /fake/outer/number: + post: + tags: + - fake + description: Test serialization of outer number types + operationId: fakeOuterNumberSerialize + parameters: + - name: body + in: body + description: Input number as post body + schema: + $ref: '#/definitions/OuterNumber' + responses: + '200': + description: Output number + schema: + $ref: '#/definitions/OuterNumber' + /fake/outer/string: + post: + tags: + - fake + description: Test serialization of outer string types + operationId: fakeOuterStringSerialize + parameters: + - name: body + in: body + description: Input string as post body + schema: + $ref: '#/definitions/OuterString' + responses: + '200': + description: Output string + schema: + $ref: '#/definitions/OuterString' + /fake/outer/boolean: + post: + tags: + - fake + description: Test serialization of outer boolean types + operationId: fakeOuterBooleanSerialize + parameters: + - name: body + in: body + description: Input boolean as post body + schema: + $ref: '#/definitions/OuterBoolean' + responses: + '200': + description: Output boolean + schema: + $ref: '#/definitions/OuterBoolean' + /fake/outer/composite: + post: + tags: + - fake + description: Test serialization of object with outer number type + operationId: fakeOuterCompositeSerialize + parameters: + - name: body + in: body + description: Input composite as post body + schema: + $ref: '#/definitions/OuterComposite' + responses: + '200': + description: Output composite + schema: + $ref: '#/definitions/OuterComposite' securityDefinitions: petstore_auth: type: oauth2 @@ -1258,6 +1326,21 @@ definitions: - "placed" - "approved" - "delivered" + OuterNumber: + type: number + OuterString: + type: string + OuterBoolean: + type: boolean + OuterComposite: + type: object + properties: + my_number: + $ref: '#/definitions/OuterNumber' + my_string: + $ref: '#/definitions/OuterString' + my_boolean: + $ref: '#/definitions/OuterBoolean' externalDocs: description: Find out more about Swagger url: 'http://swagger.io' diff --git a/samples/client/petstore/bash/_petstore-cli b/samples/client/petstore/bash/_petstore-cli index 8552bad11ce..2a0f6175b7b 100644 --- a/samples/client/petstore/bash/_petstore-cli +++ b/samples/client/petstore/bash/_petstore-cli @@ -296,6 +296,10 @@ case $state in ops) # Operations _values "Operations" \ + "fakeOuterBooleanSerialize[]" \ + "fakeOuterCompositeSerialize[]" \ + "fakeOuterNumberSerialize[]" \ + "fakeOuterStringSerialize[]" \ "testClientModel[To test \"client\" model]" \ "testEndpointParameters[Fake endpoint for testing various parameters 假端點 @@ -325,6 +329,30 @@ case $state in ;; args) case $line[1] in + fakeOuterBooleanSerialize) + local -a _op_arguments + _op_arguments=( + ) + _describe -t actions 'operations' _op_arguments -S '' && ret=0 + ;; + fakeOuterCompositeSerialize) + local -a _op_arguments + _op_arguments=( + ) + _describe -t actions 'operations' _op_arguments -S '' && ret=0 + ;; + fakeOuterNumberSerialize) + local -a _op_arguments + _op_arguments=( + ) + _describe -t actions 'operations' _op_arguments -S '' && ret=0 + ;; + fakeOuterStringSerialize) + local -a _op_arguments + _op_arguments=( + ) + _describe -t actions 'operations' _op_arguments -S '' && ret=0 + ;; testClientModel) local -a _op_arguments _op_arguments=( diff --git a/samples/client/petstore/bash/petstore-cli b/samples/client/petstore/bash/petstore-cli index ad3c33d353b..3d5fe0db9a7 100755 --- a/samples/client/petstore/bash/petstore-cli +++ b/samples/client/petstore/bash/petstore-cli @@ -66,6 +66,10 @@ declare -A operation_parameters # 0 - optional # 1 - required declare -A operation_parameters_minimum_occurences +operation_parameters_minimum_occurences["fakeOuterBooleanSerialize:::body"]=0 +operation_parameters_minimum_occurences["fakeOuterCompositeSerialize:::body"]=0 +operation_parameters_minimum_occurences["fakeOuterNumberSerialize:::body"]=0 +operation_parameters_minimum_occurences["fakeOuterStringSerialize:::body"]=0 operation_parameters_minimum_occurences["testClientModel:::body"]=1 operation_parameters_minimum_occurences["testEndpointParameters:::number"]=1 operation_parameters_minimum_occurences["testEndpointParameters:::double"]=1 @@ -122,6 +126,10 @@ operation_parameters_minimum_occurences["updateUser:::body"]=1 # N - N values # 0 - unlimited declare -A operation_parameters_maximum_occurences +operation_parameters_maximum_occurences["fakeOuterBooleanSerialize:::body"]=0 +operation_parameters_maximum_occurences["fakeOuterCompositeSerialize:::body"]=0 +operation_parameters_maximum_occurences["fakeOuterNumberSerialize:::body"]=0 +operation_parameters_maximum_occurences["fakeOuterStringSerialize:::body"]=0 operation_parameters_maximum_occurences["testClientModel:::body"]=0 operation_parameters_maximum_occurences["testEndpointParameters:::number"]=0 operation_parameters_maximum_occurences["testEndpointParameters:::double"]=0 @@ -175,6 +183,10 @@ operation_parameters_maximum_occurences["updateUser:::body"]=0 # The type of collection for specifying multiple values for parameter: # - multi, csv, ssv, tsv declare -A operation_parameters_collection_type +operation_parameters_collection_type["fakeOuterBooleanSerialize:::body"]="" +operation_parameters_collection_type["fakeOuterCompositeSerialize:::body"]="" +operation_parameters_collection_type["fakeOuterNumberSerialize:::body"]="" +operation_parameters_collection_type["fakeOuterStringSerialize:::body"]="" operation_parameters_collection_type["testClientModel:::body"]="" operation_parameters_collection_type["testEndpointParameters:::number"]="" operation_parameters_collection_type["testEndpointParameters:::double"]="" @@ -711,6 +723,10 @@ EOF echo "" echo -e "$(tput bold)$(tput setaf 7)[fake]$(tput sgr0)" read -d '' ops < + /// OuterBoolean + /// + [DataContract] + public partial class OuterBoolean : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterBoolean() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterBoolean {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterBoolean); + } + + /// + /// Returns true if OuterBoolean instances are equal + /// + /// Instance of OuterBoolean to be compared + /// Boolean + public bool Equals(OuterBoolean other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterComposite.cs b/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterComposite.cs new file mode 100644 index 00000000000..308c26d4f5c --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterComposite.cs @@ -0,0 +1,144 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// OuterComposite + /// + [DataContract] + public partial class OuterComposite : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + /// MyNumber. + /// MyString. + /// MyBoolean. + public OuterComposite(OuterNumber MyNumber = default(OuterNumber), OuterString MyString = default(OuterString), OuterBoolean MyBoolean = default(OuterBoolean)) + { + this.MyNumber = MyNumber; + this.MyString = MyString; + this.MyBoolean = MyBoolean; + } + + /// + /// Gets or Sets MyNumber + /// + [DataMember(Name="my_number", EmitDefaultValue=false)] + public OuterNumber MyNumber { get; set; } + /// + /// Gets or Sets MyString + /// + [DataMember(Name="my_string", EmitDefaultValue=false)] + public OuterString MyString { get; set; } + /// + /// Gets or Sets MyBoolean + /// + [DataMember(Name="my_boolean", EmitDefaultValue=false)] + public OuterBoolean MyBoolean { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterComposite); + } + + /// + /// Returns true if OuterComposite instances are equal + /// + /// Instance of OuterComposite to be compared + /// Boolean + public bool Equals(OuterComposite other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.MyNumber == other.MyNumber || + this.MyNumber != null && + this.MyNumber.Equals(other.MyNumber) + ) && + ( + this.MyString == other.MyString || + this.MyString != null && + this.MyString.Equals(other.MyString) + ) && + ( + this.MyBoolean == other.MyBoolean || + this.MyBoolean != null && + this.MyBoolean.Equals(other.MyBoolean) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.MyNumber != null) + hash = hash * 59 + this.MyNumber.GetHashCode(); + if (this.MyString != null) + hash = hash * 59 + this.MyString.GetHashCode(); + if (this.MyBoolean != null) + hash = hash * 59 + this.MyBoolean.GetHashCode(); + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterNumber.cs b/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterNumber.cs new file mode 100644 index 00000000000..103fd4f69dd --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterNumber.cs @@ -0,0 +1,100 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// OuterNumber + /// + [DataContract] + public partial class OuterNumber : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterNumber() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterNumber {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterNumber); + } + + /// + /// Returns true if OuterNumber instances are equal + /// + /// Instance of OuterNumber to be compared + /// Boolean + public bool Equals(OuterNumber other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterString.cs b/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterString.cs new file mode 100644 index 00000000000..327fe620b59 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient.v5/src/IO.Swagger/Model/OuterString.cs @@ -0,0 +1,100 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; + +namespace IO.Swagger.Model +{ + /// + /// OuterString + /// + [DataContract] + public partial class OuterString : IEquatable + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterString() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterString {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterString); + } + + /// + /// Returns true if OuterString instances are equal + /// + /// Instance of OuterString to be compared + /// Boolean + public bool Equals(OuterString other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/README.md b/samples/client/petstore/csharp/SwaggerClient/README.md index e7e5c9fb849..e9f8551872b 100644 --- a/samples/client/petstore/csharp/SwaggerClient/README.md +++ b/samples/client/petstore/csharp/SwaggerClient/README.md @@ -69,17 +69,16 @@ namespace Example { var apiInstance = new FakeApi(); - var body = new ModelClient(); // ModelClient | client model + var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) try { - // To test \"client\" model - ModelClient result = apiInstance.TestClientModel(body); + OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); } } } @@ -93,6 +92,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters @@ -147,7 +150,11 @@ Class | Method | HTTP request | Description - [Model.Name](docs/Name.md) - [Model.NumberOnly](docs/NumberOnly.md) - [Model.Order](docs/Order.md) + - [Model.OuterBoolean](docs/OuterBoolean.md) + - [Model.OuterComposite](docs/OuterComposite.md) - [Model.OuterEnum](docs/OuterEnum.md) + - [Model.OuterNumber](docs/OuterNumber.md) + - [Model.OuterString](docs/OuterString.md) - [Model.Pet](docs/Pet.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md index 82a3463dacb..1277461eb1d 100644 --- a/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClient/docs/FakeApi.md @@ -4,11 +4,259 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters + +# **FakeOuterBooleanSerialize** +> OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) + + try + { + OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterNumberSerialize** +> OuterNumber FakeOuterNumberSerialize (OuterNumber body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterNumber(); // OuterNumber | Input number as post body (optional) + + try + { + OuterNumber result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterStringSerialize** +> OuterString FakeOuterStringSerialize (OuterString body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterString(); // OuterString | Input string as post body (optional) + + try + { + OuterString result = apiInstance.FakeOuterStringSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestClientModel** > ModelClient TestClientModel (ModelClient body) diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/OuterBoolean.md b/samples/client/petstore/csharp/SwaggerClient/docs/OuterBoolean.md new file mode 100644 index 00000000000..84845b35e54 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/OuterBoolean.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.OuterBoolean +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/OuterComposite.md b/samples/client/petstore/csharp/SwaggerClient/docs/OuterComposite.md new file mode 100644 index 00000000000..41fae66f136 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/OuterComposite.md @@ -0,0 +1,11 @@ +# IO.Swagger.Model.OuterComposite +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional] +**MyString** | [**OuterString**](OuterString.md) | | [optional] +**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/OuterNumber.md b/samples/client/petstore/csharp/SwaggerClient/docs/OuterNumber.md new file mode 100644 index 00000000000..7c88274d6ee --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/OuterNumber.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.OuterNumber +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/docs/OuterString.md b/samples/client/petstore/csharp/SwaggerClient/docs/OuterString.md new file mode 100644 index 00000000000..524423a5dab --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/docs/OuterString.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.OuterString +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterBooleanTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterBooleanTests.cs new file mode 100644 index 00000000000..a24e20009cc --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterBooleanTests.cs @@ -0,0 +1,70 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterBoolean + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterBooleanTests + { + // TODO uncomment below to declare an instance variable for OuterBoolean + //private OuterBoolean instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterBoolean + //instance = new OuterBoolean(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterBoolean + /// + [Test] + public void OuterBooleanInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterBoolean + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterBoolean"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterCompositeTests.cs new file mode 100644 index 00000000000..3d2ab500d1a --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterCompositeTests.cs @@ -0,0 +1,94 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterComposite + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterCompositeTests + { + // TODO uncomment below to declare an instance variable for OuterComposite + //private OuterComposite instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterComposite + //instance = new OuterComposite(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterComposite + /// + [Test] + public void OuterCompositeInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterComposite + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterComposite"); + } + + /// + /// Test the property 'MyNumber' + /// + [Test] + public void MyNumberTest() + { + // TODO unit test for the property 'MyNumber' + } + /// + /// Test the property 'MyString' + /// + [Test] + public void MyStringTest() + { + // TODO unit test for the property 'MyString' + } + /// + /// Test the property 'MyBoolean' + /// + [Test] + public void MyBooleanTest() + { + // TODO unit test for the property 'MyBoolean' + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterNumberTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterNumberTests.cs new file mode 100644 index 00000000000..66a97a03e7b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterNumberTests.cs @@ -0,0 +1,70 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterNumber + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterNumberTests + { + // TODO uncomment below to declare an instance variable for OuterNumber + //private OuterNumber instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterNumber + //instance = new OuterNumber(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterNumber + /// + [Test] + public void OuterNumberInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterNumber + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterNumber"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterStringTests.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterStringTests.cs new file mode 100644 index 00000000000..f6397957ece --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger.Test/Model/OuterStringTests.cs @@ -0,0 +1,70 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterString + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterStringTests + { + // TODO uncomment below to declare an instance variable for OuterString + //private OuterString instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterString + //instance = new OuterString(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterString + /// + [Test] + public void OuterStringInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterString + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterString"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs index 8ef1efbdf14..76d88a6b174 100644 --- a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Api/FakeApi.cs @@ -25,6 +25,90 @@ namespace IO.Swagger.Api { #region Synchronous Operations /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// OuterBoolean + OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of OuterBoolean + ApiResponse FakeOuterBooleanSerializeWithHttpInfo (OuterBoolean body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + ApiResponse FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// OuterNumber + OuterNumber FakeOuterNumberSerialize (OuterNumber body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of OuterNumber + ApiResponse FakeOuterNumberSerializeWithHttpInfo (OuterNumber body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// OuterString + OuterString FakeOuterStringSerialize (OuterString body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of OuterString + ApiResponse FakeOuterStringSerializeWithHttpInfo (OuterString body = null); + /// /// To test \"client\" model /// /// @@ -130,6 +214,90 @@ namespace IO.Swagger.Api #endregion Synchronous Operations #region Asynchronous Operations /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of OuterBoolean + System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (OuterBoolean body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (OuterBoolean) + System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (OuterBoolean body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of OuterNumber + System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (OuterNumber body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (OuterNumber) + System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (OuterNumber body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of OuterString + System.Threading.Tasks.Task FakeOuterStringSerializeAsync (OuterString body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (OuterString) + System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (OuterString body = null); + /// /// To test \"client\" model /// /// @@ -344,6 +512,570 @@ namespace IO.Swagger.Api this.Configuration.AddDefaultHeader(key, value); } + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// OuterBoolean + public OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null) + { + ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of OuterBoolean + public ApiResponse< OuterBoolean > FakeOuterBooleanSerializeWithHttpInfo (OuterBoolean body = null) + { + + var localVarPath = "/fake/outer/boolean"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); + + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of OuterBoolean + public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (OuterBoolean body = null) + { + ApiResponse localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (OuterBoolean) + public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (OuterBoolean body = null) + { + + var localVarPath = "/fake/outer/boolean"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + public OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + { + ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + public ApiResponse< OuterComposite > FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null) + { + + var localVarPath = "/fake/outer/composite"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null) + { + ApiResponse localVarResponse = await FakeOuterCompositeSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null) + { + + var localVarPath = "/fake/outer/composite"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// OuterNumber + public OuterNumber FakeOuterNumberSerialize (OuterNumber body = null) + { + ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of OuterNumber + public ApiResponse< OuterNumber > FakeOuterNumberSerializeWithHttpInfo (OuterNumber body = null) + { + + var localVarPath = "/fake/outer/number"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of OuterNumber + public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (OuterNumber body = null) + { + ApiResponse localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (OuterNumber) + public async System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (OuterNumber body = null) + { + + var localVarPath = "/fake/outer/number"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// OuterString + public OuterString FakeOuterStringSerialize (OuterString body = null) + { + ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of OuterString + public ApiResponse< OuterString > FakeOuterStringSerializeWithHttpInfo (OuterString body = null) + { + + var localVarPath = "/fake/outer/string"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of OuterString + public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync (OuterString body = null) + { + ApiResponse localVarResponse = await FakeOuterStringSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (OuterString) + public async System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (OuterString body = null) + { + + var localVarPath = "/fake/outer/string"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); + + } + /// /// To test \"client\" model To test \"client\" model /// diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterBoolean.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterBoolean.cs new file mode 100644 index 00000000000..c25f48db758 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterBoolean.cs @@ -0,0 +1,112 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterBoolean + /// + [DataContract] + public partial class OuterBoolean : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterBoolean() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterBoolean {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterBoolean); + } + + /// + /// Returns true if OuterBoolean instances are equal + /// + /// Instance of OuterBoolean to be compared + /// Boolean + public bool Equals(OuterBoolean other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterComposite.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterComposite.cs new file mode 100644 index 00000000000..ce12f7bb6ce --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterComposite.cs @@ -0,0 +1,156 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterComposite + /// + [DataContract] + public partial class OuterComposite : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// MyNumber. + /// MyString. + /// MyBoolean. + public OuterComposite(OuterNumber MyNumber = default(OuterNumber), OuterString MyString = default(OuterString), OuterBoolean MyBoolean = default(OuterBoolean)) + { + this.MyNumber = MyNumber; + this.MyString = MyString; + this.MyBoolean = MyBoolean; + } + + /// + /// Gets or Sets MyNumber + /// + [DataMember(Name="my_number", EmitDefaultValue=false)] + public OuterNumber MyNumber { get; set; } + /// + /// Gets or Sets MyString + /// + [DataMember(Name="my_string", EmitDefaultValue=false)] + public OuterString MyString { get; set; } + /// + /// Gets or Sets MyBoolean + /// + [DataMember(Name="my_boolean", EmitDefaultValue=false)] + public OuterBoolean MyBoolean { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterComposite); + } + + /// + /// Returns true if OuterComposite instances are equal + /// + /// Instance of OuterComposite to be compared + /// Boolean + public bool Equals(OuterComposite other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.MyNumber == other.MyNumber || + this.MyNumber != null && + this.MyNumber.Equals(other.MyNumber) + ) && + ( + this.MyString == other.MyString || + this.MyString != null && + this.MyString.Equals(other.MyString) + ) && + ( + this.MyBoolean == other.MyBoolean || + this.MyBoolean != null && + this.MyBoolean.Equals(other.MyBoolean) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.MyNumber != null) + hash = hash * 59 + this.MyNumber.GetHashCode(); + if (this.MyString != null) + hash = hash * 59 + this.MyString.GetHashCode(); + if (this.MyBoolean != null) + hash = hash * 59 + this.MyBoolean.GetHashCode(); + return hash; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterNumber.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterNumber.cs new file mode 100644 index 00000000000..a53914c4840 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterNumber.cs @@ -0,0 +1,112 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterNumber + /// + [DataContract] + public partial class OuterNumber : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterNumber() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterNumber {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterNumber); + } + + /// + /// Returns true if OuterNumber instances are equal + /// + /// Instance of OuterNumber to be compared + /// Boolean + public bool Equals(OuterNumber other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterString.cs b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterString.cs new file mode 100644 index 00000000000..d2d0905e162 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClient/src/IO.Swagger/Model/OuterString.cs @@ -0,0 +1,112 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterString + /// + [DataContract] + public partial class OuterString : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterString() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterString {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterString); + } + + /// + /// Returns true if OuterString instances are equal + /// + /// Instance of OuterString to be compared + /// Boolean + public bool Equals(OuterString other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md index d56551bfcbc..2ffa0ef9f64 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/README.md @@ -49,17 +49,16 @@ namespace Example { var apiInstance = new FakeApi(); - var body = new ModelClient(); // ModelClient | client model + var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) try { - // To test \"client\" model - ModelClient result = apiInstance.TestClientModel(body); + OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); } } } @@ -73,6 +72,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters @@ -127,7 +130,11 @@ Class | Method | HTTP request | Description - [Model.Name](docs/Name.md) - [Model.NumberOnly](docs/NumberOnly.md) - [Model.Order](docs/Order.md) + - [Model.OuterBoolean](docs/OuterBoolean.md) + - [Model.OuterComposite](docs/OuterComposite.md) - [Model.OuterEnum](docs/OuterEnum.md) + - [Model.OuterNumber](docs/OuterNumber.md) + - [Model.OuterString](docs/OuterString.md) - [Model.Pet](docs/Pet.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md index 82a3463dacb..1277461eb1d 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/docs/FakeApi.md @@ -4,11 +4,259 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters + +# **FakeOuterBooleanSerialize** +> OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) + + try + { + OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterNumberSerialize** +> OuterNumber FakeOuterNumberSerialize (OuterNumber body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterNumber(); // OuterNumber | Input number as post body (optional) + + try + { + OuterNumber result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterStringSerialize** +> OuterString FakeOuterStringSerialize (OuterString body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterString(); // OuterString | Input string as post body (optional) + + try + { + OuterString result = apiInstance.FakeOuterStringSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestClientModel** > ModelClient TestClientModel (ModelClient body) diff --git a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs index 9c73f22c36b..dff670d8a6c 100644 --- a/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientNetCoreProject/src/IO.Swagger/Api/FakeApi.cs @@ -25,6 +25,90 @@ namespace IO.Swagger.Api { #region Synchronous Operations /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// OuterBoolean + OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of OuterBoolean + ApiResponse FakeOuterBooleanSerializeWithHttpInfo (OuterBoolean body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + ApiResponse FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// OuterNumber + OuterNumber FakeOuterNumberSerialize (OuterNumber body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of OuterNumber + ApiResponse FakeOuterNumberSerializeWithHttpInfo (OuterNumber body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// OuterString + OuterString FakeOuterStringSerialize (OuterString body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of OuterString + ApiResponse FakeOuterStringSerializeWithHttpInfo (OuterString body = null); + /// /// To test \"client\" model /// /// @@ -130,6 +214,90 @@ namespace IO.Swagger.Api #endregion Synchronous Operations #region Asynchronous Operations /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of OuterBoolean + System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (OuterBoolean body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (OuterBoolean) + System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (OuterBoolean body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of OuterNumber + System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (OuterNumber body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (OuterNumber) + System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (OuterNumber body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of OuterString + System.Threading.Tasks.Task FakeOuterStringSerializeAsync (OuterString body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (OuterString) + System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (OuterString body = null); + /// /// To test \"client\" model /// /// @@ -344,6 +512,570 @@ namespace IO.Swagger.Api this.Configuration.AddDefaultHeader(key, value); } + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// OuterBoolean + public OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null) + { + ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of OuterBoolean + public ApiResponse< OuterBoolean > FakeOuterBooleanSerializeWithHttpInfo (OuterBoolean body = null) + { + + var localVarPath = "./fake/outer/boolean"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); + + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of OuterBoolean + public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (OuterBoolean body = null) + { + ApiResponse localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (OuterBoolean) + public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (OuterBoolean body = null) + { + + var localVarPath = "./fake/outer/boolean"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + public OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + { + ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + public ApiResponse< OuterComposite > FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null) + { + + var localVarPath = "./fake/outer/composite"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null) + { + ApiResponse localVarResponse = await FakeOuterCompositeSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null) + { + + var localVarPath = "./fake/outer/composite"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// OuterNumber + public OuterNumber FakeOuterNumberSerialize (OuterNumber body = null) + { + ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of OuterNumber + public ApiResponse< OuterNumber > FakeOuterNumberSerializeWithHttpInfo (OuterNumber body = null) + { + + var localVarPath = "./fake/outer/number"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of OuterNumber + public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (OuterNumber body = null) + { + ApiResponse localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (OuterNumber) + public async System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (OuterNumber body = null) + { + + var localVarPath = "./fake/outer/number"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// OuterString + public OuterString FakeOuterStringSerialize (OuterString body = null) + { + ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of OuterString + public ApiResponse< OuterString > FakeOuterStringSerializeWithHttpInfo (OuterString body = null) + { + + var localVarPath = "./fake/outer/string"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of OuterString + public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync (OuterString body = null) + { + ApiResponse localVarResponse = await FakeOuterStringSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (OuterString) + public async System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (OuterString body = null) + { + + var localVarPath = "./fake/outer/string"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Key, x => x.Value.ToString()), + (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); + + } + /// /// To test \"client\" model To test \"client\" model /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md index e7e5c9fb849..e9f8551872b 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/README.md @@ -69,17 +69,16 @@ namespace Example { var apiInstance = new FakeApi(); - var body = new ModelClient(); // ModelClient | client model + var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) try { - // To test \"client\" model - ModelClient result = apiInstance.TestClientModel(body); + OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body); Debug.WriteLine(result); } catch (Exception e) { - Debug.Print("Exception when calling FakeApi.TestClientModel: " + e.Message ); + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); } } } @@ -93,6 +92,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters @@ -147,7 +150,11 @@ Class | Method | HTTP request | Description - [Model.Name](docs/Name.md) - [Model.NumberOnly](docs/NumberOnly.md) - [Model.Order](docs/Order.md) + - [Model.OuterBoolean](docs/OuterBoolean.md) + - [Model.OuterComposite](docs/OuterComposite.md) - [Model.OuterEnum](docs/OuterEnum.md) + - [Model.OuterNumber](docs/OuterNumber.md) + - [Model.OuterString](docs/OuterString.md) - [Model.Pet](docs/Pet.md) - [Model.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Model.SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/FakeApi.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/FakeApi.md index 82a3463dacb..1277461eb1d 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/FakeApi.md +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/FakeApi.md @@ -4,11 +4,259 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**FakeOuterBooleanSerialize**](FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +[**FakeOuterCompositeSerialize**](FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +[**FakeOuterNumberSerialize**](FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +[**FakeOuterStringSerialize**](FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | [**TestClientModel**](FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**TestEnumParameters**](FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters + +# **FakeOuterBooleanSerialize** +> OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null) + + + +Test serialization of outer boolean types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterBooleanSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterBoolean(); // OuterBoolean | Input boolean as post body (optional) + + try + { + OuterBoolean result = apiInstance.FakeOuterBooleanSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterBooleanSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + + + +Test serialization of object with outer number type + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterCompositeSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterComposite(); // OuterComposite | Input composite as post body (optional) + + try + { + OuterComposite result = apiInstance.FakeOuterCompositeSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterCompositeSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterNumberSerialize** +> OuterNumber FakeOuterNumberSerialize (OuterNumber body = null) + + + +Test serialization of outer number types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterNumberSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterNumber(); // OuterNumber | Input number as post body (optional) + + try + { + OuterNumber result = apiInstance.FakeOuterNumberSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterNumberSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + + +# **FakeOuterStringSerialize** +> OuterString FakeOuterStringSerialize (OuterString body = null) + + + +Test serialization of outer string types + +### Example +```csharp +using System; +using System.Diagnostics; +using IO.Swagger.Api; +using IO.Swagger.Client; +using IO.Swagger.Model; + +namespace Example +{ + public class FakeOuterStringSerializeExample + { + public void main() + { + + var apiInstance = new FakeApi(); + var body = new OuterString(); // OuterString | Input string as post body (optional) + + try + { + OuterString result = apiInstance.FakeOuterStringSerialize(body); + Debug.WriteLine(result); + } + catch (Exception e) + { + Debug.Print("Exception when calling FakeApi.FakeOuterStringSerialize: " + e.Message ); + } + } + } +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestClientModel** > ModelClient TestClientModel (ModelClient body) diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterBoolean.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterBoolean.md new file mode 100644 index 00000000000..84845b35e54 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterBoolean.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.OuterBoolean +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterComposite.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterComposite.md new file mode 100644 index 00000000000..41fae66f136 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterComposite.md @@ -0,0 +1,11 @@ +# IO.Swagger.Model.OuterComposite +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional] +**MyString** | [**OuterString**](OuterString.md) | | [optional] +**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterNumber.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterNumber.md new file mode 100644 index 00000000000..7c88274d6ee --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterNumber.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.OuterNumber +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterString.md b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterString.md new file mode 100644 index 00000000000..524423a5dab --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/docs/OuterString.md @@ -0,0 +1,8 @@ +# IO.Swagger.Model.OuterString +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterBooleanTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterBooleanTests.cs new file mode 100644 index 00000000000..a24e20009cc --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterBooleanTests.cs @@ -0,0 +1,70 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterBoolean + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterBooleanTests + { + // TODO uncomment below to declare an instance variable for OuterBoolean + //private OuterBoolean instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterBoolean + //instance = new OuterBoolean(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterBoolean + /// + [Test] + public void OuterBooleanInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterBoolean + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterBoolean"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterCompositeTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterCompositeTests.cs new file mode 100644 index 00000000000..3d2ab500d1a --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterCompositeTests.cs @@ -0,0 +1,94 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterComposite + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterCompositeTests + { + // TODO uncomment below to declare an instance variable for OuterComposite + //private OuterComposite instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterComposite + //instance = new OuterComposite(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterComposite + /// + [Test] + public void OuterCompositeInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterComposite + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterComposite"); + } + + /// + /// Test the property 'MyNumber' + /// + [Test] + public void MyNumberTest() + { + // TODO unit test for the property 'MyNumber' + } + /// + /// Test the property 'MyString' + /// + [Test] + public void MyStringTest() + { + // TODO unit test for the property 'MyString' + } + /// + /// Test the property 'MyBoolean' + /// + [Test] + public void MyBooleanTest() + { + // TODO unit test for the property 'MyBoolean' + } + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterNumberTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterNumberTests.cs new file mode 100644 index 00000000000..66a97a03e7b --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterNumberTests.cs @@ -0,0 +1,70 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterNumber + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterNumberTests + { + // TODO uncomment below to declare an instance variable for OuterNumber + //private OuterNumber instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterNumber + //instance = new OuterNumber(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterNumber + /// + [Test] + public void OuterNumberInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterNumber + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterNumber"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterStringTests.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterStringTests.cs new file mode 100644 index 00000000000..f6397957ece --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger.Test/Model/OuterStringTests.cs @@ -0,0 +1,70 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + + +using NUnit.Framework; + +using System; +using System.Linq; +using System.IO; +using System.Collections.Generic; +using IO.Swagger.Api; +using IO.Swagger.Model; +using IO.Swagger.Client; +using System.Reflection; + +namespace IO.Swagger.Test +{ + /// + /// Class for testing OuterString + /// + /// + /// This file is automatically generated by Swagger Codegen. + /// Please update the test case below to test the model. + /// + [TestFixture] + public class OuterStringTests + { + // TODO uncomment below to declare an instance variable for OuterString + //private OuterString instance; + + /// + /// Setup before each test + /// + [SetUp] + public void Init() + { + // TODO uncomment below to create an instance of OuterString + //instance = new OuterString(); + } + + /// + /// Clean up after each test + /// + [TearDown] + public void Cleanup() + { + + } + + /// + /// Test an instance of OuterString + /// + [Test] + public void OuterStringInstanceTest() + { + // TODO uncomment below to test "IsInstanceOfType" OuterString + //Assert.IsInstanceOfType (instance, "variable 'instance' is a OuterString"); + } + + + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs index 8ef1efbdf14..76d88a6b174 100644 --- a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Api/FakeApi.cs @@ -25,6 +25,90 @@ namespace IO.Swagger.Api { #region Synchronous Operations /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// OuterBoolean + OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of OuterBoolean + ApiResponse FakeOuterBooleanSerializeWithHttpInfo (OuterBoolean body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + ApiResponse FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// OuterNumber + OuterNumber FakeOuterNumberSerialize (OuterNumber body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of OuterNumber + ApiResponse FakeOuterNumberSerializeWithHttpInfo (OuterNumber body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// OuterString + OuterString FakeOuterStringSerialize (OuterString body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of OuterString + ApiResponse FakeOuterStringSerializeWithHttpInfo (OuterString body = null); + /// /// To test \"client\" model /// /// @@ -130,6 +214,90 @@ namespace IO.Swagger.Api #endregion Synchronous Operations #region Asynchronous Operations /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of OuterBoolean + System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (OuterBoolean body = null); + + /// + /// + /// + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (OuterBoolean) + System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (OuterBoolean body = null); + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null); + + /// + /// + /// + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null); + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of OuterNumber + System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (OuterNumber body = null); + + /// + /// + /// + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (OuterNumber) + System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (OuterNumber body = null); + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of OuterString + System.Threading.Tasks.Task FakeOuterStringSerializeAsync (OuterString body = null); + + /// + /// + /// + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (OuterString) + System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (OuterString body = null); + /// /// To test \"client\" model /// /// @@ -344,6 +512,570 @@ namespace IO.Swagger.Api this.Configuration.AddDefaultHeader(key, value); } + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// OuterBoolean + public OuterBoolean FakeOuterBooleanSerialize (OuterBoolean body = null) + { + ApiResponse localVarResponse = FakeOuterBooleanSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// ApiResponse of OuterBoolean + public ApiResponse< OuterBoolean > FakeOuterBooleanSerializeWithHttpInfo (OuterBoolean body = null) + { + + var localVarPath = "/fake/outer/boolean"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); + + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of OuterBoolean + public async System.Threading.Tasks.Task FakeOuterBooleanSerializeAsync (OuterBoolean body = null) + { + ApiResponse localVarResponse = await FakeOuterBooleanSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer boolean types + /// + /// Thrown when fails to make API call + /// Input boolean as post body (optional) + /// Task of ApiResponse (OuterBoolean) + public async System.Threading.Tasks.Task> FakeOuterBooleanSerializeAsyncWithHttpInfo (OuterBoolean body = null) + { + + var localVarPath = "/fake/outer/boolean"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterBooleanSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterBoolean) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterBoolean))); + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// OuterComposite + public OuterComposite FakeOuterCompositeSerialize (OuterComposite body = null) + { + ApiResponse localVarResponse = FakeOuterCompositeSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// ApiResponse of OuterComposite + public ApiResponse< OuterComposite > FakeOuterCompositeSerializeWithHttpInfo (OuterComposite body = null) + { + + var localVarPath = "/fake/outer/composite"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of OuterComposite + public async System.Threading.Tasks.Task FakeOuterCompositeSerializeAsync (OuterComposite body = null) + { + ApiResponse localVarResponse = await FakeOuterCompositeSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of object with outer number type + /// + /// Thrown when fails to make API call + /// Input composite as post body (optional) + /// Task of ApiResponse (OuterComposite) + public async System.Threading.Tasks.Task> FakeOuterCompositeSerializeAsyncWithHttpInfo (OuterComposite body = null) + { + + var localVarPath = "/fake/outer/composite"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterCompositeSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterComposite) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterComposite))); + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// OuterNumber + public OuterNumber FakeOuterNumberSerialize (OuterNumber body = null) + { + ApiResponse localVarResponse = FakeOuterNumberSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// ApiResponse of OuterNumber + public ApiResponse< OuterNumber > FakeOuterNumberSerializeWithHttpInfo (OuterNumber body = null) + { + + var localVarPath = "/fake/outer/number"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of OuterNumber + public async System.Threading.Tasks.Task FakeOuterNumberSerializeAsync (OuterNumber body = null) + { + ApiResponse localVarResponse = await FakeOuterNumberSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer number types + /// + /// Thrown when fails to make API call + /// Input number as post body (optional) + /// Task of ApiResponse (OuterNumber) + public async System.Threading.Tasks.Task> FakeOuterNumberSerializeAsyncWithHttpInfo (OuterNumber body = null) + { + + var localVarPath = "/fake/outer/number"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterNumberSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterNumber) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterNumber))); + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// OuterString + public OuterString FakeOuterStringSerialize (OuterString body = null) + { + ApiResponse localVarResponse = FakeOuterStringSerializeWithHttpInfo(body); + return localVarResponse.Data; + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// ApiResponse of OuterString + public ApiResponse< OuterString > FakeOuterStringSerializeWithHttpInfo (OuterString body = null) + { + + var localVarPath = "/fake/outer/string"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) Configuration.ApiClient.CallApi(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of OuterString + public async System.Threading.Tasks.Task FakeOuterStringSerializeAsync (OuterString body = null) + { + ApiResponse localVarResponse = await FakeOuterStringSerializeAsyncWithHttpInfo(body); + return localVarResponse.Data; + + } + + /// + /// Test serialization of outer string types + /// + /// Thrown when fails to make API call + /// Input string as post body (optional) + /// Task of ApiResponse (OuterString) + public async System.Threading.Tasks.Task> FakeOuterStringSerializeAsyncWithHttpInfo (OuterString body = null) + { + + var localVarPath = "/fake/outer/string"; + var localVarPathParams = new Dictionary(); + var localVarQueryParams = new Dictionary(); + var localVarHeaderParams = new Dictionary(Configuration.DefaultHeader); + var localVarFormParams = new Dictionary(); + var localVarFileParams = new Dictionary(); + Object localVarPostBody = null; + + // to determine the Content-Type header + String[] localVarHttpContentTypes = new String[] { + }; + String localVarHttpContentType = Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); + + // to determine the Accept header + String[] localVarHttpHeaderAccepts = new String[] { + }; + String localVarHttpHeaderAccept = Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); + if (localVarHttpHeaderAccept != null) + localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); + + if (body != null && body.GetType() != typeof(byte[])) + { + localVarPostBody = Configuration.ApiClient.Serialize(body); // http body (model) parameter + } + else + { + localVarPostBody = body; // byte array + } + + + // make the HTTP request + IRestResponse localVarResponse = (IRestResponse) await Configuration.ApiClient.CallApiAsync(localVarPath, + Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, + localVarPathParams, localVarHttpContentType); + + int localVarStatusCode = (int) localVarResponse.StatusCode; + + if (ExceptionFactory != null) + { + Exception exception = ExceptionFactory("FakeOuterStringSerialize", localVarResponse); + if (exception != null) throw exception; + } + + return new ApiResponse(localVarStatusCode, + localVarResponse.Headers.ToDictionary(x => x.Name, x => x.Value.ToString()), + (OuterString) Configuration.ApiClient.Deserialize(localVarResponse, typeof(OuterString))); + + } + /// /// To test \"client\" model To test \"client\" model /// diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterBoolean.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterBoolean.cs new file mode 100644 index 00000000000..2081641d2f8 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterBoolean.cs @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterBoolean + /// + [DataContract] + [ImplementPropertyChanged] + public partial class OuterBoolean : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterBoolean() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterBoolean {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterBoolean); + } + + /// + /// Returns true if OuterBoolean instances are equal + /// + /// Instance of OuterBoolean to be compared + /// Boolean + public bool Equals(OuterBoolean other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterComposite.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterComposite.cs new file mode 100644 index 00000000000..14f8b9d756c --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterComposite.cs @@ -0,0 +1,179 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterComposite + /// + [DataContract] + [ImplementPropertyChanged] + public partial class OuterComposite : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + /// MyNumber. + /// MyString. + /// MyBoolean. + public OuterComposite(OuterNumber MyNumber = default(OuterNumber), OuterString MyString = default(OuterString), OuterBoolean MyBoolean = default(OuterBoolean)) + { + this.MyNumber = MyNumber; + this.MyString = MyString; + this.MyBoolean = MyBoolean; + } + + /// + /// Gets or Sets MyNumber + /// + [DataMember(Name="my_number", EmitDefaultValue=false)] + public OuterNumber MyNumber { get; set; } + /// + /// Gets or Sets MyString + /// + [DataMember(Name="my_string", EmitDefaultValue=false)] + public OuterString MyString { get; set; } + /// + /// Gets or Sets MyBoolean + /// + [DataMember(Name="my_boolean", EmitDefaultValue=false)] + public OuterBoolean MyBoolean { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterComposite {\n"); + sb.Append(" MyNumber: ").Append(MyNumber).Append("\n"); + sb.Append(" MyString: ").Append(MyString).Append("\n"); + sb.Append(" MyBoolean: ").Append(MyBoolean).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterComposite); + } + + /// + /// Returns true if OuterComposite instances are equal + /// + /// Instance of OuterComposite to be compared + /// Boolean + public bool Equals(OuterComposite other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return + ( + this.MyNumber == other.MyNumber || + this.MyNumber != null && + this.MyNumber.Equals(other.MyNumber) + ) && + ( + this.MyString == other.MyString || + this.MyString != null && + this.MyString.Equals(other.MyString) + ) && + ( + this.MyBoolean == other.MyBoolean || + this.MyBoolean != null && + this.MyBoolean.Equals(other.MyBoolean) + ); + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + if (this.MyNumber != null) + hash = hash * 59 + this.MyNumber.GetHashCode(); + if (this.MyString != null) + hash = hash * 59 + this.MyString.GetHashCode(); + if (this.MyBoolean != null) + hash = hash * 59 + this.MyBoolean.GetHashCode(); + return hash; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterNumber.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterNumber.cs new file mode 100644 index 00000000000..1cfdf28555a --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterNumber.cs @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterNumber + /// + [DataContract] + [ImplementPropertyChanged] + public partial class OuterNumber : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterNumber() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterNumber {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterNumber); + } + + /// + /// Returns true if OuterNumber instances are equal + /// + /// Instance of OuterNumber to be compared + /// Boolean + public bool Equals(OuterNumber other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterString.cs b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterString.cs new file mode 100644 index 00000000000..9ee02e48db8 --- /dev/null +++ b/samples/client/petstore/csharp/SwaggerClientWithPropertyChanged/src/IO.Swagger/Model/OuterString.cs @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +using System; +using System.Linq; +using System.IO; +using System.Text; +using System.Text.RegularExpressions; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Runtime.Serialization; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using PropertyChanged; +using System.ComponentModel; +using System.ComponentModel.DataAnnotations; + +namespace IO.Swagger.Model +{ + /// + /// OuterString + /// + [DataContract] + [ImplementPropertyChanged] + public partial class OuterString : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + public OuterString() + { + } + + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + var sb = new StringBuilder(); + sb.Append("class OuterString {\n"); + sb.Append("}\n"); + return sb.ToString(); + } + + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public string ToJson() + { + return JsonConvert.SerializeObject(this, Formatting.Indented); + } + + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object obj) + { + // credit: http://stackoverflow.com/a/10454552/677735 + return this.Equals(obj as OuterString); + } + + /// + /// Returns true if OuterString instances are equal + /// + /// Instance of OuterString to be compared + /// Boolean + public bool Equals(OuterString other) + { + // credit: http://stackoverflow.com/a/10454552/677735 + if (other == null) + return false; + + return false; + } + + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + // credit: http://stackoverflow.com/a/263416/677735 + unchecked // Overflow is fine, just wrap + { + int hash = 41; + // Suitable nullity checks etc, of course :) + return hash; + } + } + + /// + /// Property changed event handler + /// + public event PropertyChangedEventHandler PropertyChanged; + + /// + /// Trigger when a property changed + /// + /// Property Name + public virtual void OnPropertyChanged(string propertyName) + { + // NOTE: property changed is handled via "code weaving" using Fody. + // Properties with setters are modified at compile time to notify of changes. + var propertyChanged = PropertyChanged; + if (propertyChanged != null) + { + propertyChanged(this, new PropertyChangedEventArgs(propertyName)); + } + } + + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } + +} diff --git a/samples/client/petstore/elixir/lib/swagger_petstore/api/fake.ex b/samples/client/petstore/elixir/lib/swagger_petstore/api/fake.ex index 9698a6dd416..9537680a4a5 100644 --- a/samples/client/petstore/elixir/lib/swagger_petstore/api/fake.ex +++ b/samples/client/petstore/elixir/lib/swagger_petstore/api/fake.ex @@ -8,6 +8,82 @@ defmodule SwaggerPetstore.Api.Fake do plug Tesla.Middleware.BaseUrl, "http://petstore.swagger.io:80/v2" plug Tesla.Middleware.JSON + @doc """ + + + Test serialization of outer boolean types + """ + def fake_outer_boolean_serialize(body) do + method = [method: :post] + url = [url: "/fake/outer/boolean"] + query_params = [] + header_params = [] + body_params = [body: body] + form_params = [] + params = query_params ++ header_params ++ body_params ++ form_params + opts = [] + options = method ++ url ++ params ++ opts + + request(options) + end + + @doc """ + + + Test serialization of object with outer number type + """ + def fake_outer_composite_serialize(body) do + method = [method: :post] + url = [url: "/fake/outer/composite"] + query_params = [] + header_params = [] + body_params = [body: body] + form_params = [] + params = query_params ++ header_params ++ body_params ++ form_params + opts = [] + options = method ++ url ++ params ++ opts + + request(options) + end + + @doc """ + + + Test serialization of outer number types + """ + def fake_outer_number_serialize(body) do + method = [method: :post] + url = [url: "/fake/outer/number"] + query_params = [] + header_params = [] + body_params = [body: body] + form_params = [] + params = query_params ++ header_params ++ body_params ++ form_params + opts = [] + options = method ++ url ++ params ++ opts + + request(options) + end + + @doc """ + + + Test serialization of outer string types + """ + def fake_outer_string_serialize(body) do + method = [method: :post] + url = [url: "/fake/outer/string"] + query_params = [] + header_params = [] + body_params = [body: body] + form_params = [] + params = query_params ++ header_params ++ body_params ++ form_params + opts = [] + options = method ++ url ++ params ++ opts + + request(options) + end + @doc """ To test \"client\" model diff --git a/samples/client/petstore/elixir/lib/swagger_petstore/model/outerBoolean.ex b/samples/client/petstore/elixir/lib/swagger_petstore/model/outerBoolean.ex new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/elixir/lib/swagger_petstore/model/outerComposite.ex b/samples/client/petstore/elixir/lib/swagger_petstore/model/outerComposite.ex new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/elixir/lib/swagger_petstore/model/outerNumber.ex b/samples/client/petstore/elixir/lib/swagger_petstore/model/outerNumber.ex new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/elixir/lib/swagger_petstore/model/outerString.ex b/samples/client/petstore/elixir/lib/swagger_petstore/model/outerString.ex new file mode 100644 index 00000000000..e69de29bb2d diff --git a/samples/client/petstore/go/go-petstore/README.md b/samples/client/petstore/go/go-petstore/README.md index 90c83d951c7..4c12216fb9a 100644 --- a/samples/client/petstore/go/go-petstore/README.md +++ b/samples/client/petstore/go/go-petstore/README.md @@ -21,6 +21,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**FakeOuterBooleanSerialize**](docs/FakeApi.md#fakeouterbooleanserialize) | **Post** /fake/outer/boolean | +*FakeApi* | [**FakeOuterCompositeSerialize**](docs/FakeApi.md#fakeoutercompositeserialize) | **Post** /fake/outer/composite | +*FakeApi* | [**FakeOuterNumberSerialize**](docs/FakeApi.md#fakeouternumberserialize) | **Post** /fake/outer/number | +*FakeApi* | [**FakeOuterStringSerialize**](docs/FakeApi.md#fakeouterstringserialize) | **Post** /fake/outer/string | *FakeApi* | [**TestClientModel**](docs/FakeApi.md#testclientmodel) | **Patch** /fake | To test \"client\" model *FakeApi* | [**TestEndpointParameters**](docs/FakeApi.md#testendpointparameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**TestEnumParameters**](docs/FakeApi.md#testenumparameters) | **Get** /fake | To test enum parameters @@ -74,7 +78,11 @@ Class | Method | HTTP request | Description - [Name](docs/Name.md) - [NumberOnly](docs/NumberOnly.md) - [Order](docs/Order.md) + - [OuterBoolean](docs/OuterBoolean.md) + - [OuterComposite](docs/OuterComposite.md) - [OuterEnum](docs/OuterEnum.md) + - [OuterNumber](docs/OuterNumber.md) + - [OuterString](docs/OuterString.md) - [Pet](docs/Pet.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/go/go-petstore/docs/FakeApi.md b/samples/client/petstore/go/go-petstore/docs/FakeApi.md index 7f548bfcc57..cbc4d2edbc3 100644 --- a/samples/client/petstore/go/go-petstore/docs/FakeApi.md +++ b/samples/client/petstore/go/go-petstore/docs/FakeApi.md @@ -4,11 +4,131 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**FakeOuterBooleanSerialize**](FakeApi.md#FakeOuterBooleanSerialize) | **Post** /fake/outer/boolean | +[**FakeOuterCompositeSerialize**](FakeApi.md#FakeOuterCompositeSerialize) | **Post** /fake/outer/composite | +[**FakeOuterNumberSerialize**](FakeApi.md#FakeOuterNumberSerialize) | **Post** /fake/outer/number | +[**FakeOuterStringSerialize**](FakeApi.md#FakeOuterStringSerialize) | **Post** /fake/outer/string | [**TestClientModel**](FakeApi.md#TestClientModel) | **Patch** /fake | To test \"client\" model [**TestEndpointParameters**](FakeApi.md#TestEndpointParameters) | **Post** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**TestEnumParameters**](FakeApi.md#TestEnumParameters) | **Get** /fake | To test enum parameters +# **FakeOuterBooleanSerialize** +> OuterBoolean FakeOuterBooleanSerialize($body) + + + +Test serialization of outer boolean types + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **FakeOuterCompositeSerialize** +> OuterComposite FakeOuterCompositeSerialize($body) + + + +Test serialization of object with outer number type + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **FakeOuterNumberSerialize** +> OuterNumber FakeOuterNumberSerialize($body) + + + +Test serialization of outer number types + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **FakeOuterStringSerialize** +> OuterString FakeOuterStringSerialize($body) + + + +Test serialization of outer string types + + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **TestClientModel** > Client TestClientModel($body) diff --git a/samples/client/petstore/go/go-petstore/docs/OuterBoolean.md b/samples/client/petstore/go/go-petstore/docs/OuterBoolean.md new file mode 100644 index 00000000000..8b243399474 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/OuterBoolean.md @@ -0,0 +1,9 @@ +# OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/OuterComposite.md b/samples/client/petstore/go/go-petstore/docs/OuterComposite.md new file mode 100644 index 00000000000..14a37a86e40 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**MyNumber** | [**OuterNumber**](OuterNumber.md) | | [optional] [default to null] +**MyString** | [**OuterString**](OuterString.md) | | [optional] [default to null] +**MyBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] [default to null] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/OuterNumber.md b/samples/client/petstore/go/go-petstore/docs/OuterNumber.md new file mode 100644 index 00000000000..8aa37f329bd --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/OuterNumber.md @@ -0,0 +1,9 @@ +# OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/docs/OuterString.md b/samples/client/petstore/go/go-petstore/docs/OuterString.md new file mode 100644 index 00000000000..9ccaadaf98d --- /dev/null +++ b/samples/client/petstore/go/go-petstore/docs/OuterString.md @@ -0,0 +1,9 @@ +# OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/go/go-petstore/fake_api.go b/samples/client/petstore/go/go-petstore/fake_api.go index 9529578ab17..175f7c00aae 100644 --- a/samples/client/petstore/go/go-petstore/fake_api.go +++ b/samples/client/petstore/go/go-petstore/fake_api.go @@ -37,6 +37,250 @@ func NewFakeApiWithBasePath(basePath string) *FakeApi { } } +/** + * + * Test serialization of outer boolean types + * + * @param body Input boolean as post body + * @return *OuterBoolean + */ +func (a FakeApi) FakeOuterBooleanSerialize(body OuterBoolean) (*OuterBoolean, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/fake/outer/boolean" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(OuterBoolean) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "FakeOuterBooleanSerialize", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * Test serialization of object with outer number type + * + * @param body Input composite as post body + * @return *OuterComposite + */ +func (a FakeApi) FakeOuterCompositeSerialize(body OuterComposite) (*OuterComposite, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/fake/outer/composite" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(OuterComposite) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "FakeOuterCompositeSerialize", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * Test serialization of outer number types + * + * @param body Input number as post body + * @return *OuterNumber + */ +func (a FakeApi) FakeOuterNumberSerialize(body OuterNumber) (*OuterNumber, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/fake/outer/number" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(OuterNumber) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "FakeOuterNumberSerialize", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + +/** + * + * Test serialization of outer string types + * + * @param body Input string as post body + * @return *OuterString + */ +func (a FakeApi) FakeOuterStringSerialize(body OuterString) (*OuterString, *APIResponse, error) { + + var localVarHttpMethod = strings.ToUpper("Post") + // create path and map variables + localVarPath := a.Configuration.BasePath + "/fake/outer/string" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := make(map[string]string) + var localVarPostBody interface{} + var localVarFileName string + var localVarFileBytes []byte + // add default headers if any + for key := range a.Configuration.DefaultHeader { + localVarHeaderParams[key] = a.Configuration.DefaultHeader[key] + } + + // to determine the Content-Type header + localVarHttpContentTypes := []string{ } + + // set Content-Type header + localVarHttpContentType := a.Configuration.APIClient.SelectHeaderContentType(localVarHttpContentTypes) + if localVarHttpContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHttpContentType + } + // to determine the Accept header + localVarHttpHeaderAccepts := []string{ + } + + // set Accept header + localVarHttpHeaderAccept := a.Configuration.APIClient.SelectHeaderAccept(localVarHttpHeaderAccepts) + if localVarHttpHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHttpHeaderAccept + } + // body params + localVarPostBody = &body + var successPayload = new(OuterString) + localVarHttpResponse, err := a.Configuration.APIClient.CallAPI(localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes) + + var localVarURL, _ = url.Parse(localVarPath) + localVarURL.RawQuery = localVarQueryParams.Encode() + var localVarAPIResponse = &APIResponse{Operation: "FakeOuterStringSerialize", Method: localVarHttpMethod, RequestURL: localVarURL.String()} + if localVarHttpResponse != nil { + localVarAPIResponse.Response = localVarHttpResponse.RawResponse + localVarAPIResponse.Payload = localVarHttpResponse.Body() + } + + if err != nil { + return successPayload, localVarAPIResponse, err + } + err = json.Unmarshal(localVarHttpResponse.Body(), &successPayload) + return successPayload, localVarAPIResponse, err +} + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/go/go-petstore/outer_boolean.go b/samples/client/petstore/go/go-petstore/outer_boolean.go new file mode 100644 index 00000000000..bdd8378715a --- /dev/null +++ b/samples/client/petstore/go/go-petstore/outer_boolean.go @@ -0,0 +1,14 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package petstore + +type OuterBoolean struct { +} diff --git a/samples/client/petstore/go/go-petstore/outer_composite.go b/samples/client/petstore/go/go-petstore/outer_composite.go new file mode 100644 index 00000000000..6153ae9bbae --- /dev/null +++ b/samples/client/petstore/go/go-petstore/outer_composite.go @@ -0,0 +1,20 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package petstore + +type OuterComposite struct { + + MyNumber OuterNumber `json:"my_number,omitempty"` + + MyString OuterString `json:"my_string,omitempty"` + + MyBoolean OuterBoolean `json:"my_boolean,omitempty"` +} diff --git a/samples/client/petstore/go/go-petstore/outer_number.go b/samples/client/petstore/go/go-petstore/outer_number.go new file mode 100644 index 00000000000..c83626abd2a --- /dev/null +++ b/samples/client/petstore/go/go-petstore/outer_number.go @@ -0,0 +1,14 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package petstore + +type OuterNumber struct { +} diff --git a/samples/client/petstore/go/go-petstore/outer_string.go b/samples/client/petstore/go/go-petstore/outer_string.go new file mode 100644 index 00000000000..f1f4cf9fbe0 --- /dev/null +++ b/samples/client/petstore/go/go-petstore/outer_string.go @@ -0,0 +1,14 @@ +/* + * Swagger Petstore + * + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * Generated by: https://github.com/swagger-api/swagger-codegen.git + */ + +package petstore + +type OuterString struct { +} diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java index 77c7ae592b2..8af2dac2207 100644 --- a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/api/FakeApi.java @@ -7,6 +7,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -18,6 +19,58 @@ import feign.*; public interface FakeApi extends ApiClient.Api { + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + */ + @RequestLine("POST /fake/outer/boolean") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + Boolean fakeOuterBooleanSerialize(Boolean body); + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + */ + @RequestLine("POST /fake/outer/composite") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + OuterComposite fakeOuterCompositeSerialize(OuterComposite body); + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + */ + @RequestLine("POST /fake/outer/number") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + BigDecimal fakeOuterNumberSerialize(BigDecimal body); + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + */ + @RequestLine("POST /fake/outer/string") + @Headers({ + "Content-Type: application/json", + "Accept: application/json", + }) + String fakeOuterStringSerialize(String body); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..65d370c72f2 --- /dev/null +++ b/samples/client/petstore/java/feign/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,136 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java index 504e027829f..3f461c95f9c 100644 --- a/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java +++ b/samples/client/petstore/java/feign/src/test/java/io/swagger/client/api/FakeApiTest.java @@ -1,9 +1,21 @@ package io.swagger.client.api; +import static org.assertj.core.api.Assertions.assertThat; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; import io.swagger.client.ApiClient; +import io.swagger.client.model.OuterComposite; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import okhttp3.mockwebserver.RecordedRequest; import org.joda.time.LocalDate; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.math.BigDecimal; import org.joda.time.DateTime; +import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -18,12 +30,31 @@ import java.util.Map; public class FakeApiTest { private FakeApi api; + private MockWebServer mockServer; @Before - public void setup() { - api = new ApiClient().buildClient(FakeApi.class); + public void setup() throws IOException { + mockServer = new MockWebServer(); + mockServer.start(); + api = new ApiClient().setBasePath(mockServer.url("/").toString()).buildClient(FakeApi.class); } + @After + public void teardown() throws IOException { + mockServer.shutdown(); + } + + /** + * Extract the HTTP request body from the mock server as a String. + * @param request The mock server's request. + * @return A String representation of the body of the request. + * @throws IOException On error reading the body of the request. + */ + private static String requestBody(RecordedRequest request) throws IOException { + ByteArrayOutputStream body = new ByteArrayOutputStream((int) request.getBodySize()); + request.getBody().copyTo(body); + return body.toString(); + } /** * Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 @@ -48,5 +79,52 @@ public class FakeApiTest { // TODO: test validations } - + + @Test + public void testOuterNumber() throws Exception { + mockServer.enqueue(new MockResponse().setBody("5")); + BigDecimal response = api.fakeOuterNumberSerialize(new BigDecimal(3)); + assertThat(requestBody(mockServer.takeRequest())).isEqualTo("3"); + assertThat(response).isEqualTo(new BigDecimal(5)); + } + + @Test + public void testOuterString() throws Exception { + mockServer.enqueue(new MockResponse().setBody("\"Hello from the server\"")); + String response = api.fakeOuterStringSerialize("Hello from the client"); + assertThat(requestBody(mockServer.takeRequest())).isEqualTo("\"Hello from the client\""); + assertThat(response).isEqualTo("Hello from the server"); + } + + @Test + public void testOuterBoolean() throws Exception { + mockServer.enqueue(new MockResponse().setBody("true")); + Boolean response = api.fakeOuterBooleanSerialize(false); + assertThat(requestBody(mockServer.takeRequest())).isEqualTo("false"); + assertThat(response).isEqualTo(true); + } + + @Test + public void testOuterComposite() throws Exception { + mockServer.enqueue(new MockResponse().setBody( + "{\"my_number\": 5, \"my_string\": \"Hello from the server\", \"my_boolean\": true}")); + OuterComposite compositeRequest = new OuterComposite() + .myNumber(new BigDecimal(3)) + .myString("Hello from the client") + .myBoolean(false); + OuterComposite response = api.fakeOuterCompositeSerialize(compositeRequest); + + JsonNode requestJson = new ObjectMapper() + .readValue(requestBody(mockServer.takeRequest()), JsonNode.class); + assertThat(requestJson.fieldNames()).contains("my_number", "my_string", "my_boolean"); + assertThat(requestJson.get("my_number").intValue()).isEqualTo(3); + assertThat(requestJson.get("my_string").textValue()).isEqualTo("Hello from the client"); + assertThat(requestJson.get("my_boolean").booleanValue()).isEqualTo(false); + assertThat(response).isEqualTo( + new OuterComposite() + .myNumber(new BigDecimal(5)) + .myString("Hello from the server") + .myBoolean(true) + ); + } } diff --git a/samples/client/petstore/java/jersey1/docs/FakeApi.md b/samples/client/petstore/java/jersey1/docs/FakeApi.md index f4a6d1c0eb3..5219c541159 100644 --- a/samples/client/petstore/java/jersey1/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey1/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/jersey1/docs/OuterComposite.md b/samples/client/petstore/java/jersey1/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/jersey1/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java index db1a0e3c2ef..50ee9980a73 100644 --- a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/api/FakeApi.java @@ -24,6 +24,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; @@ -51,6 +52,150 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + */ + public String fakeOuterStringSerialize(String body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..65d370c72f2 --- /dev/null +++ b/samples/client/petstore/java/jersey1/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,136 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md index f4a6d1c0eb3..5219c541159 100644 --- a/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java6/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/jersey2-java6/docs/OuterComposite.md b/samples/client/petstore/java/jersey2-java6/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java index a8c2ebfa2b7..dd91d025eee 100644 --- a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/api/FakeApi.java @@ -11,6 +11,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -37,6 +38,150 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + */ + public String fakeOuterStringSerialize(String body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..51d9a3c47ef --- /dev/null +++ b/samples/client/petstore/java/jersey2-java6/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,136 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import org.apache.commons.lang3.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return ObjectUtils.equals(this.myNumber, outerComposite.myNumber) && + ObjectUtils.equals(this.myString, outerComposite.myString) && + ObjectUtils.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return ObjectUtils.hashCodeMulti(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md index 01dcb19a054..87e4b69c8e2 100644 --- a/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2-java8/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/jersey2-java8/docs/OuterComposite.md b/samples/client/petstore/java/jersey2-java8/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java index 974daecfc97..0e76aa22374 100644 --- a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/api/FakeApi.java @@ -11,6 +11,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import java.time.LocalDate; import java.time.OffsetDateTime; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -37,6 +38,150 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + */ + public String fakeOuterStringSerialize(String body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..65d370c72f2 --- /dev/null +++ b/samples/client/petstore/java/jersey2-java8/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,136 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/jersey2/docs/FakeApi.md b/samples/client/petstore/java/jersey2/docs/FakeApi.md index f4a6d1c0eb3..5219c541159 100644 --- a/samples/client/petstore/java/jersey2/docs/FakeApi.md +++ b/samples/client/petstore/java/jersey2/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/jersey2/docs/OuterComposite.md b/samples/client/petstore/java/jersey2/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/jersey2/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java index a8c2ebfa2b7..dd91d025eee 100644 --- a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/api/FakeApi.java @@ -11,6 +11,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -37,6 +38,150 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException if fails to make API call + */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException if fails to make API call + */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException if fails to make API call + */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException if fails to make API call + */ + public String fakeOuterStringSerialize(String body) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + // query params + List localVarQueryParams = new ArrayList(); + Map localVarHeaderParams = new HashMap(); + Map localVarFormParams = new HashMap(); + + + + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + + String[] localVarAuthNames = new String[] { }; + + GenericType localVarReturnType = new GenericType() {}; + return apiClient.invokeAPI(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType); + } /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..65d370c72f2 --- /dev/null +++ b/samples/client/petstore/java/jersey2/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,136 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md index f4a6d1c0eb3..5219c541159 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java index 81d39fcedba..85436b62d3a 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/api/FakeApi.java @@ -31,6 +31,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.lang.reflect.Type; import java.util.ArrayList; @@ -57,6 +58,486 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterBooleanSerializeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterBooleanSerializeValidateBeforeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterBooleanSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + ApiResponse resp = fakeOuterBooleanSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterBooleanSerializeAsync(Boolean body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param body Input composite as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterCompositeSerializeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterCompositeSerializeValidateBeforeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterCompositeSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + ApiResponse resp = fakeOuterCompositeSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterCompositeSerializeAsync(OuterComposite body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterNumberSerializeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterNumberSerializeValidateBeforeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterNumberSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + ApiResponse resp = fakeOuterNumberSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterNumberSerializeAsync(BigDecimal body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterStringSerializeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterStringSerializeValidateBeforeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterStringSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public String fakeOuterStringSerialize(String body) throws ApiException { + ApiResponse resp = fakeOuterStringSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterStringSerializeAsync(String body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } /** * Build call for testClientModel * @param body client model (required) diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..109b7793d31 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,169 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import android.os.Parcelable; +import android.os.Parcel; + +/** + * OuterComposite + */ + +public class OuterComposite implements Parcelable { + @SerializedName("my_number") + private BigDecimal myNumber = null; + + @SerializedName("my_string") + private String myString = null; + + @SerializedName("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + public void writeToParcel(Parcel out, int flags) { + + out.writeValue(myNumber); + + out.writeValue(myString); + + out.writeValue(myBoolean); + } + + public OuterComposite() { + super(); + } + + OuterComposite(Parcel in) { + + myNumber = (BigDecimal)in.readValue(null); + myString = (String)in.readValue(null); + myBoolean = (Boolean)in.readValue(null); + } + + public int describeContents() { + return 0; + } + + public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public OuterComposite createFromParcel(Parcel in) { + return new OuterComposite(in); + } + public OuterComposite[] newArray(int size) { + return new OuterComposite[size]; + } + }; +} + diff --git a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md index f4a6d1c0eb3..5219c541159 100644 --- a/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md +++ b/samples/client/petstore/java/okhttp-gson/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/okhttp-gson/docs/OuterComposite.md b/samples/client/petstore/java/okhttp-gson/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java index 81d39fcedba..85436b62d3a 100644 --- a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/api/FakeApi.java @@ -31,6 +31,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.lang.reflect.Type; import java.util.ArrayList; @@ -57,6 +58,486 @@ public class FakeApi { this.apiClient = apiClient; } + /** + * Build call for fakeOuterBooleanSerialize + * @param body Input boolean as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterBooleanSerializeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/boolean"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterBooleanSerializeValidateBeforeCall(Boolean body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterBooleanSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public Boolean fakeOuterBooleanSerialize(Boolean body) throws ApiException { + ApiResponse resp = fakeOuterBooleanSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return ApiResponse<Boolean> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterBooleanSerializeWithHttpInfo(Boolean body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterBooleanSerializeAsync(Boolean body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterBooleanSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for fakeOuterCompositeSerialize + * @param body Input composite as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterCompositeSerializeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/composite"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterCompositeSerializeValidateBeforeCall(OuterComposite body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterCompositeSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) throws ApiException { + ApiResponse resp = fakeOuterCompositeSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return ApiResponse<OuterComposite> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterCompositeSerializeWithHttpInfo(OuterComposite body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterCompositeSerializeAsync(OuterComposite body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterCompositeSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for fakeOuterNumberSerialize + * @param body Input number as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterNumberSerializeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/number"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterNumberSerializeValidateBeforeCall(BigDecimal body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterNumberSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) throws ApiException { + ApiResponse resp = fakeOuterNumberSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return ApiResponse<BigDecimal> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterNumberSerializeWithHttpInfo(BigDecimal body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterNumberSerializeAsync(BigDecimal body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterNumberSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } + /** + * Build call for fakeOuterStringSerialize + * @param body Input string as post body (optional) + * @param progressListener Progress listener + * @param progressRequestListener Progress request listener + * @return Call to execute + * @throws ApiException If fail to serialize the request body object + */ + public com.squareup.okhttp.Call fakeOuterStringSerializeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + Object localVarPostBody = body; + + // create path and map variables + String localVarPath = "/fake/outer/string"; + + List localVarQueryParams = new ArrayList(); + + Map localVarHeaderParams = new HashMap(); + + Map localVarFormParams = new HashMap(); + + final String[] localVarAccepts = { + + }; + final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts); + if (localVarAccept != null) localVarHeaderParams.put("Accept", localVarAccept); + + final String[] localVarContentTypes = { + + }; + final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes); + localVarHeaderParams.put("Content-Type", localVarContentType); + + if(progressListener != null) { + apiClient.getHttpClient().networkInterceptors().add(new com.squareup.okhttp.Interceptor() { + @Override + public com.squareup.okhttp.Response intercept(com.squareup.okhttp.Interceptor.Chain chain) throws IOException { + com.squareup.okhttp.Response originalResponse = chain.proceed(chain.request()); + return originalResponse.newBuilder() + .body(new ProgressResponseBody(originalResponse.body(), progressListener)) + .build(); + } + }); + } + + String[] localVarAuthNames = new String[] { }; + return apiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAuthNames, progressRequestListener); + } + + @SuppressWarnings("rawtypes") + private com.squareup.okhttp.Call fakeOuterStringSerializeValidateBeforeCall(String body, final ProgressResponseBody.ProgressListener progressListener, final ProgressRequestBody.ProgressRequestListener progressRequestListener) throws ApiException { + + + com.squareup.okhttp.Call call = fakeOuterStringSerializeCall(body, progressListener, progressRequestListener); + return call; + + + + + + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public String fakeOuterStringSerialize(String body) throws ApiException { + ApiResponse resp = fakeOuterStringSerializeWithHttpInfo(body); + return resp.getData(); + } + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return ApiResponse<String> + * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body + */ + public ApiResponse fakeOuterStringSerializeWithHttpInfo(String body) throws ApiException { + com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, null, null); + Type localVarReturnType = new TypeToken(){}.getType(); + return apiClient.execute(call, localVarReturnType); + } + + /** + * (asynchronously) + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @param callback The callback to be executed when the API call finishes + * @return The request call + * @throws ApiException If fail to process the API call, e.g. serializing the request body object + */ + public com.squareup.okhttp.Call fakeOuterStringSerializeAsync(String body, final ApiCallback callback) throws ApiException { + + ProgressResponseBody.ProgressListener progressListener = null; + ProgressRequestBody.ProgressRequestListener progressRequestListener = null; + + if (callback != null) { + progressListener = new ProgressResponseBody.ProgressListener() { + @Override + public void update(long bytesRead, long contentLength, boolean done) { + callback.onDownloadProgress(bytesRead, contentLength, done); + } + }; + + progressRequestListener = new ProgressRequestBody.ProgressRequestListener() { + @Override + public void onRequestProgress(long bytesWritten, long contentLength, boolean done) { + callback.onUploadProgress(bytesWritten, contentLength, done); + } + }; + } + + com.squareup.okhttp.Call call = fakeOuterStringSerializeValidateBeforeCall(body, progressListener, progressRequestListener); + Type localVarReturnType = new TypeToken(){}.getType(); + apiClient.executeAsync(call, localVarReturnType, callback); + return call; + } /** * Build call for testClientModel * @param body client model (required) diff --git a/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..85c5f2e3c65 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @SerializedName("my_number") + private BigDecimal myNumber = null; + + @SerializedName("my_string") + private String myString = null; + + @SerializedName("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java index 67eb33f195e..1300721375a 100644 --- a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/api/FakeApi.java @@ -10,6 +10,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -17,6 +18,102 @@ import java.util.List; import java.util.Map; public interface FakeApi { + /** + * + * Sync method + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Boolean + */ + + @POST("/fake/outer/boolean") + Boolean fakeOuterBooleanSerialize( + @retrofit.http.Body Boolean body + ); + + /** + * + * Async method + * @param body Input boolean as post body (optional) + * @param cb callback method + */ + + @POST("/fake/outer/boolean") + void fakeOuterBooleanSerialize( + @retrofit.http.Body Boolean body, Callback cb + ); + /** + * + * Sync method + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return OuterComposite + */ + + @POST("/fake/outer/composite") + OuterComposite fakeOuterCompositeSerialize( + @retrofit.http.Body OuterComposite body + ); + + /** + * + * Async method + * @param body Input composite as post body (optional) + * @param cb callback method + */ + + @POST("/fake/outer/composite") + void fakeOuterCompositeSerialize( + @retrofit.http.Body OuterComposite body, Callback cb + ); + /** + * + * Sync method + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return BigDecimal + */ + + @POST("/fake/outer/number") + BigDecimal fakeOuterNumberSerialize( + @retrofit.http.Body BigDecimal body + ); + + /** + * + * Async method + * @param body Input number as post body (optional) + * @param cb callback method + */ + + @POST("/fake/outer/number") + void fakeOuterNumberSerialize( + @retrofit.http.Body BigDecimal body, Callback cb + ); + /** + * + * Sync method + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return String + */ + + @POST("/fake/outer/string") + String fakeOuterStringSerialize( + @retrofit.http.Body String body + ); + + /** + * + * Async method + * @param body Input string as post body (optional) + * @param cb callback method + */ + + @POST("/fake/outer/string") + void fakeOuterStringSerialize( + @retrofit.http.Body String body, Callback cb + ); /** * To test \"client\" model * Sync method diff --git a/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..85c5f2e3c65 --- /dev/null +++ b/samples/client/petstore/java/retrofit/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @SerializedName("my_number") + private BigDecimal myNumber = null; + + @SerializedName("my_string") + private String myString = null; + + @SerializedName("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md index b1cef72e11f..2bc252c751f 100644 --- a/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2-play24/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2-play24/docs/OuterComposite.md b/samples/client/petstore/java/retrofit2-play24/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java index 05c6ba8da52..0b37671fb54 100644 --- a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/api/FakeApi.java @@ -13,6 +13,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -23,6 +24,50 @@ import play.libs.F; import retrofit2.Response; public interface FakeApi { + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Call<Boolean> + */ + @POST("fake/outer/boolean") + F.Promise> fakeOuterBooleanSerialize( + @retrofit2.http.Body Boolean body + ); + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return Call<OuterComposite> + */ + @POST("fake/outer/composite") + F.Promise> fakeOuterCompositeSerialize( + @retrofit2.http.Body OuterComposite body + ); + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return Call<BigDecimal> + */ + @POST("fake/outer/number") + F.Promise> fakeOuterNumberSerialize( + @retrofit2.http.Body BigDecimal body + ); + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return Call<String> + */ + @POST("fake/outer/string") + F.Promise> fakeOuterStringSerialize( + @retrofit2.http.Body String body + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..6cb9cb2930e --- /dev/null +++ b/samples/client/petstore/java/retrofit2-play24/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,137 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2/docs/FakeApi.md index b1cef72e11f..2bc252c751f 100644 --- a/samples/client/petstore/java/retrofit2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2/docs/OuterComposite.md b/samples/client/petstore/java/retrofit2/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java index e62a0825b0b..e19cdb60233 100644 --- a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/api/FakeApi.java @@ -13,6 +13,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -21,6 +22,50 @@ import java.util.Map; public interface FakeApi { + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Call<Boolean> + */ + @POST("fake/outer/boolean") + Call fakeOuterBooleanSerialize( + @retrofit2.http.Body Boolean body + ); + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return Call<OuterComposite> + */ + @POST("fake/outer/composite") + Call fakeOuterCompositeSerialize( + @retrofit2.http.Body OuterComposite body + ); + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return Call<BigDecimal> + */ + @POST("fake/outer/number") + Call fakeOuterNumberSerialize( + @retrofit2.http.Body BigDecimal body + ); + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return Call<String> + */ + @POST("fake/outer/string") + Call fakeOuterStringSerialize( + @retrofit2.http.Body String body + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..85c5f2e3c65 --- /dev/null +++ b/samples/client/petstore/java/retrofit2/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @SerializedName("my_number") + private BigDecimal myNumber = null; + + @SerializedName("my_string") + private String myString = null; + + @SerializedName("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md index b1cef72e11f..2bc252c751f 100644 --- a/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2rx/docs/OuterComposite.md b/samples/client/petstore/java/retrofit2rx/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java index 16f75c85e08..02cf8cd1c13 100644 --- a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/api/FakeApi.java @@ -13,6 +13,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -21,6 +22,50 @@ import java.util.Map; public interface FakeApi { + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Call<Boolean> + */ + @POST("fake/outer/boolean") + Observable fakeOuterBooleanSerialize( + @retrofit2.http.Body Boolean body + ); + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return Call<OuterComposite> + */ + @POST("fake/outer/composite") + Observable fakeOuterCompositeSerialize( + @retrofit2.http.Body OuterComposite body + ); + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return Call<BigDecimal> + */ + @POST("fake/outer/number") + Observable fakeOuterNumberSerialize( + @retrofit2.http.Body BigDecimal body + ); + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return Call<String> + */ + @POST("fake/outer/string") + Observable fakeOuterStringSerialize( + @retrofit2.http.Body String body + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..85c5f2e3c65 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @SerializedName("my_number") + private BigDecimal myNumber = null; + + @SerializedName("my_string") + private String myString = null; + + @SerializedName("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md index b1cef72e11f..2bc252c751f 100644 --- a/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md +++ b/samples/client/petstore/java/retrofit2rx2/docs/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> Boolean fakeOuterBooleanSerialize(body) + + + +Test serialization of outer boolean types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +Boolean body = true; // Boolean | Input boolean as post body +try { + Boolean result = apiInstance.fakeOuterBooleanSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterBooleanSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**Boolean**](Boolean.md)| Input boolean as post body | [optional] + +### Return type + +**Boolean** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(body) + + + +Test serialization of object with outer number type + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +OuterComposite body = new OuterComposite(); // OuterComposite | Input composite as post body +try { + OuterComposite result = apiInstance.fakeOuterCompositeSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterCompositeSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> BigDecimal fakeOuterNumberSerialize(body) + + + +Test serialization of outer number types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body +try { + BigDecimal result = apiInstance.fakeOuterNumberSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterNumberSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**BigDecimal**](BigDecimal.md)| Input number as post body | [optional] + +### Return type + +[**BigDecimal**](BigDecimal.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> String fakeOuterStringSerialize(body) + + + +Test serialization of outer string types + +### Example +```java +// Import classes: +//import io.swagger.client.ApiException; +//import io.swagger.client.api.FakeApi; + + +FakeApi apiInstance = new FakeApi(); +String body = "body_example"; // String | Input string as post body +try { + String result = apiInstance.fakeOuterStringSerialize(body); + System.out.println(result); +} catch (ApiException e) { + System.err.println("Exception when calling FakeApi#fakeOuterStringSerialize"); + e.printStackTrace(); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**String**](String.md)| Input string as post body | [optional] + +### Return type + +**String** + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/java/retrofit2rx2/docs/OuterComposite.md b/samples/client/petstore/java/retrofit2rx2/docs/OuterComposite.md new file mode 100644 index 00000000000..3f5a633c998 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/docs/OuterComposite.md @@ -0,0 +1,12 @@ + +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**BigDecimal**](BigDecimal.md) | | [optional] +**myString** | **String** | | [optional] +**myBoolean** | **Boolean** | | [optional] + + + diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java index 9fb95265bd1..5af507ccd34 100644 --- a/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/api/FakeApi.java @@ -13,6 +13,7 @@ import java.math.BigDecimal; import io.swagger.client.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.client.model.OuterComposite; import java.util.ArrayList; import java.util.HashMap; @@ -21,6 +22,50 @@ import java.util.Map; public interface FakeApi { + /** + * + * Test serialization of outer boolean types + * @param body Input boolean as post body (optional) + * @return Call<Boolean> + */ + @POST("fake/outer/boolean") + Observable fakeOuterBooleanSerialize( + @retrofit2.http.Body Boolean body + ); + + /** + * + * Test serialization of object with outer number type + * @param body Input composite as post body (optional) + * @return Call<OuterComposite> + */ + @POST("fake/outer/composite") + Observable fakeOuterCompositeSerialize( + @retrofit2.http.Body OuterComposite body + ); + + /** + * + * Test serialization of outer number types + * @param body Input number as post body (optional) + * @return Call<BigDecimal> + */ + @POST("fake/outer/number") + Observable fakeOuterNumberSerialize( + @retrofit2.http.Body BigDecimal body + ); + + /** + * + * Test serialization of outer string types + * @param body Input string as post body (optional) + * @return Call<String> + */ + @POST("fake/outer/string") + Observable fakeOuterStringSerialize( + @retrofit2.http.Body String body + ); + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/model/OuterComposite.java b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/model/OuterComposite.java new file mode 100644 index 00000000000..85c5f2e3c65 --- /dev/null +++ b/samples/client/petstore/java/retrofit2rx2/src/main/java/io/swagger/client/model/OuterComposite.java @@ -0,0 +1,135 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.client.model; + +import java.util.Objects; +import com.google.gson.annotations.SerializedName; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @SerializedName("my_number") + private BigDecimal myNumber = null; + + @SerializedName("my_string") + private String myString = null; + + @SerializedName("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + +} + diff --git a/samples/client/petstore/javascript-promise/README.md b/samples/client/petstore/javascript-promise/README.md index ab8caef7b02..cb0b9f33e03 100644 --- a/samples/client/petstore/javascript-promise/README.md +++ b/samples/client/petstore/javascript-promise/README.md @@ -54,9 +54,10 @@ var SwaggerPetstore = require('swagger_petstore'); var api = new SwaggerPetstore.FakeApi() -var body = new SwaggerPetstore.Client(); // {Client} client model - -api.testClientModel(body).then(function(data) { +var opts = { + 'body': new SwaggerPetstore.OuterBoolean() // {OuterBoolean} Input boolean as post body +}; +api.fakeOuterBooleanSerialize(opts).then(function(data) { console.log('API called successfully. Returned data: ' + data); }, function(error) { console.error(error); @@ -71,6 +72,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*SwaggerPetstore.FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*SwaggerPetstore.FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +*SwaggerPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +*SwaggerPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *SwaggerPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model *SwaggerPetstore.FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *SwaggerPetstore.FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -124,7 +129,11 @@ Class | Method | HTTP request | Description - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.NumberOnly](docs/NumberOnly.md) - [SwaggerPetstore.Order](docs/Order.md) + - [SwaggerPetstore.OuterBoolean](docs/OuterBoolean.md) + - [SwaggerPetstore.OuterComposite](docs/OuterComposite.md) - [SwaggerPetstore.OuterEnum](docs/OuterEnum.md) + - [SwaggerPetstore.OuterNumber](docs/OuterNumber.md) + - [SwaggerPetstore.OuterString](docs/OuterString.md) - [SwaggerPetstore.Pet](docs/Pet.md) - [SwaggerPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/javascript-promise/docs/FakeApi.md b/samples/client/petstore/javascript-promise/docs/FakeApi.md index a6ff5402cec..7bfea4df889 100644 --- a/samples/client/petstore/javascript-promise/docs/FakeApi.md +++ b/samples/client/petstore/javascript-promise/docs/FakeApi.md @@ -4,11 +4,191 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> OuterBoolean fakeOuterBooleanSerialize(opts) + + + +Test serialization of outer boolean types + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterBoolean() // OuterBoolean | Input boolean as post body +}; +apiInstance.fakeOuterBooleanSerialize(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(opts) + + + +Test serialization of object with outer number type + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterComposite() // OuterComposite | Input composite as post body +}; +apiInstance.fakeOuterCompositeSerialize(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> OuterNumber fakeOuterNumberSerialize(opts) + + + +Test serialization of outer number types + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterNumber() // OuterNumber | Input number as post body +}; +apiInstance.fakeOuterNumberSerialize(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> OuterString fakeOuterStringSerialize(opts) + + + +Test serialization of outer string types + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterString() // OuterString | Input string as post body +}; +apiInstance.fakeOuterStringSerialize(opts).then(function(data) { + console.log('API called successfully. Returned data: ' + data); +}, function(error) { + console.error(error); +}); + +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/javascript-promise/docs/OuterBoolean.md b/samples/client/petstore/javascript-promise/docs/OuterBoolean.md new file mode 100644 index 00000000000..61ea0d56615 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/OuterBoolean.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript-promise/docs/OuterComposite.md b/samples/client/petstore/javascript-promise/docs/OuterComposite.md new file mode 100644 index 00000000000..e4cb57f35af --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/OuterComposite.md @@ -0,0 +1,10 @@ +# SwaggerPetstore.OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**OuterNumber**](OuterNumber.md) | | [optional] +**myString** | [**OuterString**](OuterString.md) | | [optional] +**myBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + + diff --git a/samples/client/petstore/javascript-promise/docs/OuterNumber.md b/samples/client/petstore/javascript-promise/docs/OuterNumber.md new file mode 100644 index 00000000000..efbbfa83535 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/OuterNumber.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript-promise/docs/OuterString.md b/samples/client/petstore/javascript-promise/docs/OuterString.md new file mode 100644 index 00000000000..22eba5351a9 --- /dev/null +++ b/samples/client/petstore/javascript-promise/docs/OuterString.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript-promise/src/api/FakeApi.js b/samples/client/petstore/javascript-promise/src/api/FakeApi.js index 812335af9c3..5d02c0d220f 100644 --- a/samples/client/petstore/javascript-promise/src/api/FakeApi.js +++ b/samples/client/petstore/javascript-promise/src/api/FakeApi.js @@ -17,18 +17,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Client'], factory); + define(['ApiClient', 'model/Client', 'model/OuterBoolean', 'model/OuterComposite', 'model/OuterNumber', 'model/OuterString'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Client')); + module.exports = factory(require('../ApiClient'), require('../model/Client'), require('../model/OuterBoolean'), require('../model/OuterComposite'), require('../model/OuterNumber'), require('../model/OuterString')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client); + root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client, root.SwaggerPetstore.OuterBoolean, root.SwaggerPetstore.OuterComposite, root.SwaggerPetstore.OuterNumber, root.SwaggerPetstore.OuterString); } -}(this, function(ApiClient, Client) { +}(this, function(ApiClient, Client, OuterBoolean, OuterComposite, OuterNumber, OuterString) { 'use strict'; /** @@ -49,6 +49,190 @@ + /** + * Test serialization of outer boolean types + * @param {Object} opts Optional parameters + * @param {module:model/OuterBoolean} opts.body Input boolean as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterBoolean} and HTTP response + */ + this.fakeOuterBooleanSerializeWithHttpInfo = function(opts) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterBoolean; + + return this.apiClient.callApi( + '/fake/outer/boolean', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * Test serialization of outer boolean types + * @param {Object} opts Optional parameters + * @param {module:model/OuterBoolean} opts.body Input boolean as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterBoolean} + */ + this.fakeOuterBooleanSerialize = function(opts) { + return this.fakeOuterBooleanSerializeWithHttpInfo(opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + + /** + * Test serialization of object with outer number type + * @param {Object} opts Optional parameters + * @param {module:model/OuterComposite} opts.body Input composite as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterComposite} and HTTP response + */ + this.fakeOuterCompositeSerializeWithHttpInfo = function(opts) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterComposite; + + return this.apiClient.callApi( + '/fake/outer/composite', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * Test serialization of object with outer number type + * @param {Object} opts Optional parameters + * @param {module:model/OuterComposite} opts.body Input composite as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterComposite} + */ + this.fakeOuterCompositeSerialize = function(opts) { + return this.fakeOuterCompositeSerializeWithHttpInfo(opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + + /** + * Test serialization of outer number types + * @param {Object} opts Optional parameters + * @param {module:model/OuterNumber} opts.body Input number as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterNumber} and HTTP response + */ + this.fakeOuterNumberSerializeWithHttpInfo = function(opts) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterNumber; + + return this.apiClient.callApi( + '/fake/outer/number', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * Test serialization of outer number types + * @param {Object} opts Optional parameters + * @param {module:model/OuterNumber} opts.body Input number as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterNumber} + */ + this.fakeOuterNumberSerialize = function(opts) { + return this.fakeOuterNumberSerializeWithHttpInfo(opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + + /** + * Test serialization of outer string types + * @param {Object} opts Optional parameters + * @param {module:model/OuterString} opts.body Input string as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OuterString} and HTTP response + */ + this.fakeOuterStringSerializeWithHttpInfo = function(opts) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterString; + + return this.apiClient.callApi( + '/fake/outer/string', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType + ); + } + + /** + * Test serialization of outer string types + * @param {Object} opts Optional parameters + * @param {module:model/OuterString} opts.body Input string as post body + * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OuterString} + */ + this.fakeOuterStringSerialize = function(opts) { + return this.fakeOuterStringSerializeWithHttpInfo(opts) + .then(function(response_and_data) { + return response_and_data.data; + }); + } + + /** * To test \"client\" model * To test \"client\" model diff --git a/samples/client/petstore/javascript-promise/src/index.js b/samples/client/petstore/javascript-promise/src/index.js index bf7d2f62383..974962007e5 100644 --- a/samples/client/petstore/javascript-promise/src/index.js +++ b/samples/client/petstore/javascript-promise/src/index.js @@ -17,12 +17,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Capitalization', 'model/Cat', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterEnum', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); + define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Capitalization', 'model/Cat', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterBoolean', 'model/OuterComposite', 'model/OuterEnum', 'model/OuterNumber', 'model/OuterString', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Capitalization'), require('./model/Cat'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterEnum'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Capitalization'), require('./model/Cat'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterBoolean'), require('./model/OuterComposite'), require('./model/OuterEnum'), require('./model/OuterNumber'), require('./model/OuterString'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Capitalization, Cat, Category, ClassModel, Client, Dog, EnumArrays, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterEnum, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { +}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Capitalization, Cat, Category, ClassModel, Client, Dog, EnumArrays, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterBoolean, OuterComposite, OuterEnum, OuterNumber, OuterString, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -192,11 +192,31 @@ * @property {module:model/Order} */ Order: Order, + /** + * The OuterBoolean model constructor. + * @property {module:model/OuterBoolean} + */ + OuterBoolean: OuterBoolean, + /** + * The OuterComposite model constructor. + * @property {module:model/OuterComposite} + */ + OuterComposite: OuterComposite, /** * The OuterEnum model constructor. * @property {module:model/OuterEnum} */ OuterEnum: OuterEnum, + /** + * The OuterNumber model constructor. + * @property {module:model/OuterNumber} + */ + OuterNumber: OuterNumber, + /** + * The OuterString model constructor. + * @property {module:model/OuterString} + */ + OuterString: OuterString, /** * The Pet model constructor. * @property {module:model/Pet} diff --git a/samples/client/petstore/javascript-promise/src/model/OuterBoolean.js b/samples/client/petstore/javascript-promise/src/model/OuterBoolean.js new file mode 100644 index 00000000000..a900c5d2ef2 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/OuterBoolean.js @@ -0,0 +1,71 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterBoolean = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The OuterBoolean model module. + * @module model/OuterBoolean + * @version 1.0.0 + */ + + /** + * Constructs a new OuterBoolean. + * @alias module:model/OuterBoolean + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a OuterBoolean from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterBoolean} obj Optional instance to populate. + * @return {module:model/OuterBoolean} The populated OuterBoolean instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + } + return obj; + } + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/OuterComposite.js b/samples/client/petstore/javascript-promise/src/model/OuterComposite.js new file mode 100644 index 00000000000..bcb6632d409 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/OuterComposite.js @@ -0,0 +1,95 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient', 'model/OuterBoolean', 'model/OuterNumber', 'model/OuterString'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./OuterBoolean'), require('./OuterNumber'), require('./OuterString')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterComposite = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.OuterBoolean, root.SwaggerPetstore.OuterNumber, root.SwaggerPetstore.OuterString); + } +}(this, function(ApiClient, OuterBoolean, OuterNumber, OuterString) { + 'use strict'; + + + + + /** + * The OuterComposite model module. + * @module model/OuterComposite + * @version 1.0.0 + */ + + /** + * Constructs a new OuterComposite. + * @alias module:model/OuterComposite + * @class + */ + var exports = function() { + var _this = this; + + + + + }; + + /** + * Constructs a OuterComposite from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterComposite} obj Optional instance to populate. + * @return {module:model/OuterComposite} The populated OuterComposite instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('my_number')) { + obj['my_number'] = OuterNumber.constructFromObject(data['my_number']); + } + if (data.hasOwnProperty('my_string')) { + obj['my_string'] = OuterString.constructFromObject(data['my_string']); + } + if (data.hasOwnProperty('my_boolean')) { + obj['my_boolean'] = OuterBoolean.constructFromObject(data['my_boolean']); + } + } + return obj; + } + + /** + * @member {module:model/OuterNumber} my_number + */ + exports.prototype['my_number'] = undefined; + /** + * @member {module:model/OuterString} my_string + */ + exports.prototype['my_string'] = undefined; + /** + * @member {module:model/OuterBoolean} my_boolean + */ + exports.prototype['my_boolean'] = undefined; + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/OuterNumber.js b/samples/client/petstore/javascript-promise/src/model/OuterNumber.js new file mode 100644 index 00000000000..f6049e64974 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/OuterNumber.js @@ -0,0 +1,71 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterNumber = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The OuterNumber model module. + * @module model/OuterNumber + * @version 1.0.0 + */ + + /** + * Constructs a new OuterNumber. + * @alias module:model/OuterNumber + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a OuterNumber from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterNumber} obj Optional instance to populate. + * @return {module:model/OuterNumber} The populated OuterNumber instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + } + return obj; + } + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/src/model/OuterString.js b/samples/client/petstore/javascript-promise/src/model/OuterString.js new file mode 100644 index 00000000000..c2f9e4f2f74 --- /dev/null +++ b/samples/client/petstore/javascript-promise/src/model/OuterString.js @@ -0,0 +1,71 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterString = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The OuterString model module. + * @module model/OuterString + * @version 1.0.0 + */ + + /** + * Constructs a new OuterString. + * @alias module:model/OuterString + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a OuterString from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterString} obj Optional instance to populate. + * @return {module:model/OuterString} The populated OuterString instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + } + return obj; + } + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript-promise/test/model/OuterBoolean.spec.js b/samples/client/petstore/javascript-promise/test/model/OuterBoolean.spec.js new file mode 100644 index 00000000000..d5495a638d8 --- /dev/null +++ b/samples/client/petstore/javascript-promise/test/model/OuterBoolean.spec.js @@ -0,0 +1,59 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterBoolean(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterBoolean', function() { + it('should create an instance of OuterBoolean', function() { + // uncomment below and update the code to test OuterBoolean + //var instane = new SwaggerPetstore.OuterBoolean(); + //expect(instance).to.be.a(SwaggerPetstore.OuterBoolean); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-promise/test/model/OuterComposite.spec.js b/samples/client/petstore/javascript-promise/test/model/OuterComposite.spec.js new file mode 100644 index 00000000000..6fd830b7c0e --- /dev/null +++ b/samples/client/petstore/javascript-promise/test/model/OuterComposite.spec.js @@ -0,0 +1,77 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterComposite(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterComposite', function() { + it('should create an instance of OuterComposite', function() { + // uncomment below and update the code to test OuterComposite + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be.a(SwaggerPetstore.OuterComposite); + }); + + it('should have the property myNumber (base name: "my_number")', function() { + // uncomment below and update the code to test the property myNumber + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be(); + }); + + it('should have the property myString (base name: "my_string")', function() { + // uncomment below and update the code to test the property myString + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be(); + }); + + it('should have the property myBoolean (base name: "my_boolean")', function() { + // uncomment below and update the code to test the property myBoolean + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-promise/test/model/OuterNumber.spec.js b/samples/client/petstore/javascript-promise/test/model/OuterNumber.spec.js new file mode 100644 index 00000000000..7b0e4ebf119 --- /dev/null +++ b/samples/client/petstore/javascript-promise/test/model/OuterNumber.spec.js @@ -0,0 +1,59 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterNumber(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterNumber', function() { + it('should create an instance of OuterNumber', function() { + // uncomment below and update the code to test OuterNumber + //var instane = new SwaggerPetstore.OuterNumber(); + //expect(instance).to.be.a(SwaggerPetstore.OuterNumber); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript-promise/test/model/OuterString.spec.js b/samples/client/petstore/javascript-promise/test/model/OuterString.spec.js new file mode 100644 index 00000000000..4e7f99ca88d --- /dev/null +++ b/samples/client/petstore/javascript-promise/test/model/OuterString.spec.js @@ -0,0 +1,59 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterString(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterString', function() { + it('should create an instance of OuterString', function() { + // uncomment below and update the code to test OuterString + //var instane = new SwaggerPetstore.OuterString(); + //expect(instance).to.be.a(SwaggerPetstore.OuterString); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript/README.md b/samples/client/petstore/javascript/README.md index 065bf4f1ca4..06707681374 100644 --- a/samples/client/petstore/javascript/README.md +++ b/samples/client/petstore/javascript/README.md @@ -54,8 +54,9 @@ var SwaggerPetstore = require('swagger_petstore'); var api = new SwaggerPetstore.FakeApi() -var body = new SwaggerPetstore.Client(); // {Client} client model - +var opts = { + 'body': new SwaggerPetstore.OuterBoolean() // {OuterBoolean} Input boolean as post body +}; var callback = function(error, data, response) { if (error) { @@ -64,7 +65,7 @@ var callback = function(error, data, response) { console.log('API called successfully. Returned data: ' + data); } }; -api.testClientModel(body, callback); +api.fakeOuterBooleanSerialize(opts, callback); ``` @@ -74,6 +75,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*SwaggerPetstore.FakeApi* | [**fakeOuterBooleanSerialize**](docs/FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +*SwaggerPetstore.FakeApi* | [**fakeOuterCompositeSerialize**](docs/FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +*SwaggerPetstore.FakeApi* | [**fakeOuterNumberSerialize**](docs/FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +*SwaggerPetstore.FakeApi* | [**fakeOuterStringSerialize**](docs/FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | *SwaggerPetstore.FakeApi* | [**testClientModel**](docs/FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model *SwaggerPetstore.FakeApi* | [**testEndpointParameters**](docs/FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *SwaggerPetstore.FakeApi* | [**testEnumParameters**](docs/FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters @@ -127,7 +132,11 @@ Class | Method | HTTP request | Description - [SwaggerPetstore.Name](docs/Name.md) - [SwaggerPetstore.NumberOnly](docs/NumberOnly.md) - [SwaggerPetstore.Order](docs/Order.md) + - [SwaggerPetstore.OuterBoolean](docs/OuterBoolean.md) + - [SwaggerPetstore.OuterComposite](docs/OuterComposite.md) - [SwaggerPetstore.OuterEnum](docs/OuterEnum.md) + - [SwaggerPetstore.OuterNumber](docs/OuterNumber.md) + - [SwaggerPetstore.OuterString](docs/OuterString.md) - [SwaggerPetstore.Pet](docs/Pet.md) - [SwaggerPetstore.ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SwaggerPetstore.SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/javascript/docs/FakeApi.md b/samples/client/petstore/javascript/docs/FakeApi.md index 88cb5cf0f2f..85ac0b3d8a2 100644 --- a/samples/client/petstore/javascript/docs/FakeApi.md +++ b/samples/client/petstore/javascript/docs/FakeApi.md @@ -4,11 +4,203 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters + +# **fakeOuterBooleanSerialize** +> OuterBoolean fakeOuterBooleanSerialize(opts) + + + +Test serialization of outer boolean types + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterBoolean() // OuterBoolean | Input boolean as post body +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +apiInstance.fakeOuterBooleanSerialize(opts, callback); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterCompositeSerialize** +> OuterComposite fakeOuterCompositeSerialize(opts) + + + +Test serialization of object with outer number type + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterComposite() // OuterComposite | Input composite as post body +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +apiInstance.fakeOuterCompositeSerialize(opts, callback); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterNumberSerialize** +> OuterNumber fakeOuterNumberSerialize(opts) + + + +Test serialization of outer number types + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterNumber() // OuterNumber | Input number as post body +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +apiInstance.fakeOuterNumberSerialize(opts, callback); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + +# **fakeOuterStringSerialize** +> OuterString fakeOuterStringSerialize(opts) + + + +Test serialization of outer string types + +### Example +```javascript +var SwaggerPetstore = require('swagger_petstore'); + +var apiInstance = new SwaggerPetstore.FakeApi(); + +var opts = { + 'body': new SwaggerPetstore.OuterString() // OuterString | Input string as post body +}; + +var callback = function(error, data, response) { + if (error) { + console.error(error); + } else { + console.log('API called successfully. Returned data: ' + data); + } +}; +apiInstance.fakeOuterStringSerialize(opts, callback); +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + # **testClientModel** > Client testClientModel(body) diff --git a/samples/client/petstore/javascript/docs/OuterBoolean.md b/samples/client/petstore/javascript/docs/OuterBoolean.md new file mode 100644 index 00000000000..61ea0d56615 --- /dev/null +++ b/samples/client/petstore/javascript/docs/OuterBoolean.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript/docs/OuterComposite.md b/samples/client/petstore/javascript/docs/OuterComposite.md new file mode 100644 index 00000000000..e4cb57f35af --- /dev/null +++ b/samples/client/petstore/javascript/docs/OuterComposite.md @@ -0,0 +1,10 @@ +# SwaggerPetstore.OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**myNumber** | [**OuterNumber**](OuterNumber.md) | | [optional] +**myString** | [**OuterString**](OuterString.md) | | [optional] +**myBoolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + + diff --git a/samples/client/petstore/javascript/docs/OuterNumber.md b/samples/client/petstore/javascript/docs/OuterNumber.md new file mode 100644 index 00000000000..efbbfa83535 --- /dev/null +++ b/samples/client/petstore/javascript/docs/OuterNumber.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript/docs/OuterString.md b/samples/client/petstore/javascript/docs/OuterString.md new file mode 100644 index 00000000000..22eba5351a9 --- /dev/null +++ b/samples/client/petstore/javascript/docs/OuterString.md @@ -0,0 +1,7 @@ +# SwaggerPetstore.OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/javascript/src/api/FakeApi.js b/samples/client/petstore/javascript/src/api/FakeApi.js index 5c32e1e6198..579a8f87289 100644 --- a/samples/client/petstore/javascript/src/api/FakeApi.js +++ b/samples/client/petstore/javascript/src/api/FakeApi.js @@ -17,18 +17,18 @@ (function(root, factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/Client'], factory); + define(['ApiClient', 'model/Client', 'model/OuterBoolean', 'model/OuterComposite', 'model/OuterNumber', 'model/OuterString'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('../ApiClient'), require('../model/Client')); + module.exports = factory(require('../ApiClient'), require('../model/Client'), require('../model/OuterBoolean'), require('../model/OuterComposite'), require('../model/OuterNumber'), require('../model/OuterString')); } else { // Browser globals (root is window) if (!root.SwaggerPetstore) { root.SwaggerPetstore = {}; } - root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client); + root.SwaggerPetstore.FakeApi = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.Client, root.SwaggerPetstore.OuterBoolean, root.SwaggerPetstore.OuterComposite, root.SwaggerPetstore.OuterNumber, root.SwaggerPetstore.OuterString); } -}(this, function(ApiClient, Client) { +}(this, function(ApiClient, Client, OuterBoolean, OuterComposite, OuterNumber, OuterString) { 'use strict'; /** @@ -48,6 +48,170 @@ this.apiClient = apiClient || ApiClient.instance; + /** + * Callback function to receive the result of the fakeOuterBooleanSerialize operation. + * @callback module:api/FakeApi~fakeOuterBooleanSerializeCallback + * @param {String} error Error message, if any. + * @param {module:model/OuterBoolean} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Test serialization of outer boolean types + * @param {Object} opts Optional parameters + * @param {module:model/OuterBoolean} opts.body Input boolean as post body + * @param {module:api/FakeApi~fakeOuterBooleanSerializeCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/OuterBoolean} + */ + this.fakeOuterBooleanSerialize = function(opts, callback) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterBoolean; + + return this.apiClient.callApi( + '/fake/outer/boolean', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, callback + ); + } + + /** + * Callback function to receive the result of the fakeOuterCompositeSerialize operation. + * @callback module:api/FakeApi~fakeOuterCompositeSerializeCallback + * @param {String} error Error message, if any. + * @param {module:model/OuterComposite} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Test serialization of object with outer number type + * @param {Object} opts Optional parameters + * @param {module:model/OuterComposite} opts.body Input composite as post body + * @param {module:api/FakeApi~fakeOuterCompositeSerializeCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/OuterComposite} + */ + this.fakeOuterCompositeSerialize = function(opts, callback) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterComposite; + + return this.apiClient.callApi( + '/fake/outer/composite', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, callback + ); + } + + /** + * Callback function to receive the result of the fakeOuterNumberSerialize operation. + * @callback module:api/FakeApi~fakeOuterNumberSerializeCallback + * @param {String} error Error message, if any. + * @param {module:model/OuterNumber} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Test serialization of outer number types + * @param {Object} opts Optional parameters + * @param {module:model/OuterNumber} opts.body Input number as post body + * @param {module:api/FakeApi~fakeOuterNumberSerializeCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/OuterNumber} + */ + this.fakeOuterNumberSerialize = function(opts, callback) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterNumber; + + return this.apiClient.callApi( + '/fake/outer/number', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, callback + ); + } + + /** + * Callback function to receive the result of the fakeOuterStringSerialize operation. + * @callback module:api/FakeApi~fakeOuterStringSerializeCallback + * @param {String} error Error message, if any. + * @param {module:model/OuterString} data The data returned by the service call. + * @param {String} response The complete HTTP response. + */ + + /** + * Test serialization of outer string types + * @param {Object} opts Optional parameters + * @param {module:model/OuterString} opts.body Input string as post body + * @param {module:api/FakeApi~fakeOuterStringSerializeCallback} callback The callback function, accepting three arguments: error, data, response + * data is of type: {@link module:model/OuterString} + */ + this.fakeOuterStringSerialize = function(opts, callback) { + opts = opts || {}; + var postBody = opts['body']; + + + var pathParams = { + }; + var queryParams = { + }; + var headerParams = { + }; + var formParams = { + }; + + var authNames = []; + var contentTypes = []; + var accepts = []; + var returnType = OuterString; + + return this.apiClient.callApi( + '/fake/outer/string', 'POST', + pathParams, queryParams, headerParams, formParams, postBody, + authNames, contentTypes, accepts, returnType, callback + ); + } + /** * Callback function to receive the result of the testClientModel operation. * @callback module:api/FakeApi~testClientModelCallback diff --git a/samples/client/petstore/javascript/src/index.js b/samples/client/petstore/javascript/src/index.js index bf7d2f62383..974962007e5 100644 --- a/samples/client/petstore/javascript/src/index.js +++ b/samples/client/petstore/javascript/src/index.js @@ -17,12 +17,12 @@ (function(factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. - define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Capitalization', 'model/Cat', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterEnum', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); + define(['ApiClient', 'model/AdditionalPropertiesClass', 'model/Animal', 'model/AnimalFarm', 'model/ApiResponse', 'model/ArrayOfArrayOfNumberOnly', 'model/ArrayOfNumberOnly', 'model/ArrayTest', 'model/Capitalization', 'model/Cat', 'model/Category', 'model/ClassModel', 'model/Client', 'model/Dog', 'model/EnumArrays', 'model/EnumClass', 'model/EnumTest', 'model/FormatTest', 'model/HasOnlyReadOnly', 'model/List', 'model/MapTest', 'model/MixedPropertiesAndAdditionalPropertiesClass', 'model/Model200Response', 'model/ModelReturn', 'model/Name', 'model/NumberOnly', 'model/Order', 'model/OuterBoolean', 'model/OuterComposite', 'model/OuterEnum', 'model/OuterNumber', 'model/OuterString', 'model/Pet', 'model/ReadOnlyFirst', 'model/SpecialModelName', 'model/Tag', 'model/User', 'api/FakeApi', 'api/PetApi', 'api/StoreApi', 'api/UserApi'], factory); } else if (typeof module === 'object' && module.exports) { // CommonJS-like environments that support module.exports, like Node. - module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Capitalization'), require('./model/Cat'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterEnum'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); + module.exports = factory(require('./ApiClient'), require('./model/AdditionalPropertiesClass'), require('./model/Animal'), require('./model/AnimalFarm'), require('./model/ApiResponse'), require('./model/ArrayOfArrayOfNumberOnly'), require('./model/ArrayOfNumberOnly'), require('./model/ArrayTest'), require('./model/Capitalization'), require('./model/Cat'), require('./model/Category'), require('./model/ClassModel'), require('./model/Client'), require('./model/Dog'), require('./model/EnumArrays'), require('./model/EnumClass'), require('./model/EnumTest'), require('./model/FormatTest'), require('./model/HasOnlyReadOnly'), require('./model/List'), require('./model/MapTest'), require('./model/MixedPropertiesAndAdditionalPropertiesClass'), require('./model/Model200Response'), require('./model/ModelReturn'), require('./model/Name'), require('./model/NumberOnly'), require('./model/Order'), require('./model/OuterBoolean'), require('./model/OuterComposite'), require('./model/OuterEnum'), require('./model/OuterNumber'), require('./model/OuterString'), require('./model/Pet'), require('./model/ReadOnlyFirst'), require('./model/SpecialModelName'), require('./model/Tag'), require('./model/User'), require('./api/FakeApi'), require('./api/PetApi'), require('./api/StoreApi'), require('./api/UserApi')); } -}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Capitalization, Cat, Category, ClassModel, Client, Dog, EnumArrays, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterEnum, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { +}(function(ApiClient, AdditionalPropertiesClass, Animal, AnimalFarm, ApiResponse, ArrayOfArrayOfNumberOnly, ArrayOfNumberOnly, ArrayTest, Capitalization, Cat, Category, ClassModel, Client, Dog, EnumArrays, EnumClass, EnumTest, FormatTest, HasOnlyReadOnly, List, MapTest, MixedPropertiesAndAdditionalPropertiesClass, Model200Response, ModelReturn, Name, NumberOnly, Order, OuterBoolean, OuterComposite, OuterEnum, OuterNumber, OuterString, Pet, ReadOnlyFirst, SpecialModelName, Tag, User, FakeApi, PetApi, StoreApi, UserApi) { 'use strict'; /** @@ -192,11 +192,31 @@ * @property {module:model/Order} */ Order: Order, + /** + * The OuterBoolean model constructor. + * @property {module:model/OuterBoolean} + */ + OuterBoolean: OuterBoolean, + /** + * The OuterComposite model constructor. + * @property {module:model/OuterComposite} + */ + OuterComposite: OuterComposite, /** * The OuterEnum model constructor. * @property {module:model/OuterEnum} */ OuterEnum: OuterEnum, + /** + * The OuterNumber model constructor. + * @property {module:model/OuterNumber} + */ + OuterNumber: OuterNumber, + /** + * The OuterString model constructor. + * @property {module:model/OuterString} + */ + OuterString: OuterString, /** * The Pet model constructor. * @property {module:model/Pet} diff --git a/samples/client/petstore/javascript/src/model/OuterBoolean.js b/samples/client/petstore/javascript/src/model/OuterBoolean.js new file mode 100644 index 00000000000..a900c5d2ef2 --- /dev/null +++ b/samples/client/petstore/javascript/src/model/OuterBoolean.js @@ -0,0 +1,71 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterBoolean = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The OuterBoolean model module. + * @module model/OuterBoolean + * @version 1.0.0 + */ + + /** + * Constructs a new OuterBoolean. + * @alias module:model/OuterBoolean + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a OuterBoolean from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterBoolean} obj Optional instance to populate. + * @return {module:model/OuterBoolean} The populated OuterBoolean instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + } + return obj; + } + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript/src/model/OuterComposite.js b/samples/client/petstore/javascript/src/model/OuterComposite.js new file mode 100644 index 00000000000..bcb6632d409 --- /dev/null +++ b/samples/client/petstore/javascript/src/model/OuterComposite.js @@ -0,0 +1,95 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient', 'model/OuterBoolean', 'model/OuterNumber', 'model/OuterString'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient'), require('./OuterBoolean'), require('./OuterNumber'), require('./OuterString')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterComposite = factory(root.SwaggerPetstore.ApiClient, root.SwaggerPetstore.OuterBoolean, root.SwaggerPetstore.OuterNumber, root.SwaggerPetstore.OuterString); + } +}(this, function(ApiClient, OuterBoolean, OuterNumber, OuterString) { + 'use strict'; + + + + + /** + * The OuterComposite model module. + * @module model/OuterComposite + * @version 1.0.0 + */ + + /** + * Constructs a new OuterComposite. + * @alias module:model/OuterComposite + * @class + */ + var exports = function() { + var _this = this; + + + + + }; + + /** + * Constructs a OuterComposite from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterComposite} obj Optional instance to populate. + * @return {module:model/OuterComposite} The populated OuterComposite instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + if (data.hasOwnProperty('my_number')) { + obj['my_number'] = OuterNumber.constructFromObject(data['my_number']); + } + if (data.hasOwnProperty('my_string')) { + obj['my_string'] = OuterString.constructFromObject(data['my_string']); + } + if (data.hasOwnProperty('my_boolean')) { + obj['my_boolean'] = OuterBoolean.constructFromObject(data['my_boolean']); + } + } + return obj; + } + + /** + * @member {module:model/OuterNumber} my_number + */ + exports.prototype['my_number'] = undefined; + /** + * @member {module:model/OuterString} my_string + */ + exports.prototype['my_string'] = undefined; + /** + * @member {module:model/OuterBoolean} my_boolean + */ + exports.prototype['my_boolean'] = undefined; + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript/src/model/OuterNumber.js b/samples/client/petstore/javascript/src/model/OuterNumber.js new file mode 100644 index 00000000000..f6049e64974 --- /dev/null +++ b/samples/client/petstore/javascript/src/model/OuterNumber.js @@ -0,0 +1,71 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterNumber = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The OuterNumber model module. + * @module model/OuterNumber + * @version 1.0.0 + */ + + /** + * Constructs a new OuterNumber. + * @alias module:model/OuterNumber + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a OuterNumber from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterNumber} obj Optional instance to populate. + * @return {module:model/OuterNumber} The populated OuterNumber instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + } + return obj; + } + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript/src/model/OuterString.js b/samples/client/petstore/javascript/src/model/OuterString.js new file mode 100644 index 00000000000..c2f9e4f2f74 --- /dev/null +++ b/samples/client/petstore/javascript/src/model/OuterString.js @@ -0,0 +1,71 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['ApiClient'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + module.exports = factory(require('../ApiClient')); + } else { + // Browser globals (root is window) + if (!root.SwaggerPetstore) { + root.SwaggerPetstore = {}; + } + root.SwaggerPetstore.OuterString = factory(root.SwaggerPetstore.ApiClient); + } +}(this, function(ApiClient) { + 'use strict'; + + + + + /** + * The OuterString model module. + * @module model/OuterString + * @version 1.0.0 + */ + + /** + * Constructs a new OuterString. + * @alias module:model/OuterString + * @class + */ + var exports = function() { + var _this = this; + + }; + + /** + * Constructs a OuterString from a plain JavaScript object, optionally creating a new instance. + * Copies all relevant properties from data to obj if supplied or a new instance if not. + * @param {Object} data The plain JavaScript object bearing properties of interest. + * @param {module:model/OuterString} obj Optional instance to populate. + * @return {module:model/OuterString} The populated OuterString instance. + */ + exports.constructFromObject = function(data, obj) { + if (data) { + obj = obj || new exports(); + + } + return obj; + } + + + + + return exports; +})); + + diff --git a/samples/client/petstore/javascript/test/model/OuterBoolean.spec.js b/samples/client/petstore/javascript/test/model/OuterBoolean.spec.js new file mode 100644 index 00000000000..d5495a638d8 --- /dev/null +++ b/samples/client/petstore/javascript/test/model/OuterBoolean.spec.js @@ -0,0 +1,59 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterBoolean(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterBoolean', function() { + it('should create an instance of OuterBoolean', function() { + // uncomment below and update the code to test OuterBoolean + //var instane = new SwaggerPetstore.OuterBoolean(); + //expect(instance).to.be.a(SwaggerPetstore.OuterBoolean); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript/test/model/OuterComposite.spec.js b/samples/client/petstore/javascript/test/model/OuterComposite.spec.js new file mode 100644 index 00000000000..6fd830b7c0e --- /dev/null +++ b/samples/client/petstore/javascript/test/model/OuterComposite.spec.js @@ -0,0 +1,77 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterComposite(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterComposite', function() { + it('should create an instance of OuterComposite', function() { + // uncomment below and update the code to test OuterComposite + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be.a(SwaggerPetstore.OuterComposite); + }); + + it('should have the property myNumber (base name: "my_number")', function() { + // uncomment below and update the code to test the property myNumber + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be(); + }); + + it('should have the property myString (base name: "my_string")', function() { + // uncomment below and update the code to test the property myString + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be(); + }); + + it('should have the property myBoolean (base name: "my_boolean")', function() { + // uncomment below and update the code to test the property myBoolean + //var instane = new SwaggerPetstore.OuterComposite(); + //expect(instance).to.be(); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript/test/model/OuterNumber.spec.js b/samples/client/petstore/javascript/test/model/OuterNumber.spec.js new file mode 100644 index 00000000000..7b0e4ebf119 --- /dev/null +++ b/samples/client/petstore/javascript/test/model/OuterNumber.spec.js @@ -0,0 +1,59 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterNumber(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterNumber', function() { + it('should create an instance of OuterNumber', function() { + // uncomment below and update the code to test OuterNumber + //var instane = new SwaggerPetstore.OuterNumber(); + //expect(instance).to.be.a(SwaggerPetstore.OuterNumber); + }); + + }); + +})); diff --git a/samples/client/petstore/javascript/test/model/OuterString.spec.js b/samples/client/petstore/javascript/test/model/OuterString.spec.js new file mode 100644 index 00000000000..4e7f99ca88d --- /dev/null +++ b/samples/client/petstore/javascript/test/model/OuterString.spec.js @@ -0,0 +1,59 @@ +/** + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + * + */ + +(function(root, factory) { + if (typeof define === 'function' && define.amd) { + // AMD. + define(['expect.js', '../../src/index'], factory); + } else if (typeof module === 'object' && module.exports) { + // CommonJS-like environments that support module.exports, like Node. + factory(require('expect.js'), require('../../src/index')); + } else { + // Browser globals (root is window) + factory(root.expect, root.SwaggerPetstore); + } +}(this, function(expect, SwaggerPetstore) { + 'use strict'; + + var instance; + + beforeEach(function() { + instance = new SwaggerPetstore.OuterString(); + }); + + var getProperty = function(object, getter, property) { + // Use getter method if present; otherwise, get the property directly. + if (typeof object[getter] === 'function') + return object[getter](); + else + return object[property]; + } + + var setProperty = function(object, setter, property, value) { + // Use setter method if present; otherwise, set the property directly. + if (typeof object[setter] === 'function') + object[setter](value); + else + object[property] = value; + } + + describe('OuterString', function() { + it('should create an instance of OuterString', function() { + // uncomment below and update the code to test OuterString + //var instane = new SwaggerPetstore.OuterString(); + //expect(instance).to.be.a(SwaggerPetstore.OuterString); + }); + + }); + +})); diff --git a/samples/client/petstore/perl/README.md b/samples/client/petstore/perl/README.md index 28d623894ed..af98f10987a 100644 --- a/samples/client/petstore/perl/README.md +++ b/samples/client/petstore/perl/README.md @@ -257,7 +257,11 @@ use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; use WWW::SwaggerClient::Object::NumberOnly; use WWW::SwaggerClient::Object::Order; +use WWW::SwaggerClient::Object::OuterBoolean; +use WWW::SwaggerClient::Object::OuterComposite; use WWW::SwaggerClient::Object::OuterEnum; +use WWW::SwaggerClient::Object::OuterNumber; +use WWW::SwaggerClient::Object::OuterString; use WWW::SwaggerClient::Object::Pet; use WWW::SwaggerClient::Object::ReadOnlyFirst; use WWW::SwaggerClient::Object::SpecialModelName; @@ -306,7 +310,11 @@ use WWW::SwaggerClient::Object::ModelReturn; use WWW::SwaggerClient::Object::Name; use WWW::SwaggerClient::Object::NumberOnly; use WWW::SwaggerClient::Object::Order; +use WWW::SwaggerClient::Object::OuterBoolean; +use WWW::SwaggerClient::Object::OuterComposite; use WWW::SwaggerClient::Object::OuterEnum; +use WWW::SwaggerClient::Object::OuterNumber; +use WWW::SwaggerClient::Object::OuterString; use WWW::SwaggerClient::Object::Pet; use WWW::SwaggerClient::Object::ReadOnlyFirst; use WWW::SwaggerClient::Object::SpecialModelName; @@ -319,14 +327,14 @@ use WWW::SwaggerClient::Configuration; use WWW::SwaggerClient::; my $api_instance = WWW::SwaggerClient::FakeApi->new(); -my $body = WWW::SwaggerClient::Object::Client->new(); # Client | client model +my $body = WWW::SwaggerClient::Object::OuterBoolean->new(); # OuterBoolean | Input boolean as post body eval { - my $result = $api_instance->test_client_model(body => $body); + my $result = $api_instance->fake_outer_boolean_serialize(body => $body); print Dumper($result); }; if ($@) { - warn "Exception when calling FakeApi->test_client_model: $@\n"; + warn "Exception when calling FakeApi->fake_outer_boolean_serialize: $@\n"; } ``` @@ -337,6 +345,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters @@ -389,7 +401,11 @@ Class | Method | HTTP request | Description - [WWW::SwaggerClient::Object::Name](docs/Name.md) - [WWW::SwaggerClient::Object::NumberOnly](docs/NumberOnly.md) - [WWW::SwaggerClient::Object::Order](docs/Order.md) + - [WWW::SwaggerClient::Object::OuterBoolean](docs/OuterBoolean.md) + - [WWW::SwaggerClient::Object::OuterComposite](docs/OuterComposite.md) - [WWW::SwaggerClient::Object::OuterEnum](docs/OuterEnum.md) + - [WWW::SwaggerClient::Object::OuterNumber](docs/OuterNumber.md) + - [WWW::SwaggerClient::Object::OuterString](docs/OuterString.md) - [WWW::SwaggerClient::Object::Pet](docs/Pet.md) - [WWW::SwaggerClient::Object::ReadOnlyFirst](docs/ReadOnlyFirst.md) - [WWW::SwaggerClient::Object::SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/perl/docs/FakeApi.md b/samples/client/petstore/perl/docs/FakeApi.md index 64abca75b3d..f16c4d27f7a 100644 --- a/samples/client/petstore/perl/docs/FakeApi.md +++ b/samples/client/petstore/perl/docs/FakeApi.md @@ -9,11 +9,199 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +# **fake_outer_boolean_serialize** +> OuterBoolean fake_outer_boolean_serialize(body => $body) + + + +Test serialization of outer boolean types + +### Example +```perl +use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeApi; + +my $api_instance = WWW::SwaggerClient::FakeApi->new(); +my $body = WWW::SwaggerClient::Object::OuterBoolean->new(); # OuterBoolean | Input boolean as post body + +eval { + my $result = $api_instance->fake_outer_boolean_serialize(body => $body); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling FakeApi->fake_outer_boolean_serialize: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_composite_serialize** +> OuterComposite fake_outer_composite_serialize(body => $body) + + + +Test serialization of object with outer number type + +### Example +```perl +use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeApi; + +my $api_instance = WWW::SwaggerClient::FakeApi->new(); +my $body = WWW::SwaggerClient::Object::OuterComposite->new(); # OuterComposite | Input composite as post body + +eval { + my $result = $api_instance->fake_outer_composite_serialize(body => $body); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling FakeApi->fake_outer_composite_serialize: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_number_serialize** +> OuterNumber fake_outer_number_serialize(body => $body) + + + +Test serialization of outer number types + +### Example +```perl +use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeApi; + +my $api_instance = WWW::SwaggerClient::FakeApi->new(); +my $body = WWW::SwaggerClient::Object::OuterNumber->new(); # OuterNumber | Input number as post body + +eval { + my $result = $api_instance->fake_outer_number_serialize(body => $body); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling FakeApi->fake_outer_number_serialize: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_string_serialize** +> OuterString fake_outer_string_serialize(body => $body) + + + +Test serialization of outer string types + +### Example +```perl +use Data::Dumper; +use WWW::SwaggerClient::Configuration; +use WWW::SwaggerClient::FakeApi; + +my $api_instance = WWW::SwaggerClient::FakeApi->new(); +my $body = WWW::SwaggerClient::Object::OuterString->new(); # OuterString | Input string as post body + +eval { + my $result = $api_instance->fake_outer_string_serialize(body => $body); + print Dumper($result); +}; +if ($@) { + warn "Exception when calling FakeApi->fake_outer_string_serialize: $@\n"; +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_client_model** > Client test_client_model(body => $body) diff --git a/samples/client/petstore/perl/docs/OuterBoolean.md b/samples/client/petstore/perl/docs/OuterBoolean.md new file mode 100644 index 00000000000..083d258299d --- /dev/null +++ b/samples/client/petstore/perl/docs/OuterBoolean.md @@ -0,0 +1,14 @@ +# WWW::SwaggerClient::Object::OuterBoolean + +## Load the model package +```perl +use WWW::SwaggerClient::Object::OuterBoolean; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/OuterComposite.md b/samples/client/petstore/perl/docs/OuterComposite.md new file mode 100644 index 00000000000..091bc68411b --- /dev/null +++ b/samples/client/petstore/perl/docs/OuterComposite.md @@ -0,0 +1,17 @@ +# WWW::SwaggerClient::Object::OuterComposite + +## Load the model package +```perl +use WWW::SwaggerClient::Object::OuterComposite; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | [**OuterNumber**](OuterNumber.md) | | [optional] +**my_string** | [**OuterString**](OuterString.md) | | [optional] +**my_boolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/OuterNumber.md b/samples/client/petstore/perl/docs/OuterNumber.md new file mode 100644 index 00000000000..fc755cc362c --- /dev/null +++ b/samples/client/petstore/perl/docs/OuterNumber.md @@ -0,0 +1,14 @@ +# WWW::SwaggerClient::Object::OuterNumber + +## Load the model package +```perl +use WWW::SwaggerClient::Object::OuterNumber; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/docs/OuterString.md b/samples/client/petstore/perl/docs/OuterString.md new file mode 100644 index 00000000000..2eeee7f43f1 --- /dev/null +++ b/samples/client/petstore/perl/docs/OuterString.md @@ -0,0 +1,14 @@ +# WWW::SwaggerClient::Object::OuterString + +## Load the model package +```perl +use WWW::SwaggerClient::Object::OuterString; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm index 961e102e081..7cc0a88072f 100644 --- a/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/FakeApi.pm @@ -51,6 +51,246 @@ sub new { } +# +# fake_outer_boolean_serialize +# +# +# +# @param OuterBoolean $body Input boolean as post body (optional) +{ + my $params = { + 'body' => { + data_type => 'OuterBoolean', + description => 'Input boolean as post body', + required => '0', + }, + }; + __PACKAGE__->method_documentation->{ 'fake_outer_boolean_serialize' } = { + summary => '', + params => $params, + returns => 'OuterBoolean', + }; +} +# @return OuterBoolean +# +sub fake_outer_boolean_serialize { + my ($self, %args) = @_; + + # parse inputs + my $_resource_path = '/fake/outer/boolean'; + + my $_method = 'POST'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept(); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + my $_body_data; + # body params + if ( exists $args{'body'}) { + $_body_data = $args{'body'}; + } + + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('OuterBoolean', $response); + return $_response_object; +} + +# +# fake_outer_composite_serialize +# +# +# +# @param OuterComposite $body Input composite as post body (optional) +{ + my $params = { + 'body' => { + data_type => 'OuterComposite', + description => 'Input composite as post body', + required => '0', + }, + }; + __PACKAGE__->method_documentation->{ 'fake_outer_composite_serialize' } = { + summary => '', + params => $params, + returns => 'OuterComposite', + }; +} +# @return OuterComposite +# +sub fake_outer_composite_serialize { + my ($self, %args) = @_; + + # parse inputs + my $_resource_path = '/fake/outer/composite'; + + my $_method = 'POST'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept(); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + my $_body_data; + # body params + if ( exists $args{'body'}) { + $_body_data = $args{'body'}; + } + + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('OuterComposite', $response); + return $_response_object; +} + +# +# fake_outer_number_serialize +# +# +# +# @param OuterNumber $body Input number as post body (optional) +{ + my $params = { + 'body' => { + data_type => 'OuterNumber', + description => 'Input number as post body', + required => '0', + }, + }; + __PACKAGE__->method_documentation->{ 'fake_outer_number_serialize' } = { + summary => '', + params => $params, + returns => 'OuterNumber', + }; +} +# @return OuterNumber +# +sub fake_outer_number_serialize { + my ($self, %args) = @_; + + # parse inputs + my $_resource_path = '/fake/outer/number'; + + my $_method = 'POST'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept(); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + my $_body_data; + # body params + if ( exists $args{'body'}) { + $_body_data = $args{'body'}; + } + + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('OuterNumber', $response); + return $_response_object; +} + +# +# fake_outer_string_serialize +# +# +# +# @param OuterString $body Input string as post body (optional) +{ + my $params = { + 'body' => { + data_type => 'OuterString', + description => 'Input string as post body', + required => '0', + }, + }; + __PACKAGE__->method_documentation->{ 'fake_outer_string_serialize' } = { + summary => '', + params => $params, + returns => 'OuterString', + }; +} +# @return OuterString +# +sub fake_outer_string_serialize { + my ($self, %args) = @_; + + # parse inputs + my $_resource_path = '/fake/outer/string'; + + my $_method = 'POST'; + my $query_params = {}; + my $header_params = {}; + my $form_params = {}; + + # 'Accept' and 'Content-Type' header + my $_header_accept = $self->{api_client}->select_header_accept(); + if ($_header_accept) { + $header_params->{'Accept'} = $_header_accept; + } + $header_params->{'Content-Type'} = $self->{api_client}->select_header_content_type(); + + my $_body_data; + # body params + if ( exists $args{'body'}) { + $_body_data = $args{'body'}; + } + + # authentication setting, if any + my $auth_settings = [qw()]; + + # make the API Call + my $response = $self->{api_client}->call_api($_resource_path, $_method, + $query_params, $form_params, + $header_params, $_body_data, $auth_settings); + if (!$response) { + return; + } + my $_response_object = $self->{api_client}->deserialize('OuterString', $response); + return $_response_object; +} + # # test_client_model # diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterBoolean.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterBoolean.pm new file mode 100644 index 00000000000..476df404705 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterBoolean.pm @@ -0,0 +1,158 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::OuterBoolean; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'OuterBoolean', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->swagger_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterComposite.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterComposite.pm new file mode 100644 index 00000000000..7697149a774 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterComposite.pm @@ -0,0 +1,183 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::OuterComposite; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'OuterComposite', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ + 'my_number' => { + datatype => 'OuterNumber', + base_name => 'my_number', + description => '', + format => '', + read_only => '', + }, + 'my_string' => { + datatype => 'OuterString', + base_name => 'my_string', + description => '', + format => '', + read_only => '', + }, + 'my_boolean' => { + datatype => 'OuterBoolean', + base_name => 'my_boolean', + description => '', + format => '', + read_only => '', + }, +}); + +__PACKAGE__->swagger_types( { + 'my_number' => 'OuterNumber', + 'my_string' => 'OuterString', + 'my_boolean' => 'OuterBoolean' +} ); + +__PACKAGE__->attribute_map( { + 'my_number' => 'my_number', + 'my_string' => 'my_string', + 'my_boolean' => 'my_boolean' +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterNumber.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterNumber.pm new file mode 100644 index 00000000000..5bb037849c5 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterNumber.pm @@ -0,0 +1,158 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::OuterNumber; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'OuterNumber', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->swagger_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterString.pm b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterString.pm new file mode 100644 index 00000000000..ac7e0ba5295 --- /dev/null +++ b/samples/client/petstore/perl/lib/WWW/SwaggerClient/Object/OuterString.pm @@ -0,0 +1,158 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +package WWW::SwaggerClient::Object::OuterString; + +require 5.6.0; +use strict; +use warnings; +use utf8; +use JSON qw(decode_json); +use Data::Dumper; +use Module::Runtime qw(use_module); +use Log::Any qw($log); +use Date::Parse; +use DateTime; + +use base ("Class::Accessor", "Class::Data::Inheritable"); + + +# +# +# +# NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. +# REF: https://github.com/swagger-api/swagger-codegen +# + +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the swagger code generator program. +# Do not edit the class manually. +# Ref: https://github.com/swagger-api/swagger-codegen +# +__PACKAGE__->mk_classdata('attribute_map' => {}); +__PACKAGE__->mk_classdata('swagger_types' => {}); +__PACKAGE__->mk_classdata('method_documentation' => {}); +__PACKAGE__->mk_classdata('class_documentation' => {}); + +# new object +sub new { + my ($class, %args) = @_; + + my $self = bless {}, $class; + + foreach my $attribute (keys %{$class->attribute_map}) { + my $args_key = $class->attribute_map->{$attribute}; + $self->$attribute( $args{ $args_key } ); + } + + return $self; +} + +# return perl hash +sub to_hash { + return decode_json(JSON->new->convert_blessed->encode( shift )); +} + +# used by JSON for serialization +sub TO_JSON { + my $self = shift; + my $_data = {}; + foreach my $_key (keys %{$self->attribute_map}) { + if (defined $self->{$_key}) { + $_data->{$self->attribute_map->{$_key}} = $self->{$_key}; + } + } + return $_data; +} + +# from Perl hashref +sub from_hash { + my ($self, $hash) = @_; + + # loop through attributes and use swagger_types to deserialize the data + while ( my ($_key, $_type) = each %{$self->swagger_types} ) { + my $_json_attribute = $self->attribute_map->{$_key}; + if ($_type =~ /^array\[/i) { # array + my $_subclass = substr($_type, 6, -1); + my @_array = (); + foreach my $_element (@{$hash->{$_json_attribute}}) { + push @_array, $self->_deserialize($_subclass, $_element); + } + $self->{$_key} = \@_array; + } elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime + $self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute}); + } else { + $log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute); + } + } + + return $self; +} + +# deserialize non-array data +sub _deserialize { + my ($self, $type, $data) = @_; + $log->debugf("deserializing %s with %s",Dumper($data), $type); + + if ($type eq 'DateTime') { + return DateTime->from_epoch(epoch => str2time($data)); + } elsif ( grep( /^$type$/, ('int', 'double', 'string', 'boolean'))) { + return $data; + } else { # hash(model) + my $_instance = eval "WWW::SwaggerClient::Object::$type->new()"; + return $_instance->from_hash($data); + } +} + + + +__PACKAGE__->class_documentation({description => '', + class => 'OuterString', + required => [], # TODO +} ); + +__PACKAGE__->method_documentation({ +}); + +__PACKAGE__->swagger_types( { + +} ); + +__PACKAGE__->attribute_map( { + +} ); + +__PACKAGE__->mk_accessors(keys %{__PACKAGE__->attribute_map}); + + +1; diff --git a/samples/client/petstore/perl/t/OuterBooleanTest.t b/samples/client/petstore/perl/t/OuterBooleanTest.t new file mode 100644 index 00000000000..906b2e4e915 --- /dev/null +++ b/samples/client/petstore/perl/t/OuterBooleanTest.t @@ -0,0 +1,33 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test cases below to test the model. +# Ref: https://github.com/swagger-api/swagger-codegen +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::OuterBoolean'); + +my $instance = WWW::SwaggerClient::Object::OuterBoolean->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::OuterBoolean'); + diff --git a/samples/client/petstore/perl/t/OuterCompositeTest.t b/samples/client/petstore/perl/t/OuterCompositeTest.t new file mode 100644 index 00000000000..d19b2a831e1 --- /dev/null +++ b/samples/client/petstore/perl/t/OuterCompositeTest.t @@ -0,0 +1,33 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test cases below to test the model. +# Ref: https://github.com/swagger-api/swagger-codegen +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::OuterComposite'); + +my $instance = WWW::SwaggerClient::Object::OuterComposite->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::OuterComposite'); + diff --git a/samples/client/petstore/perl/t/OuterNumberTest.t b/samples/client/petstore/perl/t/OuterNumberTest.t new file mode 100644 index 00000000000..eb4fbdf9a38 --- /dev/null +++ b/samples/client/petstore/perl/t/OuterNumberTest.t @@ -0,0 +1,33 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test cases below to test the model. +# Ref: https://github.com/swagger-api/swagger-codegen +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::OuterNumber'); + +my $instance = WWW::SwaggerClient::Object::OuterNumber->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::OuterNumber'); + diff --git a/samples/client/petstore/perl/t/OuterStringTest.t b/samples/client/petstore/perl/t/OuterStringTest.t new file mode 100644 index 00000000000..6fb11050540 --- /dev/null +++ b/samples/client/petstore/perl/t/OuterStringTest.t @@ -0,0 +1,33 @@ +=begin comment + +Swagger Petstore + +This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end comment + +=cut + +# +# NOTE: This class is auto generated by the Swagger Codegen +# Please update the test cases below to test the model. +# Ref: https://github.com/swagger-api/swagger-codegen +# +use Test::More tests => 2; +use Test::Exception; + +use lib 'lib'; +use strict; +use warnings; + + +use_ok('WWW::SwaggerClient::Object::OuterString'); + +my $instance = WWW::SwaggerClient::Object::OuterString->new(); + +isa_ok($instance, 'WWW::SwaggerClient::Object::OuterString'); + diff --git a/samples/client/petstore/php/SwaggerClient-php/README.md b/samples/client/petstore/php/SwaggerClient-php/README.md index 0444bdd3f19..11365910027 100644 --- a/samples/client/petstore/php/SwaggerClient-php/README.md +++ b/samples/client/petstore/php/SwaggerClient-php/README.md @@ -57,13 +57,13 @@ Please follow the [installation procedure](#installation--usage) and then run th require_once(__DIR__ . '/vendor/autoload.php'); $api_instance = new Swagger\Client\Api\FakeApi(); -$body = new \Swagger\Client\Model\Client(); // \Swagger\Client\Model\Client | client model +$body = new \Swagger\Client\Model\OuterBoolean(); // \Swagger\Client\Model\OuterBoolean | Input boolean as post body try { - $result = $api_instance->testClientModel($body); + $result = $api_instance->fakeOuterBooleanSerialize($body); print_r($result); } catch (Exception $e) { - echo 'Exception when calling FakeApi->testClientModel: ', $e->getMessage(), PHP_EOL; + echo 'Exception when calling FakeApi->fakeOuterBooleanSerialize: ', $e->getMessage(), PHP_EOL; } ?> @@ -75,6 +75,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**fakeOuterBooleanSerialize**](docs/Api/FakeApi.md#fakeouterbooleanserialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fakeOuterCompositeSerialize**](docs/Api/FakeApi.md#fakeoutercompositeserialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fakeOuterNumberSerialize**](docs/Api/FakeApi.md#fakeouternumberserialize) | **POST** /fake/outer/number | +*FakeApi* | [**fakeOuterStringSerialize**](docs/Api/FakeApi.md#fakeouterstringserialize) | **POST** /fake/outer/string | *FakeApi* | [**testClientModel**](docs/Api/FakeApi.md#testclientmodel) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**testEndpointParameters**](docs/Api/FakeApi.md#testendpointparameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**testEnumParameters**](docs/Api/FakeApi.md#testenumparameters) | **GET** /fake | To test enum parameters @@ -128,7 +132,11 @@ Class | Method | HTTP request | Description - [Name](docs/Model/Name.md) - [NumberOnly](docs/Model/NumberOnly.md) - [Order](docs/Model/Order.md) + - [OuterBoolean](docs/Model/OuterBoolean.md) + - [OuterComposite](docs/Model/OuterComposite.md) - [OuterEnum](docs/Model/OuterEnum.md) + - [OuterNumber](docs/Model/OuterNumber.md) + - [OuterString](docs/Model/OuterString.md) - [Pet](docs/Model/Pet.md) - [ReadOnlyFirst](docs/Model/ReadOnlyFirst.md) - [SpecialModelName](docs/Model/SpecialModelName.md) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md b/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md index 87cf2da9e4d..2c25bfcc9cb 100644 --- a/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Api/FakeApi.md @@ -4,11 +4,195 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fakeOuterBooleanSerialize**](FakeApi.md#fakeOuterBooleanSerialize) | **POST** /fake/outer/boolean | +[**fakeOuterCompositeSerialize**](FakeApi.md#fakeOuterCompositeSerialize) | **POST** /fake/outer/composite | +[**fakeOuterNumberSerialize**](FakeApi.md#fakeOuterNumberSerialize) | **POST** /fake/outer/number | +[**fakeOuterStringSerialize**](FakeApi.md#fakeOuterStringSerialize) | **POST** /fake/outer/string | [**testClientModel**](FakeApi.md#testClientModel) | **PATCH** /fake | To test \"client\" model [**testEndpointParameters**](FakeApi.md#testEndpointParameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**testEnumParameters**](FakeApi.md#testEnumParameters) | **GET** /fake | To test enum parameters +# **fakeOuterBooleanSerialize** +> \Swagger\Client\Model\OuterBoolean fakeOuterBooleanSerialize($body) + + + +Test serialization of outer boolean types + +### Example +```php +fakeOuterBooleanSerialize($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeOuterBooleanSerialize: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\OuterBoolean**](../Model/\Swagger\Client\Model\OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**\Swagger\Client\Model\OuterBoolean**](../Model/OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **fakeOuterCompositeSerialize** +> \Swagger\Client\Model\OuterComposite fakeOuterCompositeSerialize($body) + + + +Test serialization of object with outer number type + +### Example +```php +fakeOuterCompositeSerialize($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeOuterCompositeSerialize: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\OuterComposite**](../Model/\Swagger\Client\Model\OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**\Swagger\Client\Model\OuterComposite**](../Model/OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **fakeOuterNumberSerialize** +> \Swagger\Client\Model\OuterNumber fakeOuterNumberSerialize($body) + + + +Test serialization of outer number types + +### Example +```php +fakeOuterNumberSerialize($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeOuterNumberSerialize: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\OuterNumber**](../Model/\Swagger\Client\Model\OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**\Swagger\Client\Model\OuterNumber**](../Model/OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + +# **fakeOuterStringSerialize** +> \Swagger\Client\Model\OuterString fakeOuterStringSerialize($body) + + + +Test serialization of outer string types + +### Example +```php +fakeOuterStringSerialize($body); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling FakeApi->fakeOuterStringSerialize: ', $e->getMessage(), PHP_EOL; +} +?> +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**\Swagger\Client\Model\OuterString**](../Model/\Swagger\Client\Model\OuterString.md)| Input string as post body | [optional] + +### Return type + +[**\Swagger\Client\Model\OuterString**](../Model/OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#documentation-for-api-endpoints) [[Back to Model list]](../../README.md#documentation-for-models) [[Back to README]](../../README.md) + # **testClientModel** > \Swagger\Client\Model\Client testClientModel($body) diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterBoolean.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterBoolean.md new file mode 100644 index 00000000000..8b243399474 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterBoolean.md @@ -0,0 +1,9 @@ +# OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterComposite.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterComposite.md new file mode 100644 index 00000000000..8f791968a37 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | [**\Swagger\Client\Model\OuterNumber**](OuterNumber.md) | | [optional] +**my_string** | [**\Swagger\Client\Model\OuterString**](OuterString.md) | | [optional] +**my_boolean** | [**\Swagger\Client\Model\OuterBoolean**](OuterBoolean.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterNumber.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterNumber.md new file mode 100644 index 00000000000..8aa37f329bd --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterNumber.md @@ -0,0 +1,9 @@ +# OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterString.md b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterString.md new file mode 100644 index 00000000000..9ccaadaf98d --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/docs/Model/OuterString.md @@ -0,0 +1,9 @@ +# OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php index 52e2624cc38..d555ef5357e 100644 --- a/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Api/FakeApi.php @@ -87,6 +87,306 @@ class FakeApi return $this; } + /** + * Operation fakeOuterBooleanSerialize + * + * + * + * @param \Swagger\Client\Model\OuterBoolean $body Input boolean as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\OuterBoolean + */ + public function fakeOuterBooleanSerialize($body = null) + { + list($response) = $this->fakeOuterBooleanSerializeWithHttpInfo($body); + return $response; + } + + /** + * Operation fakeOuterBooleanSerializeWithHttpInfo + * + * + * + * @param \Swagger\Client\Model\OuterBoolean $body Input boolean as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\OuterBoolean, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeOuterBooleanSerializeWithHttpInfo($body = null) + { + // parse inputs + $resourcePath = "/fake/outer/boolean"; + $httpBody = ''; + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept([]); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, + 'POST', + $queryParams, + $httpBody, + $headerParams, + '\Swagger\Client\Model\OuterBoolean', + '/fake/outer/boolean' + ); + + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\OuterBoolean', $httpHeader), $statusCode, $httpHeader]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterBoolean', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } + + /** + * Operation fakeOuterCompositeSerialize + * + * + * + * @param \Swagger\Client\Model\OuterComposite $body Input composite as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\OuterComposite + */ + public function fakeOuterCompositeSerialize($body = null) + { + list($response) = $this->fakeOuterCompositeSerializeWithHttpInfo($body); + return $response; + } + + /** + * Operation fakeOuterCompositeSerializeWithHttpInfo + * + * + * + * @param \Swagger\Client\Model\OuterComposite $body Input composite as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\OuterComposite, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeOuterCompositeSerializeWithHttpInfo($body = null) + { + // parse inputs + $resourcePath = "/fake/outer/composite"; + $httpBody = ''; + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept([]); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, + 'POST', + $queryParams, + $httpBody, + $headerParams, + '\Swagger\Client\Model\OuterComposite', + '/fake/outer/composite' + ); + + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\OuterComposite', $httpHeader), $statusCode, $httpHeader]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterComposite', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } + + /** + * Operation fakeOuterNumberSerialize + * + * + * + * @param \Swagger\Client\Model\OuterNumber $body Input number as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\OuterNumber + */ + public function fakeOuterNumberSerialize($body = null) + { + list($response) = $this->fakeOuterNumberSerializeWithHttpInfo($body); + return $response; + } + + /** + * Operation fakeOuterNumberSerializeWithHttpInfo + * + * + * + * @param \Swagger\Client\Model\OuterNumber $body Input number as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\OuterNumber, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeOuterNumberSerializeWithHttpInfo($body = null) + { + // parse inputs + $resourcePath = "/fake/outer/number"; + $httpBody = ''; + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept([]); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, + 'POST', + $queryParams, + $httpBody, + $headerParams, + '\Swagger\Client\Model\OuterNumber', + '/fake/outer/number' + ); + + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\OuterNumber', $httpHeader), $statusCode, $httpHeader]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterNumber', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } + + /** + * Operation fakeOuterStringSerialize + * + * + * + * @param \Swagger\Client\Model\OuterString $body Input string as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return \Swagger\Client\Model\OuterString + */ + public function fakeOuterStringSerialize($body = null) + { + list($response) = $this->fakeOuterStringSerializeWithHttpInfo($body); + return $response; + } + + /** + * Operation fakeOuterStringSerializeWithHttpInfo + * + * + * + * @param \Swagger\Client\Model\OuterString $body Input string as post body (optional) + * @throws \Swagger\Client\ApiException on non-2xx response + * @return array of \Swagger\Client\Model\OuterString, HTTP status code, HTTP response headers (array of strings) + */ + public function fakeOuterStringSerializeWithHttpInfo($body = null) + { + // parse inputs + $resourcePath = "/fake/outer/string"; + $httpBody = ''; + $queryParams = []; + $headerParams = []; + $formParams = []; + $_header_accept = $this->apiClient->selectHeaderAccept([]); + if (!is_null($_header_accept)) { + $headerParams['Accept'] = $_header_accept; + } + $headerParams['Content-Type'] = $this->apiClient->selectHeaderContentType([]); + + // body params + $_tempBody = null; + if (isset($body)) { + $_tempBody = $body; + } + + // for model (json/xml) + if (isset($_tempBody)) { + $httpBody = $_tempBody; // $_tempBody is the method argument, if present + } elseif (count($formParams) > 0) { + $httpBody = $formParams; // for HTTP post (form) + } + // make the API Call + try { + list($response, $statusCode, $httpHeader) = $this->apiClient->callApi( + $resourcePath, + 'POST', + $queryParams, + $httpBody, + $headerParams, + '\Swagger\Client\Model\OuterString', + '/fake/outer/string' + ); + + return [$this->apiClient->getSerializer()->deserialize($response, '\Swagger\Client\Model\OuterString', $httpHeader), $statusCode, $httpHeader]; + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = $this->apiClient->getSerializer()->deserialize($e->getResponseBody(), '\Swagger\Client\Model\OuterString', $e->getResponseHeaders()); + $e->setResponseObject($data); + break; + } + + throw $e; + } + } + /** * Operation testClientModel * diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterBoolean.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterBoolean.php new file mode 100644 index 00000000000..34a56535ad3 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterBoolean.php @@ -0,0 +1,207 @@ +container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterComposite.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterComposite.php new file mode 100644 index 00000000000..1979b28f847 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterComposite.php @@ -0,0 +1,281 @@ + '\Swagger\Client\Model\OuterNumber', + 'my_string' => '\Swagger\Client\Model\OuterString', + 'my_boolean' => '\Swagger\Client\Model\OuterBoolean' + ]; + + public static function swaggerTypes() + { + return self::$swaggerTypes; + } + + /** + * Array of attributes where the key is the local name, and the value is the original name + * @var string[] + */ + protected static $attributeMap = [ + 'my_number' => 'my_number', + 'my_string' => 'my_string', + 'my_boolean' => 'my_boolean' + ]; + + + /** + * Array of attributes to setter functions (for deserialization of responses) + * @var string[] + */ + protected static $setters = [ + 'my_number' => 'setMyNumber', + 'my_string' => 'setMyString', + 'my_boolean' => 'setMyBoolean' + ]; + + + /** + * Array of attributes to getter functions (for serialization of requests) + * @var string[] + */ + protected static $getters = [ + 'my_number' => 'getMyNumber', + 'my_string' => 'getMyString', + 'my_boolean' => 'getMyBoolean' + ]; + + public static function attributeMap() + { + return self::$attributeMap; + } + + public static function setters() + { + return self::$setters; + } + + public static function getters() + { + return self::$getters; + } + + + + + + /** + * Associative array for storing property values + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * @param mixed[] $data Associated array of property values initializing the model + */ + public function __construct(array $data = null) + { + $this->container['my_number'] = isset($data['my_number']) ? $data['my_number'] : null; + $this->container['my_string'] = isset($data['my_string']) ? $data['my_string'] : null; + $this->container['my_boolean'] = isset($data['my_boolean']) ? $data['my_boolean'] : null; + } + + /** + * show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalid_properties = []; + + return $invalid_properties; + } + + /** + * validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + + return true; + } + + + /** + * Gets my_number + * @return \Swagger\Client\Model\OuterNumber + */ + public function getMyNumber() + { + return $this->container['my_number']; + } + + /** + * Sets my_number + * @param \Swagger\Client\Model\OuterNumber $my_number + * @return $this + */ + public function setMyNumber($my_number) + { + $this->container['my_number'] = $my_number; + + return $this; + } + + /** + * Gets my_string + * @return \Swagger\Client\Model\OuterString + */ + public function getMyString() + { + return $this->container['my_string']; + } + + /** + * Sets my_string + * @param \Swagger\Client\Model\OuterString $my_string + * @return $this + */ + public function setMyString($my_string) + { + $this->container['my_string'] = $my_string; + + return $this; + } + + /** + * Gets my_boolean + * @return \Swagger\Client\Model\OuterBoolean + */ + public function getMyBoolean() + { + return $this->container['my_boolean']; + } + + /** + * Sets my_boolean + * @param \Swagger\Client\Model\OuterBoolean $my_boolean + * @return $this + */ + public function setMyBoolean($my_boolean) + { + $this->container['my_boolean'] = $my_boolean; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * @param integer $offset Offset + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterNumber.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterNumber.php new file mode 100644 index 00000000000..3bf5d2fe4a0 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterNumber.php @@ -0,0 +1,207 @@ +container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterString.php b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterString.php new file mode 100644 index 00000000000..9e441c8d3fa --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/lib/Model/OuterString.php @@ -0,0 +1,207 @@ +container[$offset]); + } + + /** + * Gets offset. + * @param integer $offset Offset + * @return mixed + */ + public function offsetGet($offset) + { + return isset($this->container[$offset]) ? $this->container[$offset] : null; + } + + /** + * Sets value based on offset. + * @param integer $offset Offset + * @param mixed $value Value to be set + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * @param integer $offset Offset + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Gets the string presentation of the object + * @return string + */ + public function __toString() + { + if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this), JSON_PRETTY_PRINT); + } + + return json_encode(\Swagger\Client\ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/samples/client/petstore/php/SwaggerClient-php/test/Model/OuterBooleanTest.php b/samples/client/petstore/php/SwaggerClient-php/test/Model/OuterBooleanTest.php new file mode 100644 index 00000000000..8252fad1e85 --- /dev/null +++ b/samples/client/petstore/php/SwaggerClient-php/test/Model/OuterBooleanTest.php @@ -0,0 +1,85 @@ +test_client_model: %s\n" % e) + print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e) ``` @@ -69,6 +68,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +*FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +*FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +*FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters @@ -122,7 +125,11 @@ Class | Method | HTTP request | Description - [Name](docs/Name.md) - [NumberOnly](docs/NumberOnly.md) - [Order](docs/Order.md) + - [OuterBoolean](docs/OuterBoolean.md) + - [OuterComposite](docs/OuterComposite.md) - [OuterEnum](docs/OuterEnum.md) + - [OuterNumber](docs/OuterNumber.md) + - [OuterString](docs/OuterString.md) - [Pet](docs/Pet.md) - [ReadOnlyFirst](docs/ReadOnlyFirst.md) - [SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/python/docs/FakeApi.md b/samples/client/petstore/python/docs/FakeApi.md index fe2af1bac39..c17b8e743f3 100644 --- a/samples/client/petstore/python/docs/FakeApi.md +++ b/samples/client/petstore/python/docs/FakeApi.md @@ -4,11 +4,203 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +# **fake_outer_boolean_serialize** +> OuterBoolean fake_outer_boolean_serialize(body=body) + + + +Test serialization of outer boolean types + +### Example +```python +from __future__ import print_statement +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() +body = petstore_api.OuterBoolean() # OuterBoolean | Input boolean as post body (optional) + +try: + api_response = api_instance.fake_outer_boolean_serialize(body=body) + pprint(api_response) +except ApiException as e: + print("Exception when calling FakeApi->fake_outer_boolean_serialize: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_composite_serialize** +> OuterComposite fake_outer_composite_serialize(body=body) + + + +Test serialization of object with outer number type + +### Example +```python +from __future__ import print_statement +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() +body = petstore_api.OuterComposite() # OuterComposite | Input composite as post body (optional) + +try: + api_response = api_instance.fake_outer_composite_serialize(body=body) + pprint(api_response) +except ApiException as e: + print("Exception when calling FakeApi->fake_outer_composite_serialize: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_number_serialize** +> OuterNumber fake_outer_number_serialize(body=body) + + + +Test serialization of outer number types + +### Example +```python +from __future__ import print_statement +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() +body = petstore_api.OuterNumber() # OuterNumber | Input number as post body (optional) + +try: + api_response = api_instance.fake_outer_number_serialize(body=body) + pprint(api_response) +except ApiException as e: + print("Exception when calling FakeApi->fake_outer_number_serialize: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **fake_outer_string_serialize** +> OuterString fake_outer_string_serialize(body=body) + + + +Test serialization of outer string types + +### Example +```python +from __future__ import print_statement +import time +import petstore_api +from petstore_api.rest import ApiException +from pprint import pprint + +# create an instance of the API class +api_instance = petstore_api.FakeApi() +body = petstore_api.OuterString() # OuterString | Input string as post body (optional) + +try: + api_response = api_instance.fake_outer_string_serialize(body=body) + pprint(api_response) +except ApiException as e: + print("Exception when calling FakeApi->fake_outer_string_serialize: %s\n" % e) +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **test_client_model** > Client test_client_model(body) diff --git a/samples/client/petstore/python/docs/OuterBoolean.md b/samples/client/petstore/python/docs/OuterBoolean.md new file mode 100644 index 00000000000..8b243399474 --- /dev/null +++ b/samples/client/petstore/python/docs/OuterBoolean.md @@ -0,0 +1,9 @@ +# OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python/docs/OuterComposite.md b/samples/client/petstore/python/docs/OuterComposite.md new file mode 100644 index 00000000000..159e67b48ee --- /dev/null +++ b/samples/client/petstore/python/docs/OuterComposite.md @@ -0,0 +1,12 @@ +# OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | [**OuterNumber**](OuterNumber.md) | | [optional] +**my_string** | [**OuterString**](OuterString.md) | | [optional] +**my_boolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python/docs/OuterNumber.md b/samples/client/petstore/python/docs/OuterNumber.md new file mode 100644 index 00000000000..8aa37f329bd --- /dev/null +++ b/samples/client/petstore/python/docs/OuterNumber.md @@ -0,0 +1,9 @@ +# OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python/docs/OuterString.md b/samples/client/petstore/python/docs/OuterString.md new file mode 100644 index 00000000000..9ccaadaf98d --- /dev/null +++ b/samples/client/petstore/python/docs/OuterString.md @@ -0,0 +1,9 @@ +# OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/samples/client/petstore/python/petstore_api/__init__.py b/samples/client/petstore/python/petstore_api/__init__.py index ad757bce261..f9c576b13e7 100644 --- a/samples/client/petstore/python/petstore_api/__init__.py +++ b/samples/client/petstore/python/petstore_api/__init__.py @@ -40,7 +40,11 @@ from .models.model_return import ModelReturn from .models.name import Name from .models.number_only import NumberOnly from .models.order import Order +from .models.outer_boolean import OuterBoolean +from .models.outer_composite import OuterComposite from .models.outer_enum import OuterEnum +from .models.outer_number import OuterNumber +from .models.outer_string import OuterString from .models.pet import Pet from .models.read_only_first import ReadOnlyFirst from .models.special_model_name import SpecialModelName diff --git a/samples/client/petstore/python/petstore_api/apis/fake_api.py b/samples/client/petstore/python/petstore_api/apis/fake_api.py index 5b755f35db4..9ee76132b87 100644 --- a/samples/client/petstore/python/petstore_api/apis/fake_api.py +++ b/samples/client/petstore/python/petstore_api/apis/fake_api.py @@ -40,6 +40,378 @@ class FakeApi(object): config.api_client = ApiClient() self.api_client = config.api_client + def fake_outer_boolean_serialize(self, **kwargs): + """ + Test serialization of outer boolean types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_boolean_serialize(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterBoolean body: Input boolean as post body + :return: OuterBoolean + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.fake_outer_boolean_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_boolean_serialize_with_http_info(**kwargs) + return data + + def fake_outer_boolean_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer boolean types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_boolean_serialize_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterBoolean body: Input boolean as post body + :return: OuterBoolean + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_boolean_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/boolean', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterBoolean', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_composite_serialize(self, **kwargs): + """ + Test serialization of object with outer number type + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_composite_serialize(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterComposite body: Input composite as post body + :return: OuterComposite + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.fake_outer_composite_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_composite_serialize_with_http_info(**kwargs) + return data + + def fake_outer_composite_serialize_with_http_info(self, **kwargs): + """ + Test serialization of object with outer number type + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_composite_serialize_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterComposite body: Input composite as post body + :return: OuterComposite + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_composite_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/composite', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterComposite', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_number_serialize(self, **kwargs): + """ + Test serialization of outer number types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_number_serialize(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterNumber body: Input number as post body + :return: OuterNumber + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.fake_outer_number_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_number_serialize_with_http_info(**kwargs) + return data + + def fake_outer_number_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer number types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_number_serialize_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterNumber body: Input number as post body + :return: OuterNumber + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_number_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/number', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterNumber', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + + def fake_outer_string_serialize(self, **kwargs): + """ + Test serialization of outer string types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_string_serialize(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterString body: Input string as post body + :return: OuterString + If the method is called asynchronously, + returns the request thread. + """ + kwargs['_return_http_data_only'] = True + if kwargs.get('callback'): + return self.fake_outer_string_serialize_with_http_info(**kwargs) + else: + (data) = self.fake_outer_string_serialize_with_http_info(**kwargs) + return data + + def fake_outer_string_serialize_with_http_info(self, **kwargs): + """ + Test serialization of outer string types + This method makes a synchronous HTTP request by default. To make an + asynchronous HTTP request, please define a `callback` function + to be invoked when receiving the response. + >>> def callback_function(response): + >>> pprint(response) + >>> + >>> thread = api.fake_outer_string_serialize_with_http_info(callback=callback_function) + + :param callback function: The callback function + for asynchronous request. (optional) + :param OuterString body: Input string as post body + :return: OuterString + If the method is called asynchronously, + returns the request thread. + """ + + all_params = ['body'] + all_params.append('callback') + all_params.append('_return_http_data_only') + all_params.append('_preload_content') + all_params.append('_request_timeout') + + params = locals() + for key, val in iteritems(params['kwargs']): + if key not in all_params: + raise TypeError( + "Got an unexpected keyword argument '%s'" + " to method fake_outer_string_serialize" % key + ) + params[key] = val + del params['kwargs'] + + + collection_formats = {} + + path_params = {} + + query_params = {} + + header_params = {} + + form_params = [] + local_var_files = {} + + body_params = None + if 'body' in params: + body_params = params['body'] + # Authentication setting + auth_settings = [] + + return self.api_client.call_api('/fake/outer/string', 'POST', + path_params, + query_params, + header_params, + body=body_params, + post_params=form_params, + files=local_var_files, + response_type='OuterString', + auth_settings=auth_settings, + callback=params.get('callback'), + _return_http_data_only=params.get('_return_http_data_only'), + _preload_content=params.get('_preload_content', True), + _request_timeout=params.get('_request_timeout'), + collection_formats=collection_formats) + def test_client_model(self, body, **kwargs): """ To test \"client\" model diff --git a/samples/client/petstore/python/petstore_api/models/__init__.py b/samples/client/petstore/python/petstore_api/models/__init__.py index f2a15c2d194..ea4684d5482 100644 --- a/samples/client/petstore/python/petstore_api/models/__init__.py +++ b/samples/client/petstore/python/petstore_api/models/__init__.py @@ -40,7 +40,11 @@ from .model_return import ModelReturn from .name import Name from .number_only import NumberOnly from .order import Order +from .outer_boolean import OuterBoolean +from .outer_composite import OuterComposite from .outer_enum import OuterEnum +from .outer_number import OuterNumber +from .outer_string import OuterString from .pet import Pet from .read_only_first import ReadOnlyFirst from .special_model_name import SpecialModelName diff --git a/samples/client/petstore/python/petstore_api/models/outer_boolean.py b/samples/client/petstore/python/petstore_api/models/outer_boolean.py new file mode 100644 index 00000000000..c3d04c856be --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/outer_boolean.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterBoolean(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + OuterBoolean - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + + } + + self.attribute_map = { + + } + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterBoolean): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python/petstore_api/models/outer_composite.py b/samples/client/petstore/python/petstore_api/models/outer_composite.py new file mode 100644 index 00000000000..8861eb354d5 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/outer_composite.py @@ -0,0 +1,163 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterComposite(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self, my_number=None, my_string=None, my_boolean=None): + """ + OuterComposite - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + 'my_number': 'OuterNumber', + 'my_string': 'OuterString', + 'my_boolean': 'OuterBoolean' + } + + self.attribute_map = { + 'my_number': 'my_number', + 'my_string': 'my_string', + 'my_boolean': 'my_boolean' + } + + self._my_number = my_number + self._my_string = my_string + self._my_boolean = my_boolean + + @property + def my_number(self): + """ + Gets the my_number of this OuterComposite. + + :return: The my_number of this OuterComposite. + :rtype: OuterNumber + """ + return self._my_number + + @my_number.setter + def my_number(self, my_number): + """ + Sets the my_number of this OuterComposite. + + :param my_number: The my_number of this OuterComposite. + :type: OuterNumber + """ + + self._my_number = my_number + + @property + def my_string(self): + """ + Gets the my_string of this OuterComposite. + + :return: The my_string of this OuterComposite. + :rtype: OuterString + """ + return self._my_string + + @my_string.setter + def my_string(self, my_string): + """ + Sets the my_string of this OuterComposite. + + :param my_string: The my_string of this OuterComposite. + :type: OuterString + """ + + self._my_string = my_string + + @property + def my_boolean(self): + """ + Gets the my_boolean of this OuterComposite. + + :return: The my_boolean of this OuterComposite. + :rtype: OuterBoolean + """ + return self._my_boolean + + @my_boolean.setter + def my_boolean(self, my_boolean): + """ + Sets the my_boolean of this OuterComposite. + + :param my_boolean: The my_boolean of this OuterComposite. + :type: OuterBoolean + """ + + self._my_boolean = my_boolean + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterComposite): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python/petstore_api/models/outer_number.py b/samples/client/petstore/python/petstore_api/models/outer_number.py new file mode 100644 index 00000000000..93087bff27c --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/outer_number.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterNumber(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + OuterNumber - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + + } + + self.attribute_map = { + + } + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterNumber): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python/petstore_api/models/outer_string.py b/samples/client/petstore/python/petstore_api/models/outer_string.py new file mode 100644 index 00000000000..dab30f6aca7 --- /dev/null +++ b/samples/client/petstore/python/petstore_api/models/outer_string.py @@ -0,0 +1,93 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from pprint import pformat +from six import iteritems +import re + + +class OuterString(object): + """ + NOTE: This class is auto generated by the swagger code generator program. + Do not edit the class manually. + """ + def __init__(self): + """ + OuterString - a model defined in Swagger + + :param dict swaggerTypes: The key is attribute name + and the value is attribute type. + :param dict attributeMap: The key is attribute name + and the value is json key in definition. + """ + self.swagger_types = { + + } + + self.attribute_map = { + + } + + + def to_dict(self): + """ + Returns the model properties as a dict + """ + result = {} + + for attr, _ in iteritems(self.swagger_types): + value = getattr(self, attr) + if isinstance(value, list): + result[attr] = list(map( + lambda x: x.to_dict() if hasattr(x, "to_dict") else x, + value + )) + elif hasattr(value, "to_dict"): + result[attr] = value.to_dict() + elif isinstance(value, dict): + result[attr] = dict(map( + lambda item: (item[0], item[1].to_dict()) + if hasattr(item[1], "to_dict") else item, + value.items() + )) + else: + result[attr] = value + + return result + + def to_str(self): + """ + Returns the string representation of the model + """ + return pformat(self.to_dict()) + + def __repr__(self): + """ + For `print` and `pprint` + """ + return self.to_str() + + def __eq__(self, other): + """ + Returns true if both objects are equal + """ + if not isinstance(other, OuterString): + return False + + return self.__dict__ == other.__dict__ + + def __ne__(self, other): + """ + Returns true if both objects are not equal + """ + return not self == other diff --git a/samples/client/petstore/python/test/test_outer_boolean.py b/samples/client/petstore/python/test/test_outer_boolean.py new file mode 100644 index 00000000000..082b05cf928 --- /dev/null +++ b/samples/client/petstore/python/test/test_outer_boolean.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_boolean import OuterBoolean + + +class TestOuterBoolean(unittest.TestCase): + """ OuterBoolean unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterBoolean(self): + """ + Test OuterBoolean + """ + model = petstore_api.models.outer_boolean.OuterBoolean() + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/test/test_outer_composite.py b/samples/client/petstore/python/test/test_outer_composite.py new file mode 100644 index 00000000000..fa084c04bf2 --- /dev/null +++ b/samples/client/petstore/python/test/test_outer_composite.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_composite import OuterComposite + + +class TestOuterComposite(unittest.TestCase): + """ OuterComposite unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterComposite(self): + """ + Test OuterComposite + """ + model = petstore_api.models.outer_composite.OuterComposite() + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/test/test_outer_number.py b/samples/client/petstore/python/test/test_outer_number.py new file mode 100644 index 00000000000..4019b356bc4 --- /dev/null +++ b/samples/client/petstore/python/test/test_outer_number.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_number import OuterNumber + + +class TestOuterNumber(unittest.TestCase): + """ OuterNumber unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterNumber(self): + """ + Test OuterNumber + """ + model = petstore_api.models.outer_number.OuterNumber() + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/python/test/test_outer_string.py b/samples/client/petstore/python/test/test_outer_string.py new file mode 100644 index 00000000000..a23c7815efe --- /dev/null +++ b/samples/client/petstore/python/test/test_outer_string.py @@ -0,0 +1,42 @@ +# coding: utf-8 + +""" + Swagger Petstore + + This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + + OpenAPI spec version: 1.0.0 + Contact: apiteam@swagger.io + Generated by: https://github.com/swagger-api/swagger-codegen.git +""" + + +from __future__ import absolute_import + +import os +import sys +import unittest + +import petstore_api +from petstore_api.rest import ApiException +from petstore_api.models.outer_string import OuterString + + +class TestOuterString(unittest.TestCase): + """ OuterString unit test stubs """ + + def setUp(self): + pass + + def tearDown(self): + pass + + def testOuterString(self): + """ + Test OuterString + """ + model = petstore_api.models.outer_string.OuterString() + + +if __name__ == '__main__': + unittest.main() diff --git a/samples/client/petstore/ruby/README.md b/samples/client/petstore/ruby/README.md index 02e13cfbbad..65217541997 100644 --- a/samples/client/petstore/ruby/README.md +++ b/samples/client/petstore/ruby/README.md @@ -56,15 +56,15 @@ require 'petstore' api_instance = Petstore::FakeApi.new -body = Petstore::Client.new # Client | client model - +opts = { + body: Petstore::OuterBoolean.new # OuterBoolean | Input boolean as post body +} begin - #To test \"client\" model - result = api_instance.test_client_model(body) + result = api_instance.fake_outer_boolean_serialize(opts) p result rescue Petstore::ApiError => e - puts "Exception when calling FakeApi->test_client_model: #{e}" + puts "Exception when calling FakeApi->fake_outer_boolean_serialize: #{e}" end ``` @@ -75,6 +75,10 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- +*Petstore::FakeApi* | [**fake_outer_boolean_serialize**](docs/FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +*Petstore::FakeApi* | [**fake_outer_composite_serialize**](docs/FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +*Petstore::FakeApi* | [**fake_outer_number_serialize**](docs/FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +*Petstore::FakeApi* | [**fake_outer_string_serialize**](docs/FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | *Petstore::FakeApi* | [**test_client_model**](docs/FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model *Petstore::FakeApi* | [**test_endpoint_parameters**](docs/FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 *Petstore::FakeApi* | [**test_enum_parameters**](docs/FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters @@ -128,7 +132,11 @@ Class | Method | HTTP request | Description - [Petstore::Name](docs/Name.md) - [Petstore::NumberOnly](docs/NumberOnly.md) - [Petstore::Order](docs/Order.md) + - [Petstore::OuterBoolean](docs/OuterBoolean.md) + - [Petstore::OuterComposite](docs/OuterComposite.md) - [Petstore::OuterEnum](docs/OuterEnum.md) + - [Petstore::OuterNumber](docs/OuterNumber.md) + - [Petstore::OuterString](docs/OuterString.md) - [Petstore::Pet](docs/Pet.md) - [Petstore::ReadOnlyFirst](docs/ReadOnlyFirst.md) - [Petstore::SpecialModelName](docs/SpecialModelName.md) diff --git a/samples/client/petstore/ruby/docs/FakeApi.md b/samples/client/petstore/ruby/docs/FakeApi.md index 9d973dec95c..70cf50ad999 100644 --- a/samples/client/petstore/ruby/docs/FakeApi.md +++ b/samples/client/petstore/ruby/docs/FakeApi.md @@ -4,11 +4,203 @@ All URIs are relative to *http://petstore.swagger.io:80/v2* Method | HTTP request | Description ------------- | ------------- | ------------- +[**fake_outer_boolean_serialize**](FakeApi.md#fake_outer_boolean_serialize) | **POST** /fake/outer/boolean | +[**fake_outer_composite_serialize**](FakeApi.md#fake_outer_composite_serialize) | **POST** /fake/outer/composite | +[**fake_outer_number_serialize**](FakeApi.md#fake_outer_number_serialize) | **POST** /fake/outer/number | +[**fake_outer_string_serialize**](FakeApi.md#fake_outer_string_serialize) | **POST** /fake/outer/string | [**test_client_model**](FakeApi.md#test_client_model) | **PATCH** /fake | To test \"client\" model [**test_endpoint_parameters**](FakeApi.md#test_endpoint_parameters) | **POST** /fake | Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 [**test_enum_parameters**](FakeApi.md#test_enum_parameters) | **GET** /fake | To test enum parameters +# **fake_outer_boolean_serialize** +> OuterBoolean fake_outer_boolean_serialize(opts) + + + +Test serialization of outer boolean types + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new + +opts = { + body: Petstore::OuterBoolean.new # OuterBoolean | Input boolean as post body +} + +begin + result = api_instance.fake_outer_boolean_serialize(opts) + p result +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->fake_outer_boolean_serialize: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterBoolean**](OuterBoolean.md)| Input boolean as post body | [optional] + +### Return type + +[**OuterBoolean**](OuterBoolean.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + + +# **fake_outer_composite_serialize** +> OuterComposite fake_outer_composite_serialize(opts) + + + +Test serialization of object with outer number type + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new + +opts = { + body: Petstore::OuterComposite.new # OuterComposite | Input composite as post body +} + +begin + result = api_instance.fake_outer_composite_serialize(opts) + p result +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->fake_outer_composite_serialize: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterComposite**](OuterComposite.md)| Input composite as post body | [optional] + +### Return type + +[**OuterComposite**](OuterComposite.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + + +# **fake_outer_number_serialize** +> OuterNumber fake_outer_number_serialize(opts) + + + +Test serialization of outer number types + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new + +opts = { + body: Petstore::OuterNumber.new # OuterNumber | Input number as post body +} + +begin + result = api_instance.fake_outer_number_serialize(opts) + p result +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->fake_outer_number_serialize: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterNumber**](OuterNumber.md)| Input number as post body | [optional] + +### Return type + +[**OuterNumber**](OuterNumber.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + + +# **fake_outer_string_serialize** +> OuterString fake_outer_string_serialize(opts) + + + +Test serialization of outer string types + +### Example +```ruby +# load the gem +require 'petstore' + +api_instance = Petstore::FakeApi.new + +opts = { + body: Petstore::OuterString.new # OuterString | Input string as post body +} + +begin + result = api_instance.fake_outer_string_serialize(opts) + p result +rescue Petstore::ApiError => e + puts "Exception when calling FakeApi->fake_outer_string_serialize: #{e}" +end +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **body** | [**OuterString**](OuterString.md)| Input string as post body | [optional] + +### Return type + +[**OuterString**](OuterString.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + + + # **test_client_model** > Client test_client_model(body) diff --git a/samples/client/petstore/ruby/docs/OuterBoolean.md b/samples/client/petstore/ruby/docs/OuterBoolean.md new file mode 100644 index 00000000000..99ef646b200 --- /dev/null +++ b/samples/client/petstore/ruby/docs/OuterBoolean.md @@ -0,0 +1,7 @@ +# Petstore::OuterBoolean + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/ruby/docs/OuterComposite.md b/samples/client/petstore/ruby/docs/OuterComposite.md new file mode 100644 index 00000000000..61b46c8c931 --- /dev/null +++ b/samples/client/petstore/ruby/docs/OuterComposite.md @@ -0,0 +1,10 @@ +# Petstore::OuterComposite + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**my_number** | [**OuterNumber**](OuterNumber.md) | | [optional] +**my_string** | [**OuterString**](OuterString.md) | | [optional] +**my_boolean** | [**OuterBoolean**](OuterBoolean.md) | | [optional] + + diff --git a/samples/client/petstore/ruby/docs/OuterNumber.md b/samples/client/petstore/ruby/docs/OuterNumber.md new file mode 100644 index 00000000000..a9da0d32d80 --- /dev/null +++ b/samples/client/petstore/ruby/docs/OuterNumber.md @@ -0,0 +1,7 @@ +# Petstore::OuterNumber + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/ruby/docs/OuterString.md b/samples/client/petstore/ruby/docs/OuterString.md new file mode 100644 index 00000000000..33942e53b1f --- /dev/null +++ b/samples/client/petstore/ruby/docs/OuterString.md @@ -0,0 +1,7 @@ +# Petstore::OuterString + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + + diff --git a/samples/client/petstore/ruby/lib/petstore.rb b/samples/client/petstore/ruby/lib/petstore.rb index ce07a8d26f6..a8a5d88e087 100644 --- a/samples/client/petstore/ruby/lib/petstore.rb +++ b/samples/client/petstore/ruby/lib/petstore.rb @@ -43,7 +43,11 @@ require 'petstore/models/model_return' require 'petstore/models/name' require 'petstore/models/number_only' require 'petstore/models/order' +require 'petstore/models/outer_boolean' +require 'petstore/models/outer_composite' require 'petstore/models/outer_enum' +require 'petstore/models/outer_number' +require 'petstore/models/outer_string' require 'petstore/models/pet' require 'petstore/models/read_only_first' require 'petstore/models/special_model_name' diff --git a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb index ca371301da9..adf79a57448 100644 --- a/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb +++ b/samples/client/petstore/ruby/lib/petstore/api/fake_api.rb @@ -20,6 +20,194 @@ module Petstore @api_client = api_client end + # + # Test serialization of outer boolean types + # @param [Hash] opts the optional parameters + # @option opts [OuterBoolean] :body Input boolean as post body + # @return [OuterBoolean] + def fake_outer_boolean_serialize(opts = {}) + data, _status_code, _headers = fake_outer_boolean_serialize_with_http_info(opts) + return data + end + + # + # Test serialization of outer boolean types + # @param [Hash] opts the optional parameters + # @option opts [OuterBoolean] :body Input boolean as post body + # @return [Array<(OuterBoolean, Fixnum, Hash)>] OuterBoolean data, response status code and response headers + def fake_outer_boolean_serialize_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FakeApi.fake_outer_boolean_serialize ..." + end + # resource path + local_var_path = "/fake/outer/boolean" + + # query parameters + query_params = {} + + # header parameters + header_params = {} + + # form parameters + form_params = {} + + # http body (model) + post_body = @api_client.object_to_http_body(opts[:'body']) + auth_names = [] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'OuterBoolean') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_outer_boolean_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # + # Test serialization of object with outer number type + # @param [Hash] opts the optional parameters + # @option opts [OuterComposite] :body Input composite as post body + # @return [OuterComposite] + def fake_outer_composite_serialize(opts = {}) + data, _status_code, _headers = fake_outer_composite_serialize_with_http_info(opts) + return data + end + + # + # Test serialization of object with outer number type + # @param [Hash] opts the optional parameters + # @option opts [OuterComposite] :body Input composite as post body + # @return [Array<(OuterComposite, Fixnum, Hash)>] OuterComposite data, response status code and response headers + def fake_outer_composite_serialize_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FakeApi.fake_outer_composite_serialize ..." + end + # resource path + local_var_path = "/fake/outer/composite" + + # query parameters + query_params = {} + + # header parameters + header_params = {} + + # form parameters + form_params = {} + + # http body (model) + post_body = @api_client.object_to_http_body(opts[:'body']) + auth_names = [] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'OuterComposite') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_outer_composite_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # + # Test serialization of outer number types + # @param [Hash] opts the optional parameters + # @option opts [OuterNumber] :body Input number as post body + # @return [OuterNumber] + def fake_outer_number_serialize(opts = {}) + data, _status_code, _headers = fake_outer_number_serialize_with_http_info(opts) + return data + end + + # + # Test serialization of outer number types + # @param [Hash] opts the optional parameters + # @option opts [OuterNumber] :body Input number as post body + # @return [Array<(OuterNumber, Fixnum, Hash)>] OuterNumber data, response status code and response headers + def fake_outer_number_serialize_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FakeApi.fake_outer_number_serialize ..." + end + # resource path + local_var_path = "/fake/outer/number" + + # query parameters + query_params = {} + + # header parameters + header_params = {} + + # form parameters + form_params = {} + + # http body (model) + post_body = @api_client.object_to_http_body(opts[:'body']) + auth_names = [] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'OuterNumber') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_outer_number_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + + # + # Test serialization of outer string types + # @param [Hash] opts the optional parameters + # @option opts [OuterString] :body Input string as post body + # @return [OuterString] + def fake_outer_string_serialize(opts = {}) + data, _status_code, _headers = fake_outer_string_serialize_with_http_info(opts) + return data + end + + # + # Test serialization of outer string types + # @param [Hash] opts the optional parameters + # @option opts [OuterString] :body Input string as post body + # @return [Array<(OuterString, Fixnum, Hash)>] OuterString data, response status code and response headers + def fake_outer_string_serialize_with_http_info(opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug "Calling API: FakeApi.fake_outer_string_serialize ..." + end + # resource path + local_var_path = "/fake/outer/string" + + # query parameters + query_params = {} + + # header parameters + header_params = {} + + # form parameters + form_params = {} + + # http body (model) + post_body = @api_client.object_to_http_body(opts[:'body']) + auth_names = [] + data, status_code, headers = @api_client.call_api(:POST, local_var_path, + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => 'OuterString') + if @api_client.config.debugging + @api_client.config.logger.debug "API called: FakeApi#fake_outer_string_serialize\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + return data, status_code, headers + end + # To test \"client\" model # To test \"client\" model # @param body client model diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_boolean.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_boolean.rb new file mode 100644 index 00000000000..a5c47be992e --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_boolean.rb @@ -0,0 +1,178 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module Petstore + + class OuterBoolean + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb new file mode 100644 index 00000000000..0d642a575c5 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_composite.rb @@ -0,0 +1,205 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module Petstore + + class OuterComposite + attr_accessor :my_number + + attr_accessor :my_string + + attr_accessor :my_boolean + + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'my_number' => :'my_number', + :'my_string' => :'my_string', + :'my_boolean' => :'my_boolean' + } + end + + # Attribute type mapping. + def self.swagger_types + { + :'my_number' => :'OuterNumber', + :'my_string' => :'OuterString', + :'my_boolean' => :'OuterBoolean' + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + if attributes.has_key?(:'my_number') + self.my_number = attributes[:'my_number'] + end + + if attributes.has_key?(:'my_string') + self.my_string = attributes[:'my_string'] + end + + if attributes.has_key?(:'my_boolean') + self.my_boolean = attributes[:'my_boolean'] + end + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + my_number == o.my_number && + my_string == o.my_string && + my_boolean == o.my_boolean + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [my_number, my_string, my_boolean].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_number.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_number.rb new file mode 100644 index 00000000000..07b7abe64ba --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_number.rb @@ -0,0 +1,178 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module Petstore + + class OuterNumber + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby/lib/petstore/models/outer_string.rb b/samples/client/petstore/ruby/lib/petstore/models/outer_string.rb new file mode 100644 index 00000000000..26ba9e52298 --- /dev/null +++ b/samples/client/petstore/ruby/lib/petstore/models/outer_string.rb @@ -0,0 +1,178 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'date' + +module Petstore + + class OuterString + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + } + end + + # Attribute type mapping. + def self.swagger_types + { + } + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + return unless attributes.is_a?(Hash) + + # convert string to symbol for hash key + attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v} + + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properies with the reasons + def list_invalid_properties + invalid_properties = Array.new + return invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Fixnum] Hash code + def hash + [].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + self.class.swagger_types.each_pair do |key, type| + if type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } ) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end # or else data not found in attributes(hash), not an issue as the data can be optional + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :DateTime + DateTime.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :BOOLEAN + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + temp_model = Petstore.const_get(type).new + temp_model.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + next if value.nil? + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map{ |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/samples/client/petstore/ruby/spec/models/outer_boolean_spec.rb b/samples/client/petstore/ruby/spec/models/outer_boolean_spec.rb new file mode 100644 index 00000000000..f4fd2b3bb41 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/outer_boolean_spec.rb @@ -0,0 +1,35 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::OuterBoolean +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'OuterBoolean' do + before do + # run before each test + @instance = Petstore::OuterBoolean.new + end + + after do + # run after each test + end + + describe 'test an instance of OuterBoolean' do + it 'should create an instact of OuterBoolean' do + expect(@instance).to be_instance_of(Petstore::OuterBoolean) + end + end +end + diff --git a/samples/client/petstore/ruby/spec/models/outer_composite_spec.rb b/samples/client/petstore/ruby/spec/models/outer_composite_spec.rb new file mode 100644 index 00000000000..34b27e40cc7 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/outer_composite_spec.rb @@ -0,0 +1,53 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::OuterComposite +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'OuterComposite' do + before do + # run before each test + @instance = Petstore::OuterComposite.new + end + + after do + # run after each test + end + + describe 'test an instance of OuterComposite' do + it 'should create an instact of OuterComposite' do + expect(@instance).to be_instance_of(Petstore::OuterComposite) + end + end + describe 'test attribute "my_number"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "my_string"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "my_boolean"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end + diff --git a/samples/client/petstore/ruby/spec/models/outer_number_spec.rb b/samples/client/petstore/ruby/spec/models/outer_number_spec.rb new file mode 100644 index 00000000000..144abfaa14c --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/outer_number_spec.rb @@ -0,0 +1,35 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::OuterNumber +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'OuterNumber' do + before do + # run before each test + @instance = Petstore::OuterNumber.new + end + + after do + # run after each test + end + + describe 'test an instance of OuterNumber' do + it 'should create an instact of OuterNumber' do + expect(@instance).to be_instance_of(Petstore::OuterNumber) + end + end +end + diff --git a/samples/client/petstore/ruby/spec/models/outer_string_spec.rb b/samples/client/petstore/ruby/spec/models/outer_string_spec.rb new file mode 100644 index 00000000000..e8a51b69c63 --- /dev/null +++ b/samples/client/petstore/ruby/spec/models/outer_string_spec.rb @@ -0,0 +1,35 @@ +=begin +#Swagger Petstore + +#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + +OpenAPI spec version: 1.0.0 +Contact: apiteam@swagger.io +Generated by: https://github.com/swagger-api/swagger-codegen.git + +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Petstore::OuterString +# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen) +# Please update as you see appropriate +describe 'OuterString' do + before do + # run before each test + @instance = Petstore::OuterString.new + end + + after do + # run after each test + end + + describe 'test an instance of OuterString' do + it 'should create an instact of OuterString' do + expect(@instance).to be_instance_of(Petstore::OuterString) + end + end +end + diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift index 36969deb653..c061bb819fb 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift @@ -11,6 +11,146 @@ import Alamofire open class FakeAPI: APIBase { + /** + + - parameter body: (body) Input boolean as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterBooleanSerialize(body: OuterBoolean? = nil, completion: @escaping ((_ data: OuterBoolean?,_ error: Error?) -> Void)) { + fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + - POST /fake/outer/boolean + - Test serialization of outer boolean types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input boolean as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: OuterBoolean? = nil) -> RequestBuilder { + let path = "/fake/outer/boolean" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + - POST /fake/outer/composite + - Test serialization of object with outer number type + - examples: [{contentType=application/json, example={ + "my_string" : { }, + "my_number" : { }, + "my_boolean" : { } +}}] + + - parameter body: (body) Input composite as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder { + let path = "/fake/outer/composite" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input number as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterNumberSerialize(body: OuterNumber? = nil, completion: @escaping ((_ data: OuterNumber?,_ error: Error?) -> Void)) { + fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + - POST /fake/outer/number + - Test serialization of outer number types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input number as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterNumberSerializeWithRequestBuilder(body: OuterNumber? = nil) -> RequestBuilder { + let path = "/fake/outer/number" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input string as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterStringSerialize(body: OuterString? = nil, completion: @escaping ((_ data: OuterString?,_ error: Error?) -> Void)) { + fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + + /** + - POST /fake/outer/string + - Test serialization of outer string types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input string as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterStringSerializeWithRequestBuilder(body: OuterString? = nil) -> RequestBuilder { + let path = "/fake/outer/string" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + /** To test \"client\" model diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift index 79af37e3021..bd15c4420d5 100644 --- a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models.swift @@ -572,6 +572,35 @@ class Decoders { } + // Decoder for [OuterBoolean] + Decoders.addDecoder(clazz: [OuterBoolean].self) { (source: AnyObject) -> [OuterBoolean] in + return Decoders.decode(clazz: [OuterBoolean].self, source: source) + } + // Decoder for OuterBoolean + Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject) -> OuterBoolean in + if let source = source as? Bool { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterBoolean: Maybe swagger file is insufficient") + } + + + // Decoder for [OuterComposite] + Decoders.addDecoder(clazz: [OuterComposite].self) { (source: AnyObject) -> [OuterComposite] in + return Decoders.decode(clazz: [OuterComposite].self, source: source) + } + // Decoder for OuterComposite + Decoders.addDecoder(clazz: OuterComposite.self) { (source: AnyObject) -> OuterComposite in + let sourceDictionary = source as! [AnyHashable: Any] + + let instance = OuterComposite() + instance.myNumber = Decoders.decodeOptional(clazz: OuterNumber.self, source: sourceDictionary["my_number"] as AnyObject?) + instance.myString = Decoders.decodeOptional(clazz: OuterString.self, source: sourceDictionary["my_string"] as AnyObject?) + instance.myBoolean = Decoders.decodeOptional(clazz: OuterBoolean.self, source: sourceDictionary["my_boolean"] as AnyObject?) + return instance + } + + // Decoder for [OuterEnum] Decoders.addDecoder(clazz: [OuterEnum].self) { (source: AnyObject, instance: AnyObject?) -> [OuterEnum] in return Decoders.decode(clazz: [OuterEnum].self, source: source) @@ -587,6 +616,32 @@ class Decoders { } + // Decoder for [OuterNumber] + Decoders.addDecoder(clazz: [OuterNumber].self) { (source: AnyObject) -> [OuterNumber] in + return Decoders.decode(clazz: [OuterNumber].self, source: source) + } + // Decoder for OuterNumber + Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject) -> OuterNumber in + if let source = source as? Double { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterNumber: Maybe swagger file is insufficient") + } + + + // Decoder for [OuterString] + Decoders.addDecoder(clazz: [OuterString].self) { (source: AnyObject) -> [OuterString] in + return Decoders.decode(clazz: [OuterString].self, source: source) + } + // Decoder for OuterString + Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject) -> OuterString in + if let source = source as? String { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterString: Maybe swagger file is insufficient") + } + + // Decoder for [Pet] Decoders.addDecoder(clazz: [Pet].self) { (source: AnyObject, instance: AnyObject?) -> [Pet] in return Decoders.decode(clazz: [Pet].self, source: source) diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift new file mode 100644 index 00000000000..3c49ad29400 --- /dev/null +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift @@ -0,0 +1,11 @@ +// +// OuterBoolean.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterBoolean = Bool diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift new file mode 100644 index 00000000000..aa8de52bb81 --- /dev/null +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift @@ -0,0 +1,27 @@ +// +// OuterComposite.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +open class OuterComposite: JSONEncodable { + public var myNumber: OuterNumber? + public var myString: OuterString? + public var myBoolean: OuterBoolean? + + public init() {} + + // MARK: JSONEncodable + open func encodeToJSON() -> Any { + var nillableDictionary = [String:Any?]() + nillableDictionary["my_number"] = self.myNumber?.encodeToJSON() + nillableDictionary["my_string"] = self.myString?.encodeToJSON() + nillableDictionary["my_boolean"] = self.myBoolean?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] + return dictionary + } +} diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift new file mode 100644 index 00000000000..f285f4e5e29 --- /dev/null +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift @@ -0,0 +1,11 @@ +// +// OuterNumber.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterNumber = Double diff --git a/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterString.swift b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterString.swift new file mode 100644 index 00000000000..9da794627d6 --- /dev/null +++ b/samples/client/petstore/swift3/default/PetstoreClient/Classes/Swaggers/Models/OuterString.swift @@ -0,0 +1,11 @@ +// +// OuterString.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterString = String diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift index 0e217357c88..26039262b26 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift @@ -12,6 +12,210 @@ import PromiseKit open class FakeAPI: APIBase { + /** + + - parameter body: (body) Input boolean as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterBooleanSerialize(body: OuterBoolean? = nil, completion: @escaping ((_ data: OuterBoolean?,_ error: Error?) -> Void)) { + fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input boolean as post body (optional) + - returns: Promise + */ + open class func fakeOuterBooleanSerialize( body: OuterBoolean? = nil) -> Promise { + let deferred = Promise.pending() + fakeOuterBooleanSerialize(body: body) { data, error in + if let error = error { + deferred.reject(error) + } else { + deferred.fulfill(data!) + } + } + return deferred.promise + } + + /** + - POST /fake/outer/boolean + - Test serialization of outer boolean types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input boolean as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: OuterBoolean? = nil) -> RequestBuilder { + let path = "/fake/outer/boolean" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - returns: Promise + */ + open class func fakeOuterCompositeSerialize( body: OuterComposite? = nil) -> Promise { + let deferred = Promise.pending() + fakeOuterCompositeSerialize(body: body) { data, error in + if let error = error { + deferred.reject(error) + } else { + deferred.fulfill(data!) + } + } + return deferred.promise + } + + /** + - POST /fake/outer/composite + - Test serialization of object with outer number type + - examples: [{contentType=application/json, example={ + "my_string" : { }, + "my_number" : { }, + "my_boolean" : { } +}}] + + - parameter body: (body) Input composite as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder { + let path = "/fake/outer/composite" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input number as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterNumberSerialize(body: OuterNumber? = nil, completion: @escaping ((_ data: OuterNumber?,_ error: Error?) -> Void)) { + fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input number as post body (optional) + - returns: Promise + */ + open class func fakeOuterNumberSerialize( body: OuterNumber? = nil) -> Promise { + let deferred = Promise.pending() + fakeOuterNumberSerialize(body: body) { data, error in + if let error = error { + deferred.reject(error) + } else { + deferred.fulfill(data!) + } + } + return deferred.promise + } + + /** + - POST /fake/outer/number + - Test serialization of outer number types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input number as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterNumberSerializeWithRequestBuilder(body: OuterNumber? = nil) -> RequestBuilder { + let path = "/fake/outer/number" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input string as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterStringSerialize(body: OuterString? = nil, completion: @escaping ((_ data: OuterString?,_ error: Error?) -> Void)) { + fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input string as post body (optional) + - returns: Promise + */ + open class func fakeOuterStringSerialize( body: OuterString? = nil) -> Promise { + let deferred = Promise.pending() + fakeOuterStringSerialize(body: body) { data, error in + if let error = error { + deferred.reject(error) + } else { + deferred.fulfill(data!) + } + } + return deferred.promise + } + + /** + - POST /fake/outer/string + - Test serialization of outer string types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input string as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterStringSerializeWithRequestBuilder(body: OuterString? = nil) -> RequestBuilder { + let path = "/fake/outer/string" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + /** To test \"client\" model diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift index 79af37e3021..bd15c4420d5 100644 --- a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models.swift @@ -572,6 +572,35 @@ class Decoders { } + // Decoder for [OuterBoolean] + Decoders.addDecoder(clazz: [OuterBoolean].self) { (source: AnyObject) -> [OuterBoolean] in + return Decoders.decode(clazz: [OuterBoolean].self, source: source) + } + // Decoder for OuterBoolean + Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject) -> OuterBoolean in + if let source = source as? Bool { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterBoolean: Maybe swagger file is insufficient") + } + + + // Decoder for [OuterComposite] + Decoders.addDecoder(clazz: [OuterComposite].self) { (source: AnyObject) -> [OuterComposite] in + return Decoders.decode(clazz: [OuterComposite].self, source: source) + } + // Decoder for OuterComposite + Decoders.addDecoder(clazz: OuterComposite.self) { (source: AnyObject) -> OuterComposite in + let sourceDictionary = source as! [AnyHashable: Any] + + let instance = OuterComposite() + instance.myNumber = Decoders.decodeOptional(clazz: OuterNumber.self, source: sourceDictionary["my_number"] as AnyObject?) + instance.myString = Decoders.decodeOptional(clazz: OuterString.self, source: sourceDictionary["my_string"] as AnyObject?) + instance.myBoolean = Decoders.decodeOptional(clazz: OuterBoolean.self, source: sourceDictionary["my_boolean"] as AnyObject?) + return instance + } + + // Decoder for [OuterEnum] Decoders.addDecoder(clazz: [OuterEnum].self) { (source: AnyObject, instance: AnyObject?) -> [OuterEnum] in return Decoders.decode(clazz: [OuterEnum].self, source: source) @@ -587,6 +616,32 @@ class Decoders { } + // Decoder for [OuterNumber] + Decoders.addDecoder(clazz: [OuterNumber].self) { (source: AnyObject) -> [OuterNumber] in + return Decoders.decode(clazz: [OuterNumber].self, source: source) + } + // Decoder for OuterNumber + Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject) -> OuterNumber in + if let source = source as? Double { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterNumber: Maybe swagger file is insufficient") + } + + + // Decoder for [OuterString] + Decoders.addDecoder(clazz: [OuterString].self) { (source: AnyObject) -> [OuterString] in + return Decoders.decode(clazz: [OuterString].self, source: source) + } + // Decoder for OuterString + Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject) -> OuterString in + if let source = source as? String { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterString: Maybe swagger file is insufficient") + } + + // Decoder for [Pet] Decoders.addDecoder(clazz: [Pet].self) { (source: AnyObject, instance: AnyObject?) -> [Pet] in return Decoders.decode(clazz: [Pet].self, source: source) diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift new file mode 100644 index 00000000000..3c49ad29400 --- /dev/null +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift @@ -0,0 +1,11 @@ +// +// OuterBoolean.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterBoolean = Bool diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift new file mode 100644 index 00000000000..aa8de52bb81 --- /dev/null +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift @@ -0,0 +1,27 @@ +// +// OuterComposite.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +open class OuterComposite: JSONEncodable { + public var myNumber: OuterNumber? + public var myString: OuterString? + public var myBoolean: OuterBoolean? + + public init() {} + + // MARK: JSONEncodable + open func encodeToJSON() -> Any { + var nillableDictionary = [String:Any?]() + nillableDictionary["my_number"] = self.myNumber?.encodeToJSON() + nillableDictionary["my_string"] = self.myString?.encodeToJSON() + nillableDictionary["my_boolean"] = self.myBoolean?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] + return dictionary + } +} diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift new file mode 100644 index 00000000000..f285f4e5e29 --- /dev/null +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift @@ -0,0 +1,11 @@ +// +// OuterNumber.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterNumber = Double diff --git a/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterString.swift b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterString.swift new file mode 100644 index 00000000000..9da794627d6 --- /dev/null +++ b/samples/client/petstore/swift3/promisekit/PetstoreClient/Classes/Swaggers/Models/OuterString.swift @@ -0,0 +1,11 @@ +// +// OuterString.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterString = String diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift index abcbfe8d0b7..bfdbd5003d5 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/APIs/FakeAPI.swift @@ -12,6 +12,218 @@ import RxSwift open class FakeAPI: APIBase { + /** + + - parameter body: (body) Input boolean as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterBooleanSerialize(body: OuterBoolean? = nil, completion: @escaping ((_ data: OuterBoolean?,_ error: Error?) -> Void)) { + fakeOuterBooleanSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input boolean as post body (optional) + - returns: Observable + */ + open class func fakeOuterBooleanSerialize(body: OuterBoolean? = nil) -> Observable { + return Observable.create { observer -> Disposable in + fakeOuterBooleanSerialize(body: body) { data, error in + if let error = error { + observer.on(.error(error as Error)) + } else { + observer.on(.next(data!)) + } + observer.on(.completed) + } + return NopDisposable.instance + } + } + + /** + - POST /fake/outer/boolean + - Test serialization of outer boolean types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input boolean as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterBooleanSerializeWithRequestBuilder(body: OuterBoolean? = nil) -> RequestBuilder { + let path = "/fake/outer/boolean" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil, completion: @escaping ((_ data: OuterComposite?,_ error: Error?) -> Void)) { + fakeOuterCompositeSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input composite as post body (optional) + - returns: Observable + */ + open class func fakeOuterCompositeSerialize(body: OuterComposite? = nil) -> Observable { + return Observable.create { observer -> Disposable in + fakeOuterCompositeSerialize(body: body) { data, error in + if let error = error { + observer.on(.error(error as Error)) + } else { + observer.on(.next(data!)) + } + observer.on(.completed) + } + return NopDisposable.instance + } + } + + /** + - POST /fake/outer/composite + - Test serialization of object with outer number type + - examples: [{contentType=application/json, example={ + "my_string" : { }, + "my_number" : { }, + "my_boolean" : { } +}}] + + - parameter body: (body) Input composite as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterCompositeSerializeWithRequestBuilder(body: OuterComposite? = nil) -> RequestBuilder { + let path = "/fake/outer/composite" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input number as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterNumberSerialize(body: OuterNumber? = nil, completion: @escaping ((_ data: OuterNumber?,_ error: Error?) -> Void)) { + fakeOuterNumberSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input number as post body (optional) + - returns: Observable + */ + open class func fakeOuterNumberSerialize(body: OuterNumber? = nil) -> Observable { + return Observable.create { observer -> Disposable in + fakeOuterNumberSerialize(body: body) { data, error in + if let error = error { + observer.on(.error(error as Error)) + } else { + observer.on(.next(data!)) + } + observer.on(.completed) + } + return NopDisposable.instance + } + } + + /** + - POST /fake/outer/number + - Test serialization of outer number types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input number as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterNumberSerializeWithRequestBuilder(body: OuterNumber? = nil) -> RequestBuilder { + let path = "/fake/outer/number" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + + /** + + - parameter body: (body) Input string as post body (optional) + - parameter completion: completion handler to receive the data and the error objects + */ + open class func fakeOuterStringSerialize(body: OuterString? = nil, completion: @escaping ((_ data: OuterString?,_ error: Error?) -> Void)) { + fakeOuterStringSerializeWithRequestBuilder(body: body).execute { (response, error) -> Void in + completion(response?.body, error); + } + } + + /** + + - parameter body: (body) Input string as post body (optional) + - returns: Observable + */ + open class func fakeOuterStringSerialize(body: OuterString? = nil) -> Observable { + return Observable.create { observer -> Disposable in + fakeOuterStringSerialize(body: body) { data, error in + if let error = error { + observer.on(.error(error as Error)) + } else { + observer.on(.next(data!)) + } + observer.on(.completed) + } + return NopDisposable.instance + } + } + + /** + - POST /fake/outer/string + - Test serialization of outer string types + - examples: [{contentType=application/json, example={ }}] + + - parameter body: (body) Input string as post body (optional) + + - returns: RequestBuilder + */ + open class func fakeOuterStringSerializeWithRequestBuilder(body: OuterString? = nil) -> RequestBuilder { + let path = "/fake/outer/string" + let URLString = PetstoreClientAPI.basePath + path + let parameters = body?.encodeToJSON() as? [String:AnyObject] + + let url = NSURLComponents(string: URLString) + + + let requestBuilder: RequestBuilder.Type = PetstoreClientAPI.requestBuilderFactory.getBuilder() + + return requestBuilder.init(method: "POST", URLString: (url?.string ?? URLString), parameters: parameters, isBody: true) + } + /** To test \"client\" model diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift index 79af37e3021..bd15c4420d5 100644 --- a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models.swift @@ -572,6 +572,35 @@ class Decoders { } + // Decoder for [OuterBoolean] + Decoders.addDecoder(clazz: [OuterBoolean].self) { (source: AnyObject) -> [OuterBoolean] in + return Decoders.decode(clazz: [OuterBoolean].self, source: source) + } + // Decoder for OuterBoolean + Decoders.addDecoder(clazz: OuterBoolean.self) { (source: AnyObject) -> OuterBoolean in + if let source = source as? Bool { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterBoolean: Maybe swagger file is insufficient") + } + + + // Decoder for [OuterComposite] + Decoders.addDecoder(clazz: [OuterComposite].self) { (source: AnyObject) -> [OuterComposite] in + return Decoders.decode(clazz: [OuterComposite].self, source: source) + } + // Decoder for OuterComposite + Decoders.addDecoder(clazz: OuterComposite.self) { (source: AnyObject) -> OuterComposite in + let sourceDictionary = source as! [AnyHashable: Any] + + let instance = OuterComposite() + instance.myNumber = Decoders.decodeOptional(clazz: OuterNumber.self, source: sourceDictionary["my_number"] as AnyObject?) + instance.myString = Decoders.decodeOptional(clazz: OuterString.self, source: sourceDictionary["my_string"] as AnyObject?) + instance.myBoolean = Decoders.decodeOptional(clazz: OuterBoolean.self, source: sourceDictionary["my_boolean"] as AnyObject?) + return instance + } + + // Decoder for [OuterEnum] Decoders.addDecoder(clazz: [OuterEnum].self) { (source: AnyObject, instance: AnyObject?) -> [OuterEnum] in return Decoders.decode(clazz: [OuterEnum].self, source: source) @@ -587,6 +616,32 @@ class Decoders { } + // Decoder for [OuterNumber] + Decoders.addDecoder(clazz: [OuterNumber].self) { (source: AnyObject) -> [OuterNumber] in + return Decoders.decode(clazz: [OuterNumber].self, source: source) + } + // Decoder for OuterNumber + Decoders.addDecoder(clazz: OuterNumber.self) { (source: AnyObject) -> OuterNumber in + if let source = source as? Double { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterNumber: Maybe swagger file is insufficient") + } + + + // Decoder for [OuterString] + Decoders.addDecoder(clazz: [OuterString].self) { (source: AnyObject) -> [OuterString] in + return Decoders.decode(clazz: [OuterString].self, source: source) + } + // Decoder for OuterString + Decoders.addDecoder(clazz: OuterString.self) { (source: AnyObject) -> OuterString in + if let source = source as? String { + return source + } + fatalError("Source \(source) is not convertible to typealias OuterString: Maybe swagger file is insufficient") + } + + // Decoder for [Pet] Decoders.addDecoder(clazz: [Pet].self) { (source: AnyObject, instance: AnyObject?) -> [Pet] in return Decoders.decode(clazz: [Pet].self, source: source) diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift new file mode 100644 index 00000000000..3c49ad29400 --- /dev/null +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterBoolean.swift @@ -0,0 +1,11 @@ +// +// OuterBoolean.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterBoolean = Bool diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift new file mode 100644 index 00000000000..aa8de52bb81 --- /dev/null +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterComposite.swift @@ -0,0 +1,27 @@ +// +// OuterComposite.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +open class OuterComposite: JSONEncodable { + public var myNumber: OuterNumber? + public var myString: OuterString? + public var myBoolean: OuterBoolean? + + public init() {} + + // MARK: JSONEncodable + open func encodeToJSON() -> Any { + var nillableDictionary = [String:Any?]() + nillableDictionary["my_number"] = self.myNumber?.encodeToJSON() + nillableDictionary["my_string"] = self.myString?.encodeToJSON() + nillableDictionary["my_boolean"] = self.myBoolean?.encodeToJSON() + let dictionary: [String:Any] = APIHelper.rejectNil(nillableDictionary) ?? [:] + return dictionary + } +} diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift new file mode 100644 index 00000000000..f285f4e5e29 --- /dev/null +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterNumber.swift @@ -0,0 +1,11 @@ +// +// OuterNumber.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterNumber = Double diff --git a/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterString.swift b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterString.swift new file mode 100644 index 00000000000..9da794627d6 --- /dev/null +++ b/samples/client/petstore/swift3/rxswift/PetstoreClient/Classes/Swaggers/Models/OuterString.swift @@ -0,0 +1,11 @@ +// +// OuterString.swift +// +// Generated by swagger-codegen +// https://github.com/swagger-api/swagger-codegen +// + +import Foundation + + +public typealias OuterString = String diff --git a/samples/client/petstore/typescript-angular2/npm/README.md b/samples/client/petstore/typescript-angular2/npm/README.md index fbf37be47b0..c1a9728f505 100644 --- a/samples/client/petstore/typescript-angular2/npm/README.md +++ b/samples/client/petstore/typescript-angular2/npm/README.md @@ -41,4 +41,4 @@ import { BASE_PATH } from './path-to-swagger-gen-service/index'; bootstrap(AppComponent, [ { provide: BASE_PATH, useValue: 'https://your-web-service.com' }, ]); -``` \ No newline at end of file +``` diff --git a/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..d63d9d1054d --- /dev/null +++ b/samples/server/petstore/java-inflector/src/gen/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,119 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + + + + + + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + /** + **/ + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_number") + public BigDecimal getMyNumber() { + return myNumber; + } + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + /** + **/ + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_string") + public String getMyString() { + return myString; + } + public void setMyString(String myString) { + this.myString = myString; + } + + /** + **/ + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @ApiModelProperty(value = "") + @JsonProperty("my_boolean") + public Boolean getMyBoolean() { + return myBoolean; + } + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(myNumber, outerComposite.myNumber) && + Objects.equals(myString, outerComposite.myString) && + Objects.equals(myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java index 3c339e8d641..ff2a9ebd6c1 100644 --- a/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java +++ b/samples/server/petstore/java-inflector/src/main/java/io/swagger/handler/FakeController.java @@ -13,6 +13,7 @@ import io.swagger.model.*; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; public class FakeController { @@ -22,6 +23,30 @@ public class FakeController { * Code allows you to implement logic incrementally, they are disabled. **/ + /* + public ResponseContext fakeOuterBooleanSerialize(RequestContext request , Boolean body) { + return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); + } + */ + + /* + public ResponseContext fakeOuterCompositeSerialize(RequestContext request , OuterComposite body) { + return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); + } + */ + + /* + public ResponseContext fakeOuterNumberSerialize(RequestContext request , BigDecimal body) { + return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); + } + */ + + /* + public ResponseContext fakeOuterStringSerialize(RequestContext request , String body) { + return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); + } + */ + /* public ResponseContext testClientModel(RequestContext request , Client body) { return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" ); diff --git a/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml b/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml index ed4293e42eb..eb5a5a64d08 100644 --- a/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml +++ b/samples/server/petstore/java-inflector/src/main/swagger/swagger.yaml @@ -844,6 +844,86 @@ paths: $ref: "#/definitions/Client" x-contentType: "application/json" x-accepts: "application/json" + /fake/outer/number: + post: + tags: + - "fake" + description: "Test serialization of outer number types" + operationId: "fakeOuterNumberSerialize" + parameters: + - in: "body" + name: "body" + description: "Input number as post body" + required: false + schema: + $ref: "#/definitions/OuterNumber" + responses: + 200: + description: "Output number" + schema: + $ref: "#/definitions/OuterNumber" + x-contentType: "application/json" + x-accepts: "application/json" + /fake/outer/string: + post: + tags: + - "fake" + description: "Test serialization of outer string types" + operationId: "fakeOuterStringSerialize" + parameters: + - in: "body" + name: "body" + description: "Input string as post body" + required: false + schema: + $ref: "#/definitions/OuterString" + responses: + 200: + description: "Output string" + schema: + $ref: "#/definitions/OuterString" + x-contentType: "application/json" + x-accepts: "application/json" + /fake/outer/boolean: + post: + tags: + - "fake" + description: "Test serialization of outer boolean types" + operationId: "fakeOuterBooleanSerialize" + parameters: + - in: "body" + name: "body" + description: "Input boolean as post body" + required: false + schema: + $ref: "#/definitions/OuterBoolean" + responses: + 200: + description: "Output boolean" + schema: + $ref: "#/definitions/OuterBoolean" + x-contentType: "application/json" + x-accepts: "application/json" + /fake/outer/composite: + post: + tags: + - "fake" + description: "Test serialization of object with outer number type" + operationId: "fakeOuterCompositeSerialize" + parameters: + - in: "body" + name: "body" + description: "Input composite as post body" + required: false + schema: + $ref: "#/definitions/OuterComposite" + responses: + 200: + description: "Output composite" + schema: + $ref: "#/definitions/OuterComposite" + x-contentType: "application/json" + x-accepts: "application/json" securityDefinitions: petstore_auth: type: "oauth2" @@ -1291,6 +1371,21 @@ definitions: - "placed" - "approved" - "delivered" + OuterNumber: + type: "number" + OuterString: + type: "string" + OuterBoolean: + type: "boolean" + OuterComposite: + type: "object" + properties: + my_number: + $ref: "#/definitions/OuterNumber" + my_string: + $ref: "#/definitions/OuterString" + my_boolean: + $ref: "#/definitions/OuterBoolean" externalDocs: description: "Find out more about Swagger" url: "http://swagger.io" diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java index dab091c6a19..81939d3931a 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApi.java @@ -10,6 +10,7 @@ import io.swagger.jaxrs.*; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -32,6 +33,54 @@ import javax.ws.rs.*; public class FakeApi { private final FakeApiService delegate = FakeApiServiceFactory.getFakeApi(); + @POST + @Path("/outer/boolean") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body +) + throws NotFoundException { + return delegate.fakeOuterBooleanSerialize(body); + } + @POST + @Path("/outer/composite") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) OuterComposite body +) + throws NotFoundException { + return delegate.fakeOuterCompositeSerialize(body); + } + @POST + @Path("/outer/number") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) BigDecimal body +) + throws NotFoundException { + return delegate.fakeOuterNumberSerialize(body); + } + @POST + @Path("/outer/string") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) + public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) String body +) + throws NotFoundException { + return delegate.fakeOuterStringSerialize(body); + } @PATCH @Consumes({ "application/json" }) diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java index 1b1e4b8603a..fb27855c5f0 100644 --- a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/api/FakeApiService.java @@ -9,6 +9,7 @@ import org.wso2.msf4j.formparam.FileInfo; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -20,6 +21,14 @@ import javax.ws.rs.core.SecurityContext; public abstract class FakeApiService { + public abstract Response fakeOuterBooleanSerialize(Boolean body + ) throws NotFoundException; + public abstract Response fakeOuterCompositeSerialize(OuterComposite body + ) throws NotFoundException; + public abstract Response fakeOuterNumberSerialize(BigDecimal body + ) throws NotFoundException; + public abstract Response fakeOuterStringSerialize(String body + ) throws NotFoundException; public abstract Response testClientModel(Client body ) throws NotFoundException; public abstract Response testEndpointParameters(BigDecimal number diff --git a/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..5544c27e528 --- /dev/null +++ b/samples/server/petstore/java-msf4j/src/gen/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,121 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java index 36f2787cd1f..807fdc0859a 100644 --- a/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/java-msf4j/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java @@ -6,6 +6,7 @@ import io.swagger.model.*; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -20,6 +21,30 @@ import javax.ws.rs.core.SecurityContext; public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response fakeOuterBooleanSerialize(Boolean body + ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterCompositeSerialize(OuterComposite body + ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterNumberSerialize(BigDecimal body + ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterStringSerialize(String body + ) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } @Override public Response testClientModel(Client body ) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java index b968471c9e5..6411e862c1c 100644 --- a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import java.io.InputStream; import java.io.OutputStream; @@ -26,6 +27,34 @@ import javax.validation.Valid; @Api(value = "/", description = "") public interface FakeApi { + @POST + @Path("/fake/outer/boolean") + @ApiOperation(value = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + public Boolean fakeOuterBooleanSerialize(@Valid Boolean body); + + @POST + @Path("/fake/outer/composite") + @ApiOperation(value = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + public OuterComposite fakeOuterCompositeSerialize(@Valid OuterComposite body); + + @POST + @Path("/fake/outer/number") + @ApiOperation(value = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + public BigDecimal fakeOuterNumberSerialize(@Valid BigDecimal body); + + @POST + @Path("/fake/outer/string") + @ApiOperation(value = "", tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + public String fakeOuterStringSerialize(@Valid String body); + @PATCH @Path("/fake") @Consumes({ "application/json" }) diff --git a/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..264121fb46d --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/gen/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,99 @@ +package io.swagger.model; + +import java.math.BigDecimal; +import javax.validation.constraints.*; + +import io.swagger.annotations.ApiModelProperty; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlType; +import javax.xml.bind.annotation.XmlEnum; +import javax.xml.bind.annotation.XmlEnumValue; + +public class OuterComposite { + + @ApiModelProperty(value = "") + private BigDecimal myNumber = null; + @ApiModelProperty(value = "") + private String myString = null; + @ApiModelProperty(value = "") + private Boolean myBoolean = null; + + /** + * Get myNumber + * @return myNumber + **/ + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myString + * @return myString + **/ + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private static String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java index cf469b71dd9..92699c3411b 100644 --- a/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs-cxf/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java @@ -4,6 +4,8 @@ import io.swagger.api.*; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; + +import io.swagger.model.OuterComposite; import org.joda.time.LocalDate; import java.io.InputStream; @@ -20,6 +22,30 @@ import org.apache.cxf.jaxrs.ext.multipart.*; import io.swagger.annotations.Api; public class FakeApiServiceImpl implements FakeApi { + @Override + public Boolean fakeOuterBooleanSerialize(Boolean body) { + // TODO: Implement... + return null; + } + + @Override + public OuterComposite fakeOuterCompositeSerialize(OuterComposite body) { + // TODO: Implement... + return null; + } + + @Override + public BigDecimal fakeOuterNumberSerialize(BigDecimal body) { + // TODO: Implement... + return null; + } + + @Override + public String fakeOuterStringSerialize(String body) { + // TODO: Implement... + return null; + } + public Client testClientModel(Client body) { // TODO: Implement... diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/api/FakeApi.java index 062df354b95..b851f348466 100644 --- a/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import javax.ws.rs.*; import javax.ws.rs.core.Response; @@ -22,6 +23,50 @@ import javax.validation.constraints.*; public class FakeApi { + @POST + @Path("/outer/boolean") + + + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + public Response fakeOuterBooleanSerialize(Boolean body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/composite") + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + public Response fakeOuterCompositeSerialize(OuterComposite body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/number") + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + public Response fakeOuterNumberSerialize(BigDecimal body) { + return Response.ok().entity("magic!").build(); + } + + @POST + @Path("/outer/string") + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + public Response fakeOuterStringSerialize(String body) { + return Response.ok().entity("magic!").build(); + } + @PATCH @Consumes({ "application/json" }) diff --git a/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..ad672a04dee --- /dev/null +++ b/samples/server/petstore/jaxrs-spec/src/gen/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,107 @@ +package io.swagger.model; + +import java.math.BigDecimal; +import javax.validation.constraints.*; + + +import io.swagger.annotations.*; +import java.util.Objects; + + +public class OuterComposite { + + private BigDecimal myNumber = null; + private String myString = null; + private Boolean myBoolean = null; + + /** + **/ + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + /** + **/ + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + public void setMyString(String myString) { + this.myString = myString; + } + + /** + **/ + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(myNumber, outerComposite.myNumber) && + Objects.equals(myString, outerComposite.myString) && + Objects.equals(myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} diff --git a/samples/server/petstore/jaxrs-spec/swagger.json b/samples/server/petstore/jaxrs-spec/swagger.json index a77f51fafc7..32931cdbf7c 100644 --- a/samples/server/petstore/jaxrs-spec/swagger.json +++ b/samples/server/petstore/jaxrs-spec/swagger.json @@ -876,6 +876,102 @@ } } } + }, + "/fake/outer/number" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of outer number types", + "operationId" : "fakeOuterNumberSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input number as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterNumber" + } + } ], + "responses" : { + "200" : { + "description" : "Output number", + "schema" : { + "$ref" : "#/definitions/OuterNumber" + } + } + } + } + }, + "/fake/outer/string" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of outer string types", + "operationId" : "fakeOuterStringSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input string as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterString" + } + } ], + "responses" : { + "200" : { + "description" : "Output string", + "schema" : { + "$ref" : "#/definitions/OuterString" + } + } + } + } + }, + "/fake/outer/boolean" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of outer boolean types", + "operationId" : "fakeOuterBooleanSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input boolean as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterBoolean" + } + } ], + "responses" : { + "200" : { + "description" : "Output boolean", + "schema" : { + "$ref" : "#/definitions/OuterBoolean" + } + } + } + } + }, + "/fake/outer/composite" : { + "post" : { + "tags" : [ "fake" ], + "description" : "Test serialization of object with outer number type", + "operationId" : "fakeOuterCompositeSerialize", + "parameters" : [ { + "in" : "body", + "name" : "body", + "description" : "Input composite as post body", + "required" : false, + "schema" : { + "$ref" : "#/definitions/OuterComposite" + } + } ], + "responses" : { + "200" : { + "description" : "Output composite", + "schema" : { + "$ref" : "#/definitions/OuterComposite" + } + } + } + } } }, "securityDefinitions" : { @@ -1475,6 +1571,29 @@ "OuterEnum" : { "type" : "string", "enum" : [ "placed", "approved", "delivered" ] + }, + "OuterNumber" : { + "type" : "number" + }, + "OuterString" : { + "type" : "string" + }, + "OuterBoolean" : { + "type" : "boolean" + }, + "OuterComposite" : { + "type" : "object", + "properties" : { + "my_number" : { + "$ref" : "#/definitions/OuterNumber" + }, + "my_string" : { + "$ref" : "#/definitions/OuterString" + }, + "my_boolean" : { + "$ref" : "#/definitions/OuterBoolean" + } + } } }, "externalDocs" : { diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java index 29311ed5be8..6d3964075a6 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApi.java @@ -13,6 +13,7 @@ import javax.validation.constraints.*; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -35,6 +36,58 @@ import javax.ws.rs.*; public class FakeApi { private final FakeApiService delegate = FakeApiServiceFactory.getFakeApi(); + @POST + @Path("/outer/boolean") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + public Response fakeOuterBooleanSerialize( + @ApiParam(value = "Input boolean as post body" ) Boolean body, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterBooleanSerialize(body,securityContext); + } + @POST + @Path("/outer/composite") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + public Response fakeOuterCompositeSerialize( + @ApiParam(value = "Input composite as post body" ) OuterComposite body, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterCompositeSerialize(body,securityContext); + } + @POST + @Path("/outer/number") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + public Response fakeOuterNumberSerialize( + @ApiParam(value = "Input number as post body" ) BigDecimal body, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterNumberSerialize(body,securityContext); + } + @POST + @Path("/outer/string") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) + public Response fakeOuterStringSerialize( + @ApiParam(value = "Input string as post body" ) String body, + @Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterStringSerialize(body,securityContext); + } @PATCH @Consumes({ "application/json" }) diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApiService.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApiService.java index 0714ed3f02a..4ad6f0d264e 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApiService.java +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/api/FakeApiService.java @@ -8,6 +8,7 @@ import com.sun.jersey.multipart.FormDataParam; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -22,6 +23,14 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; public abstract class FakeApiService { + public abstract Response fakeOuterBooleanSerialize(Boolean body,SecurityContext securityContext) + throws NotFoundException; + public abstract Response fakeOuterCompositeSerialize(OuterComposite body,SecurityContext securityContext) + throws NotFoundException; + public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) + throws NotFoundException; + public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) + throws NotFoundException; public abstract Response testClientModel(Client body,SecurityContext securityContext) throws NotFoundException; public abstract Response testEndpointParameters(BigDecimal number,Double _double,String patternWithoutDelimiter,byte[] _byte,Integer integer,Integer int32,Long int64,Float _float,String string,byte[] binary,Date date,Date dateTime,String password,String paramCallback,SecurityContext securityContext) diff --git a/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..aa6f16ba640 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey1/src/gen/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,139 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @JsonProperty("my_number") + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @JsonProperty("my_string") + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @JsonProperty("my_boolean") + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java index 1ef64321d6a..62d62d961ff 100644 --- a/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey1/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java @@ -8,6 +8,7 @@ import com.sun.jersey.multipart.FormDataParam; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -22,6 +23,30 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response fakeOuterBooleanSerialize(Boolean body, SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterCompositeSerialize(OuterComposite body, SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterNumberSerialize(BigDecimal body, SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterStringSerialize(String body, SecurityContext securityContext) + throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } @Override public Response testClientModel(Client body, SecurityContext securityContext) throws NotFoundException { diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java index 229e2781bd2..c57513ff09a 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApi.java @@ -10,6 +10,7 @@ import io.swagger.jaxrs.*; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -33,6 +34,54 @@ import javax.validation.constraints.*; public class FakeApi { private final FakeApiService delegate = FakeApiServiceFactory.getFakeApi(); + @POST + @Path("/outer/boolean") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + public Response fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) Boolean body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterBooleanSerialize(body,securityContext); + } + @POST + @Path("/outer/composite") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + public Response fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) OuterComposite body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterCompositeSerialize(body,securityContext); + } + @POST + @Path("/outer/number") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + public Response fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) BigDecimal body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterNumberSerialize(body,securityContext); + } + @POST + @Path("/outer/string") + + + @io.swagger.annotations.ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @io.swagger.annotations.ApiResponses(value = { + @io.swagger.annotations.ApiResponse(code = 200, message = "Output string", response = String.class) }) + public Response fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) String body +,@Context SecurityContext securityContext) + throws NotFoundException { + return delegate.fakeOuterStringSerialize(body,securityContext); + } @PATCH @Consumes({ "application/json" }) diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApiService.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApiService.java index aaff35dbdd9..490647b96ab 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApiService.java +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/api/FakeApiService.java @@ -8,6 +8,7 @@ import org.glassfish.jersey.media.multipart.FormDataContentDisposition; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -19,6 +20,10 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; public abstract class FakeApiService { + public abstract Response fakeOuterBooleanSerialize(Boolean body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterCompositeSerialize(OuterComposite body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterNumberSerialize(BigDecimal body,SecurityContext securityContext) throws NotFoundException; + public abstract Response fakeOuterStringSerialize(String body,SecurityContext securityContext) throws NotFoundException; public abstract Response testClientModel(Client body,SecurityContext securityContext) throws NotFoundException; public abstract Response testEndpointParameters(BigDecimal number,Double _double,String patternWithoutDelimiter,byte[] _byte,Integer integer,Integer int32,Long int64,Float _float,String string,byte[] binary,Date date,Date dateTime,String password,String paramCallback,SecurityContext securityContext) throws NotFoundException; public abstract Response testEnumParameters(List enumFormStringArray,String enumFormString,List enumHeaderStringArray,String enumHeaderString, List enumQueryStringArray, String enumQueryString, Integer enumQueryInteger,Double enumQueryDouble,SecurityContext securityContext) throws NotFoundException; diff --git a/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..aa6f16ba640 --- /dev/null +++ b/samples/server/petstore/jaxrs/jersey2/src/gen/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,139 @@ +/* + * Swagger Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * OpenAPI spec version: 1.0.0 + * Contact: apiteam@swagger.io + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @JsonProperty("my_number") + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @JsonProperty("my_string") + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @JsonProperty("my_boolean") + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java index 11b046e7c94..132991700c5 100644 --- a/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java +++ b/samples/server/petstore/jaxrs/jersey2/src/main/java/io/swagger/api/impl/FakeApiServiceImpl.java @@ -6,6 +6,7 @@ import io.swagger.model.*; import java.math.BigDecimal; import io.swagger.model.Client; import java.util.Date; +import io.swagger.model.OuterComposite; import java.util.List; import io.swagger.api.NotFoundException; @@ -19,6 +20,26 @@ import javax.ws.rs.core.SecurityContext; import javax.validation.constraints.*; public class FakeApiServiceImpl extends FakeApiService { + @Override + public Response fakeOuterBooleanSerialize(Boolean body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterCompositeSerialize(OuterComposite body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterNumberSerialize(BigDecimal body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } + @Override + public Response fakeOuterStringSerialize(String body, SecurityContext securityContext) throws NotFoundException { + // do some magic! + return Response.ok().entity(new ApiResponseMessage(ApiResponseMessage.OK, "magic!")).build(); + } @Override public Response testClientModel(Client body, SecurityContext securityContext) throws NotFoundException { // do some magic! diff --git a/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php b/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php index 5015f10d5b6..ae04d8aadca 100644 --- a/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php +++ b/samples/server/petstore/lumen/lib/app/Http/Controllers/FakeApi.php @@ -183,4 +183,88 @@ class FakeApi extends Controller return response('How about implementing testEnumParameters as a GET method ?'); } + /** + * Operation fakeOuterBooleanSerialize + * + * . + * + * + * @return Http response + */ + public function fakeOuterBooleanSerialize() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + $body = $input['body']; + + + return response('How about implementing fakeOuterBooleanSerialize as a POST method ?'); + } + /** + * Operation fakeOuterCompositeSerialize + * + * . + * + * + * @return Http response + */ + public function fakeOuterCompositeSerialize() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + $body = $input['body']; + + + return response('How about implementing fakeOuterCompositeSerialize as a POST method ?'); + } + /** + * Operation fakeOuterNumberSerialize + * + * . + * + * + * @return Http response + */ + public function fakeOuterNumberSerialize() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + $body = $input['body']; + + + return response('How about implementing fakeOuterNumberSerialize as a POST method ?'); + } + /** + * Operation fakeOuterStringSerialize + * + * . + * + * + * @return Http response + */ + public function fakeOuterStringSerialize() + { + $input = Request::all(); + + //path params validation + + + //not path params validation + $body = $input['body']; + + + return response('How about implementing fakeOuterStringSerialize as a POST method ?'); + } } diff --git a/samples/server/petstore/lumen/lib/app/Http/routes.php b/samples/server/petstore/lumen/lib/app/Http/routes.php index 510b5ee2a50..9f9f18eef5a 100644 --- a/samples/server/petstore/lumen/lib/app/Http/routes.php +++ b/samples/server/petstore/lumen/lib/app/Http/routes.php @@ -42,6 +42,34 @@ $app->POST('/v2/fake', 'FakeApi@testEndpointParameters'); * Output-Formats: [*/*] */ $app->GET('/v2/fake', 'FakeApi@testEnumParameters'); +/** + * POST fakeOuterBooleanSerialize + * Summary: + * Notes: Test serialization of outer boolean types + + */ +$app->POST('/v2/fake/outer/boolean', 'FakeApi@fakeOuterBooleanSerialize'); +/** + * POST fakeOuterCompositeSerialize + * Summary: + * Notes: Test serialization of object with outer number type + + */ +$app->POST('/v2/fake/outer/composite', 'FakeApi@fakeOuterCompositeSerialize'); +/** + * POST fakeOuterNumberSerialize + * Summary: + * Notes: Test serialization of outer number types + + */ +$app->POST('/v2/fake/outer/number', 'FakeApi@fakeOuterNumberSerialize'); +/** + * POST fakeOuterStringSerialize + * Summary: + * Notes: Test serialization of outer string types + + */ +$app->POST('/v2/fake/outer/string', 'FakeApi@fakeOuterStringSerialize'); /** * POST addPet * Summary: Add a new pet to the store diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java index 8903031c0cd..1a72802d60f 100644 --- a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import java.time.LocalDate; import java.time.OffsetDateTime; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; @@ -25,6 +26,54 @@ import javax.validation.Valid; @Api(value = "fake", description = "the fake API") public interface FakeApi { + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + + @RequestMapping(value = "/fake/outer/boolean", + method = RequestMethod.POST) + default CompletableFuture> fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); + } + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + + @RequestMapping(value = "/fake/outer/composite", + method = RequestMethod.POST) + default CompletableFuture> fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { + // do some magic! + return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); + } + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + + @RequestMapping(value = "/fake/outer/number", + method = RequestMethod.POST) + default CompletableFuture> fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); + } + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + + @RequestMapping(value = "/fake/outer/string", + method = RequestMethod.POST) + default CompletableFuture> fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return CompletableFuture.completedFuture(new ResponseEntity(HttpStatus.OK)); + } + + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..2502d28ab57 --- /dev/null +++ b/samples/server/petstore/spring-mvc-j8-async/src/main/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,121 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java index 1e0e9707661..8ce42fc5cef 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; @@ -23,6 +24,42 @@ import javax.validation.Valid; @Api(value = "fake", description = "the fake API") public interface FakeApi { + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + + @RequestMapping(value = "/fake/outer/boolean", + method = RequestMethod.POST) + ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + + @RequestMapping(value = "/fake/outer/composite", + method = RequestMethod.POST) + ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + + @RequestMapping(value = "/fake/outer/number", + method = RequestMethod.POST) + ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + + @RequestMapping(value = "/fake/outer/string", + method = RequestMethod.POST) + ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java index 9edc15a4fc9..1ea9d51d67b 100644 --- a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/api/FakeApiController.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; @@ -27,6 +28,26 @@ public class FakeApiController implements FakeApi { + public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..2502d28ab57 --- /dev/null +++ b/samples/server/petstore/spring-mvc/src/main/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,121 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java index 1e0e9707661..8ce42fc5cef 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; @@ -23,6 +24,42 @@ import javax.validation.Valid; @Api(value = "fake", description = "the fake API") public interface FakeApi { + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + + @RequestMapping(value = "/fake/outer/boolean", + method = RequestMethod.POST) + ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + + @RequestMapping(value = "/fake/outer/composite", + method = RequestMethod.POST) + ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + + @RequestMapping(value = "/fake/outer/number", + method = RequestMethod.POST) + ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + + @RequestMapping(value = "/fake/outer/string", + method = RequestMethod.POST) + ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java index 9edc15a4fc9..1ea9d51d67b 100644 --- a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/api/FakeApiController.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; @@ -27,6 +28,26 @@ public class FakeApiController implements FakeApi { + public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..2502d28ab57 --- /dev/null +++ b/samples/server/petstore/springboot-beanvalidation/src/main/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,121 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java index eecc3dd4f39..5eb9f9321d7 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import java.time.LocalDate; import java.time.OffsetDateTime; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; @@ -24,6 +25,54 @@ import javax.validation.Valid; @Api(value = "fake", description = "the fake API") public interface FakeApi { + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + + @RequestMapping(value = "/fake/outer/boolean", + method = RequestMethod.POST) + default ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + + @RequestMapping(value = "/fake/outer/composite", + method = RequestMethod.POST) + default ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + + @RequestMapping(value = "/fake/outer/number", + method = RequestMethod.POST) + default ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + + @RequestMapping(value = "/fake/outer/string", + method = RequestMethod.POST) + default ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java index 72de87558b6..27a14a2accc 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiController.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import java.time.LocalDate; import java.time.OffsetDateTime; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; @@ -32,6 +33,26 @@ public class FakeApiController implements FakeApi { } + public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return delegate.fakeOuterBooleanSerialize(body); + } + + public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { + // do some magic! + return delegate.fakeOuterCompositeSerialize(body); + } + + public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return delegate.fakeOuterNumberSerialize(body); + } + + public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return delegate.fakeOuterStringSerialize(body); + } + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClientModel(body); diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiDelegate.java index 96d5e63a372..fb1f9482d57 100644 --- a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/api/FakeApiDelegate.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import java.time.LocalDate; import java.time.OffsetDateTime; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.HttpStatus; @@ -20,6 +21,38 @@ import java.util.List; public interface FakeApiDelegate { + /** + * @see FakeApi#fakeOuterBooleanSerialize + */ + default ResponseEntity fakeOuterBooleanSerialize(Boolean body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + /** + * @see FakeApi#fakeOuterCompositeSerialize + */ + default ResponseEntity fakeOuterCompositeSerialize(OuterComposite body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + /** + * @see FakeApi#fakeOuterNumberSerialize + */ + default ResponseEntity fakeOuterNumberSerialize(BigDecimal body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + /** + * @see FakeApi#fakeOuterStringSerialize + */ + default ResponseEntity fakeOuterStringSerialize(String body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + /** * @see FakeApi#testClientModel */ diff --git a/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..2502d28ab57 --- /dev/null +++ b/samples/server/petstore/springboot-delegate-j8/src/main/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,121 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java index 1e0e9707661..8ce42fc5cef 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; @@ -23,6 +24,42 @@ import javax.validation.Valid; @Api(value = "fake", description = "the fake API") public interface FakeApi { + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + + @RequestMapping(value = "/fake/outer/boolean", + method = RequestMethod.POST) + ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + + @RequestMapping(value = "/fake/outer/composite", + method = RequestMethod.POST) + ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + + @RequestMapping(value = "/fake/outer/number", + method = RequestMethod.POST) + ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + + @RequestMapping(value = "/fake/outer/string", + method = RequestMethod.POST) + ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java index 29d67bb25e2..2b22c085314 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiController.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; @@ -32,6 +33,26 @@ public class FakeApiController implements FakeApi { } + public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return delegate.fakeOuterBooleanSerialize(body); + } + + public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { + // do some magic! + return delegate.fakeOuterCompositeSerialize(body); + } + + public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return delegate.fakeOuterNumberSerialize(body); + } + + public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return delegate.fakeOuterStringSerialize(body); + } + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return delegate.testClientModel(body); diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiDelegate.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiDelegate.java index a7f2cc2dc91..a9fdd618faa 100644 --- a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiDelegate.java +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/api/FakeApiDelegate.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; @@ -19,6 +20,26 @@ import java.util.List; public interface FakeApiDelegate { + /** + * @see FakeApi#fakeOuterBooleanSerialize + */ + ResponseEntity fakeOuterBooleanSerialize(Boolean body); + + /** + * @see FakeApi#fakeOuterCompositeSerialize + */ + ResponseEntity fakeOuterCompositeSerialize(OuterComposite body); + + /** + * @see FakeApi#fakeOuterNumberSerialize + */ + ResponseEntity fakeOuterNumberSerialize(BigDecimal body); + + /** + * @see FakeApi#fakeOuterStringSerialize + */ + ResponseEntity fakeOuterStringSerialize(String body); + /** * @see FakeApi#testClientModel */ diff --git a/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..2502d28ab57 --- /dev/null +++ b/samples/server/petstore/springboot-delegate/src/main/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,121 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApi.java index 3ef7d795369..9af41acbe08 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; @@ -15,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -24,6 +24,50 @@ import javax.validation.Valid; @Api(value = "fake", description = "the fake API") public interface FakeApi { + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + @ApiImplicitParams({ + + }) + @RequestMapping(value = "/fake/outer/boolean", + method = RequestMethod.POST) + ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + @ApiImplicitParams({ + + }) + @RequestMapping(value = "/fake/outer/composite", + method = RequestMethod.POST) + ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + @ApiImplicitParams({ + + }) + @RequestMapping(value = "/fake/outer/number", + method = RequestMethod.POST) + ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + @ApiImplicitParams({ + + }) + @RequestMapping(value = "/fake/outer/string", + method = RequestMethod.POST) + ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) @@ -34,7 +78,7 @@ public interface FakeApi { produces = { "application/json" }, consumes = { "application/json" }, method = RequestMethod.PATCH) - ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body); @ApiOperation(value = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", notes = "Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 ", response = Void.class, authorizations = { @@ -50,7 +94,7 @@ public interface FakeApi { produces = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, consumes = { "application/xml; charset=utf-8", "application/json; charset=utf-8" }, method = RequestMethod.POST) - ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, @RequestHeader("Accept") String accept); + ResponseEntity testEndpointParameters(@ApiParam(value = "None", required=true) @RequestPart(value="number", required=true) BigDecimal number,@ApiParam(value = "None", required=true) @RequestPart(value="double", required=true) Double _double,@ApiParam(value = "None", required=true) @RequestPart(value="pattern_without_delimiter", required=true) String patternWithoutDelimiter,@ApiParam(value = "None", required=true) @RequestPart(value="byte", required=true) byte[] _byte,@ApiParam(value = "None") @RequestPart(value="integer", required=false) Integer integer,@ApiParam(value = "None") @RequestPart(value="int32", required=false) Integer int32,@ApiParam(value = "None") @RequestPart(value="int64", required=false) Long int64,@ApiParam(value = "None") @RequestPart(value="float", required=false) Float _float,@ApiParam(value = "None") @RequestPart(value="string", required=false) String string,@ApiParam(value = "None") @RequestPart(value="binary", required=false) byte[] binary,@ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date,@ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime,@ApiParam(value = "None") @RequestPart(value="password", required=false) String password,@ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback); @ApiOperation(value = "To test enum parameters", notes = "To test enum parameters", response = Void.class, tags={ "fake", }) @@ -64,6 +108,6 @@ public interface FakeApi { produces = { "*/*" }, consumes = { "*/*" }, method = RequestMethod.GET) - ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, @RequestHeader("Accept") String accept); + ResponseEntity testEnumParameters(@ApiParam(value = "Form parameter enum test (string array)", allowableValues=">, $") @RequestPart(value="enum_form_string_array", required=false) List enumFormStringArray,@ApiParam(value = "Form parameter enum test (string)", allowableValues="_abc, -efg, (xyz)", defaultValue="-efg") @RequestPart(value="enum_form_string", required=false) String enumFormString,@ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray,@ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString,@ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger,@ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApiController.java index 5a0dff3ef65..3eec1d9d4c8 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/FakeApiController.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; @@ -18,27 +19,37 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class FakeApiController implements FakeApi { - private final ObjectMapper objectMapper; - public FakeApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; + + + public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { // do some magic! + return new ResponseEntity(HttpStatus.OK); + } - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"client\" : \"aeiou\"}", Client.class), HttpStatus.OK); - } + public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { + // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -55,8 +66,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "None") @RequestPart(value="date", required=false) LocalDate date, @ApiParam(value = "None") @RequestPart(value="dateTime", required=false) DateTime dateTime, @ApiParam(value = "None") @RequestPart(value="password", required=false) String password, - @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "None") @RequestPart(value="callback", required=false) String paramCallback) { // do some magic! return new ResponseEntity(HttpStatus.OK); } @@ -66,8 +76,7 @@ public class FakeApiController implements FakeApi { @ApiParam(value = "Query parameter enum test (string array)", allowableValues = ">, $") @RequestParam(value = "enum_query_string_array", required = false) List enumQueryStringArray, @ApiParam(value = "Query parameter enum test (string)", allowableValues = "_abc, -efg, (xyz)", defaultValue = "-efg") @RequestParam(value = "enum_query_string", required = false, defaultValue="-efg") String enumQueryString, @ApiParam(value = "Query parameter enum test (double)", allowableValues = "1, -2") @RequestParam(value = "enum_query_integer", required = false) Integer enumQueryInteger, - @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Query parameter enum test (double)", allowableValues="1.1, -1.2") @RequestPart(value="enum_query_double", required=false) Double enumQueryDouble) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApi.java index 5d66a8ac03d..22458048873 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApi.java @@ -14,7 +14,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -38,7 +37,7 @@ public interface PetApi { produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.POST) - ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Deletes a pet", notes = "", response = Void.class, authorizations = { @@ -55,7 +54,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept); + ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Finds Pets by status", notes = "Multiple status values can be provided with comma separated strings", response = Pet.class, responseContainer = "List", authorizations = { @@ -73,7 +72,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByStatus", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status); @ApiOperation(value = "Finds Pets by tags", notes = "Multiple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing.", response = Pet.class, responseContainer = "List", authorizations = { @@ -91,7 +90,7 @@ public interface PetApi { @RequestMapping(value = "/pet/findByTags", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags); @ApiOperation(value = "Find pet by ID", notes = "Returns a single pet", response = Pet.class, authorizations = { @@ -107,7 +106,7 @@ public interface PetApi { @RequestMapping(value = "/pet/{petId}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId); @ApiOperation(value = "Update an existing pet", notes = "", response = Void.class, authorizations = { @@ -127,7 +126,7 @@ public interface PetApi { produces = { "application/xml", "application/json" }, consumes = { "application/json", "application/xml" }, method = RequestMethod.PUT) - ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, @RequestHeader("Accept") String accept); + ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body); @ApiOperation(value = "Updates a pet in the store with form data", notes = "", response = Void.class, authorizations = { @@ -145,7 +144,7 @@ public interface PetApi { produces = { "application/xml", "application/json" }, consumes = { "application/x-www-form-urlencoded" }, method = RequestMethod.POST) - ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, @RequestHeader("Accept") String accept); + ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name,@ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status); @ApiOperation(value = "uploads an image", notes = "", response = ModelApiResponse.class, authorizations = { @@ -163,6 +162,6 @@ public interface PetApi { produces = { "application/json" }, consumes = { "multipart/form-data" }, method = RequestMethod.POST) - ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId,@ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata,@ApiParam(value = "file detail") @RequestPart("file") MultipartFile file); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApiController.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApiController.java index 5d0700de151..ff49a524987 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApiController.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/PetApiController.java @@ -17,103 +17,56 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class PetApiController implements PetApi { - private final ObjectMapper objectMapper; - public PetApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity addPet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) { + public ResponseEntity deletePet(@ApiParam(value = "Pet id to delete",required=true ) @PathVariable("petId") Long petId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByStatus( @NotNull@ApiParam(value = "Status values that need to be considered for filter", required = true, allowableValues = "available, pending, sold") @RequestParam(value = "status", required = true) List status) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> findPetsByTags( @NotNull@ApiParam(value = "Tags to filter by", required = true) @RequestParam(value = "tags", required = true) List tags) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity>(objectMapper.readValue(" 123456789 doggie aeiou aeiou", List.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("[ { \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"} ]", List.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getPetById(@ApiParam(value = "ID of pet to return",required=true ) @PathVariable("petId") Long petId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 doggie aeiou aeiou", Pet.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"photoUrls\" : [ \"aeiou\" ], \"name\" : \"doggie\", \"id\" : 0, \"category\" : { \"name\" : \"aeiou\", \"id\" : 6 }, \"tags\" : [ { \"name\" : \"aeiou\", \"id\" : 1 } ], \"status\" : \"available\"}", Pet.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body, - @RequestHeader("Accept") String accept) { + public ResponseEntity updatePet(@ApiParam(value = "Pet object that needs to be added to the store" ,required=true ) @Valid @RequestBody Pet body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updatePetWithForm(@ApiParam(value = "ID of pet that needs to be updated",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Updated name of the pet") @RequestPart(value="name", required=false) String name, - @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated status of the pet") @RequestPart(value="status", required=false) String status) { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity uploadFile(@ApiParam(value = "ID of pet to update",required=true ) @PathVariable("petId") Long petId, @ApiParam(value = "Additional data to pass to server") @RequestPart(value="additionalMetadata", required=false) String additionalMetadata, - @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file, - @RequestHeader("Accept") String accept) throws IOException { + @ApiParam(value = "file detail") @RequestPart("file") MultipartFile file) { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"code\" : 0, \"type\" : \"aeiou\", \"message\" : \"aeiou\"}", ModelApiResponse.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApi.java index 7ca9551fb5a..c620cbd1812 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -32,7 +31,7 @@ public interface StoreApi { @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, @RequestHeader("Accept") String accept); + ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId); @ApiOperation(value = "Returns pet inventories by status", notes = "Returns a map of status codes to quantities", response = Integer.class, responseContainer = "Map", authorizations = { @@ -46,7 +45,7 @@ public interface StoreApi { @RequestMapping(value = "/store/inventory", produces = { "application/json" }, method = RequestMethod.GET) - ResponseEntity> getInventory( @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity> getInventory(); @ApiOperation(value = "Find purchase order by ID", notes = "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions", response = Order.class, tags={ "store", }) @@ -60,7 +59,7 @@ public interface StoreApi { @RequestMapping(value = "/store/order/{order_id}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId); @ApiOperation(value = "Place an order for a pet", notes = "", response = Order.class, tags={ "store", }) @@ -73,6 +72,6 @@ public interface StoreApi { @RequestMapping(value = "/store/order", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApiController.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApiController.java index 6154d9c2639..472bda2ada0 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApiController.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/StoreApiController.java @@ -16,64 +16,32 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class StoreApiController implements StoreApi { - private final ObjectMapper objectMapper; - public StoreApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId, - @RequestHeader("Accept") String accept) { + + public ResponseEntity deleteOrder(@ApiParam(value = "ID of the order that needs to be deleted",required=true ) @PathVariable("order_id") String orderId) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity> getInventory(@RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity> getInventory() { // do some magic! - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity>(objectMapper.readValue("{ \"key\" : 0}", Map.class), HttpStatus.OK); - } - return new ResponseEntity>(HttpStatus.OK); } - public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getOrderById( @Min(1) @Max(5)@ApiParam(value = "ID of pet that needs to be fetched",required=true ) @PathVariable("order_id") Long orderId) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity placeOrder(@ApiParam(value = "order placed for purchasing the pet" ,required=true ) @Valid @RequestBody Order body) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 123456789 123 2000-01-23T04:56:07.000Z aeiou true", Order.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"petId\" : 6, \"quantity\" : 1, \"id\" : 0, \"shipDate\" : \"2000-01-23T04:56:07.000+00:00\", \"complete\" : false, \"status\" : \"placed\"}", Order.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApi.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApi.java index 9861109fd58..39777fe0e9d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApi.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApi.java @@ -13,7 +13,6 @@ import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; -import java.io.IOException; import java.util.List; import javax.validation.constraints.*; @@ -31,7 +30,7 @@ public interface UserApi { @RequestMapping(value = "/user", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @@ -43,7 +42,7 @@ public interface UserApi { @RequestMapping(value = "/user/createWithArray", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Creates list of users with given input array", notes = "", response = Void.class, tags={ "user", }) @@ -55,7 +54,7 @@ public interface UserApi { @RequestMapping(value = "/user/createWithList", produces = { "application/xml", "application/json" }, method = RequestMethod.POST) - ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, @RequestHeader("Accept") String accept); + ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body); @ApiOperation(value = "Delete user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @@ -68,7 +67,7 @@ public interface UserApi { @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.DELETE) - ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept); + ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Get user by user name", notes = "", response = User.class, tags={ "user", }) @@ -82,7 +81,7 @@ public interface UserApi { @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username); @ApiOperation(value = "Logs user into the system", notes = "", response = String.class, tags={ "user", }) @@ -95,7 +94,7 @@ public interface UserApi { @RequestMapping(value = "/user/login", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, @RequestHeader("Accept") String accept) throws IOException; + ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password); @ApiOperation(value = "Logs out current logged in user session", notes = "", response = Void.class, tags={ "user", }) @@ -107,7 +106,7 @@ public interface UserApi { @RequestMapping(value = "/user/logout", produces = { "application/xml", "application/json" }, method = RequestMethod.GET) - ResponseEntity logoutUser( @RequestHeader("Accept") String accept); + ResponseEntity logoutUser(); @ApiOperation(value = "Updated user", notes = "This can only be done by the logged in user.", response = Void.class, tags={ "user", }) @@ -120,6 +119,6 @@ public interface UserApi { @RequestMapping(value = "/user/{username}", produces = { "application/xml", "application/json" }, method = RequestMethod.PUT) - ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, @RequestHeader("Accept") String accept); + ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username,@ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApiController.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApiController.java index 24b7e18b995..e751209da25 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApiController.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/api/UserApiController.java @@ -16,84 +16,53 @@ import org.springframework.web.bind.annotation.RequestPart; import org.springframework.web.multipart.MultipartFile; import java.util.List; -import com.fasterxml.jackson.databind.ObjectMapper; -import java.io.IOException; + import javax.validation.constraints.*; import javax.validation.Valid; @Controller public class UserApiController implements UserApi { - private final ObjectMapper objectMapper; - public UserApiController(ObjectMapper objectMapper) { - this.objectMapper = objectMapper; - } - public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + + public ResponseEntity createUser(@ApiParam(value = "Created user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithArrayInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body, - @RequestHeader("Accept") String accept) { + public ResponseEntity createUsersWithListInput(@ApiParam(value = "List of user object" ,required=true ) @Valid @RequestBody List body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) { + public ResponseEntity deleteUser(@ApiParam(value = "The name that needs to be deleted",required=true ) @PathVariable("username") String username) { // do some magic! return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username, - @RequestHeader("Accept") String accept) throws IOException { + public ResponseEntity getUserByName(@ApiParam(value = "The name that needs to be fetched. Use user1 for testing. ",required=true ) @PathVariable("username") String username) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue(" 123456789 aeiou aeiou aeiou aeiou aeiou aeiou 123", User.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("{ \"firstName\" : \"aeiou\", \"lastName\" : \"aeiou\", \"password\" : \"aeiou\", \"userStatus\" : 6, \"phone\" : \"aeiou\", \"id\" : 0, \"email\" : \"aeiou\", \"username\" : \"aeiou\"}", User.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } public ResponseEntity loginUser( @NotNull@ApiParam(value = "The user name for login", required = true) @RequestParam(value = "username", required = true) String username, - @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password, - @RequestHeader("Accept") String accept) throws IOException { + @NotNull@ApiParam(value = "The password for login in clear text", required = true) @RequestParam(value = "password", required = true) String password) { // do some magic! - - if (accept != null && accept.contains("application/xml")) { - return new ResponseEntity(objectMapper.readValue("aeiou", String.class), HttpStatus.OK); - } - - - if (accept != null && accept.contains("application/json")) { - return new ResponseEntity(objectMapper.readValue("\"aeiou\"", String.class), HttpStatus.OK); - } - return new ResponseEntity(HttpStatus.OK); } - public ResponseEntity logoutUser(@RequestHeader("Accept") String accept) { + public ResponseEntity logoutUser() { // do some magic! return new ResponseEntity(HttpStatus.OK); } public ResponseEntity updateUser(@ApiParam(value = "name that need to be deleted",required=true ) @PathVariable("username") String username, - @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body, - @RequestHeader("Accept") String accept) { + @ApiParam(value = "Updated user object" ,required=true ) @Valid @RequestBody User body) { // do some magic! return new ResponseEntity(HttpStatus.OK); } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/AdditionalPropertiesClass.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/AdditionalPropertiesClass.java index 80be4236b0d..532576aad86 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/AdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/AdditionalPropertiesClass.java @@ -41,7 +41,7 @@ public class AdditionalPropertiesClass { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapProperty() { return mapProperty; } @@ -70,6 +70,7 @@ public class AdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map> getMapOfMapProperty() { return mapOfMapProperty; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Animal.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Animal.java index bc957d1c803..a59dc766c51 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Animal.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Animal.java @@ -38,7 +38,7 @@ public class Animal { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public String getClassName() { return className; } @@ -58,7 +58,7 @@ public class Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getColor() { return color; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java index f9dca7d60b5..ecff36e416a 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayNumber() { return arrayArrayNumber; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfNumberOnly.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfNumberOnly.java index e9c8a313be0..a08ff749ee1 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfNumberOnly.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayOfNumberOnly.java @@ -39,6 +39,7 @@ public class ArrayOfNumberOnly { @ApiModelProperty(value = "") @Valid + public List getArrayNumber() { return arrayNumber; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayTest.java index 78c35d3c63a..e9022fd0285 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ArrayTest.java @@ -44,7 +44,7 @@ public class ArrayTest { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayOfString() { return arrayOfString; } @@ -73,6 +73,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; } @@ -101,6 +102,7 @@ public class ArrayTest { @ApiModelProperty(value = "") @Valid + public List> getArrayArrayOfModel() { return arrayArrayOfModel; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Capitalization.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Capitalization.java index 93533c28822..d59005adf17 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Capitalization.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Capitalization.java @@ -42,7 +42,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallCamel() { return smallCamel; } @@ -62,7 +62,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalCamel() { return capitalCamel; } @@ -82,7 +82,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getSmallSnake() { return smallSnake; } @@ -102,7 +102,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getCapitalSnake() { return capitalSnake; } @@ -122,7 +122,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "") - @Valid + public String getScAETHFlowPoints() { return scAETHFlowPoints; } @@ -142,7 +142,7 @@ public class Capitalization { **/ @ApiModelProperty(value = "Name of the pet ") - @Valid + public String getATTNAME() { return ATT_NAME; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Cat.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Cat.java index edcbc354be6..28016fa5ad6 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Cat.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Cat.java @@ -28,7 +28,7 @@ public class Cat extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getDeclawed() { return declawed; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Category.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Category.java index 6dd9cb7a2ad..e2a67cf25d8 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Category.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Category.java @@ -30,7 +30,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Category { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ClassModel.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ClassModel.java index 6a6379f5b60..a5ef34a2331 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ClassModel.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ClassModel.java @@ -28,7 +28,7 @@ public class ClassModel { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Client.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Client.java index 3b8d16cabf2..aaa03c570f2 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Client.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Client.java @@ -27,7 +27,7 @@ public class Client { **/ @ApiModelProperty(value = "") - @Valid + public String getClient() { return client; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Dog.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Dog.java index 513131a9fa7..8ebd0f46a62 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Dog.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Dog.java @@ -28,7 +28,7 @@ public class Dog extends Animal { **/ @ApiModelProperty(value = "") - @Valid + public String getBreed() { return breed; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumArrays.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumArrays.java index bbf4a3036e9..4d79aa66c54 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumArrays.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumArrays.java @@ -95,7 +95,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public JustSymbolEnum getJustSymbol() { return justSymbol; } @@ -123,7 +123,7 @@ public class EnumArrays { **/ @ApiModelProperty(value = "") - @Valid + public List getArrayEnum() { return arrayEnum; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumTest.java index c7e4793cdf7..a072f992671 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/EnumTest.java @@ -133,7 +133,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumStringEnum getEnumString() { return enumString; } @@ -153,7 +153,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumIntegerEnum getEnumInteger() { return enumInteger; } @@ -173,7 +173,7 @@ public class EnumTest { **/ @ApiModelProperty(value = "") - @Valid + public EnumNumberEnum getEnumNumber() { return enumNumber; } @@ -194,6 +194,7 @@ public class EnumTest { @ApiModelProperty(value = "") @Valid + public OuterEnum getOuterEnum() { return outerEnum; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/FormatTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/FormatTest.java index 9d6cf5cd4be..5ef3ec92155 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/FormatTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/FormatTest.java @@ -68,8 +68,8 @@ public class FormatTest { * @return integer **/ @ApiModelProperty(value = "") + @Min(10) @Max(100) - @Valid public Integer getInteger() { return integer; } @@ -90,8 +90,8 @@ public class FormatTest { * @return int32 **/ @ApiModelProperty(value = "") + @Min(20) @Max(200) - @Valid public Integer getInt32() { return int32; } @@ -111,7 +111,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public Long getInt64() { return int64; } @@ -133,8 +133,9 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull - @DecimalMin("32.1") @DecimalMax("543.2") + @Valid + @DecimalMin("32.1") @DecimalMax("543.2") public BigDecimal getNumber() { return number; } @@ -155,8 +156,8 @@ public class FormatTest { * @return _float **/ @ApiModelProperty(value = "") + @DecimalMin("54.3") @DecimalMax("987.6") - @Valid public Float getFloat() { return _float; } @@ -177,8 +178,8 @@ public class FormatTest { * @return _double **/ @ApiModelProperty(value = "") + @DecimalMin("67.8") @DecimalMax("123.4") - @Valid public Double getDouble() { return _double; } @@ -197,8 +198,8 @@ public class FormatTest { * @return string **/ @ApiModelProperty(value = "") + @Pattern(regexp="/[a-z]/i") - @Valid public String getString() { return string; } @@ -219,7 +220,7 @@ public class FormatTest { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public byte[] getByte() { return _byte; } @@ -239,7 +240,7 @@ public class FormatTest { **/ @ApiModelProperty(value = "") - @Valid + public byte[] getBinary() { return binary; } @@ -261,6 +262,7 @@ public class FormatTest { @NotNull @Valid + public LocalDate getDate() { return date; } @@ -281,6 +283,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -301,6 +304,7 @@ public class FormatTest { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -320,8 +324,8 @@ public class FormatTest { **/ @ApiModelProperty(required = true, value = "") @NotNull + @Size(min=10,max=64) - @Valid public String getPassword() { return password; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/HasOnlyReadOnly.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/HasOnlyReadOnly.java index 0f8b608e261..dc59cf9c78c 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/HasOnlyReadOnly.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/HasOnlyReadOnly.java @@ -30,7 +30,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class HasOnlyReadOnly { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getFoo() { return foo; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MapTest.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MapTest.java index 1530a53f53f..f179e8e4233 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MapTest.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MapTest.java @@ -74,6 +74,7 @@ public class MapTest { @ApiModelProperty(value = "") @Valid + public Map> getMapMapOfString() { return mapMapOfString; } @@ -101,7 +102,7 @@ public class MapTest { **/ @ApiModelProperty(value = "") - @Valid + public Map getMapOfEnumString() { return mapOfEnumString; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java index d4cd89cef34..d25bba89a9c 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -40,6 +40,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public UUID getUuid() { return uuid; } @@ -60,6 +61,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public DateTime getDateTime() { return dateTime; } @@ -88,6 +90,7 @@ public class MixedPropertiesAndAdditionalPropertiesClass { @ApiModelProperty(value = "") @Valid + public Map getMap() { return map; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Model200Response.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Model200Response.java index 97349fef05c..c00e48ea6c7 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Model200Response.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Model200Response.java @@ -31,7 +31,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public Integer getName() { return name; } @@ -51,7 +51,7 @@ public class Model200Response { **/ @ApiModelProperty(value = "") - @Valid + public String getPropertyClass() { return propertyClass; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelApiResponse.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelApiResponse.java index c8882b3b1e2..1df487b3539 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelApiResponse.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelApiResponse.java @@ -33,7 +33,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public Integer getCode() { return code; } @@ -53,7 +53,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getType() { return type; } @@ -73,7 +73,7 @@ public class ModelApiResponse { **/ @ApiModelProperty(value = "") - @Valid + public String getMessage() { return message; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelReturn.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelReturn.java index 7018d7de09c..3b05293b830 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelReturn.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ModelReturn.java @@ -28,7 +28,7 @@ public class ModelReturn { **/ @ApiModelProperty(value = "") - @Valid + public Integer getReturn() { return _return; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Name.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Name.java index 46069fdd14b..a9835f910ac 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Name.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Name.java @@ -38,7 +38,7 @@ public class Name { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public Integer getName() { return name; } @@ -58,7 +58,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer getSnakeCase() { return snakeCase; } @@ -78,7 +78,7 @@ public class Name { **/ @ApiModelProperty(value = "") - @Valid + public String getProperty() { return property; } @@ -98,7 +98,7 @@ public class Name { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public Integer get123Number() { return _123Number; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/NumberOnly.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/NumberOnly.java index e243ecb429b..a990653f20d 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/NumberOnly.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/NumberOnly.java @@ -29,6 +29,7 @@ public class NumberOnly { @ApiModelProperty(value = "") @Valid + public BigDecimal getJustNumber() { return justNumber; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Order.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Order.java index 4106ac36198..5bfcf28b3ea 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Order.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Order.java @@ -77,7 +77,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -97,7 +97,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Long getPetId() { return petId; } @@ -117,7 +117,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Integer getQuantity() { return quantity; } @@ -138,6 +138,7 @@ public class Order { @ApiModelProperty(value = "") @Valid + public DateTime getShipDate() { return shipDate; } @@ -157,7 +158,7 @@ public class Order { **/ @ApiModelProperty(value = "Order Status") - @Valid + public StatusEnum getStatus() { return status; } @@ -177,7 +178,7 @@ public class Order { **/ @ApiModelProperty(value = "") - @Valid + public Boolean getComplete() { return complete; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..bd384f3dcd2 --- /dev/null +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,130 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.Valid; +import javax.validation.constraints.*; + +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + + @Valid + + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + + + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + + + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} + diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Pet.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Pet.java index c84687b699f..38d92a5b917 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Pet.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Pet.java @@ -80,7 +80,7 @@ public class Pet { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -101,6 +101,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public Category getCategory() { return category; } @@ -121,7 +122,7 @@ public class Pet { @ApiModelProperty(example = "doggie", required = true, value = "") @NotNull - @Valid + public String getName() { return name; } @@ -147,7 +148,7 @@ public class Pet { @ApiModelProperty(required = true, value = "") @NotNull - @Valid + public List getPhotoUrls() { return photoUrls; } @@ -176,6 +177,7 @@ public class Pet { @ApiModelProperty(value = "") @Valid + public List getTags() { return tags; } @@ -195,7 +197,7 @@ public class Pet { **/ @ApiModelProperty(value = "pet status in the store") - @Valid + public StatusEnum getStatus() { return status; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ReadOnlyFirst.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ReadOnlyFirst.java index 8e79be0008d..1ff292f1851 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ReadOnlyFirst.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/ReadOnlyFirst.java @@ -30,7 +30,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(readOnly = true, value = "") - @Valid + public String getBar() { return bar; } @@ -50,7 +50,7 @@ public class ReadOnlyFirst { **/ @ApiModelProperty(value = "") - @Valid + public String getBaz() { return baz; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/SpecialModelName.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/SpecialModelName.java index 3cb7b04353c..9eabbe3eca4 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/SpecialModelName.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/SpecialModelName.java @@ -27,7 +27,7 @@ public class SpecialModelName { **/ @ApiModelProperty(value = "") - @Valid + public Long getSpecialPropertyName() { return specialPropertyName; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Tag.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Tag.java index 9f8f3a25234..b3d49a2dc6a 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Tag.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/Tag.java @@ -30,7 +30,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -50,7 +50,7 @@ public class Tag { **/ @ApiModelProperty(value = "") - @Valid + public String getName() { return name; } diff --git a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/User.java b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/User.java index 501c556de27..ef3270b7aff 100644 --- a/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/User.java +++ b/samples/server/petstore/springboot-implicitHeaders/src/main/java/io/swagger/model/User.java @@ -48,7 +48,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public Long getId() { return id; } @@ -68,7 +68,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getUsername() { return username; } @@ -88,7 +88,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getFirstName() { return firstName; } @@ -108,7 +108,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getLastName() { return lastName; } @@ -128,7 +128,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getEmail() { return email; } @@ -148,7 +148,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPassword() { return password; } @@ -168,7 +168,7 @@ public class User { **/ @ApiModelProperty(value = "") - @Valid + public String getPhone() { return phone; } @@ -188,7 +188,7 @@ public class User { **/ @ApiModelProperty(value = "User Status") - @Valid + public Integer getUserStatus() { return userStatus; } diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java index 1e0e9707661..8ce42fc5cef 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApi.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; import org.springframework.http.ResponseEntity; @@ -23,6 +24,42 @@ import javax.validation.Valid; @Api(value = "fake", description = "the fake API") public interface FakeApi { + @ApiOperation(value = "", notes = "Test serialization of outer boolean types", response = Boolean.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output boolean", response = Boolean.class) }) + + @RequestMapping(value = "/fake/outer/boolean", + method = RequestMethod.POST) + ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body); + + + @ApiOperation(value = "", notes = "Test serialization of object with outer number type", response = OuterComposite.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output composite", response = OuterComposite.class) }) + + @RequestMapping(value = "/fake/outer/composite", + method = RequestMethod.POST) + ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body); + + + @ApiOperation(value = "", notes = "Test serialization of outer number types", response = BigDecimal.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output number", response = BigDecimal.class) }) + + @RequestMapping(value = "/fake/outer/number", + method = RequestMethod.POST) + ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body); + + + @ApiOperation(value = "", notes = "Test serialization of outer string types", response = String.class, tags={ "fake", }) + @ApiResponses(value = { + @ApiResponse(code = 200, message = "Output string", response = String.class) }) + + @RequestMapping(value = "/fake/outer/string", + method = RequestMethod.POST) + ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body); + + @ApiOperation(value = "To test \"client\" model", notes = "To test \"client\" model", response = Client.class, tags={ "fake", }) @ApiResponses(value = { @ApiResponse(code = 200, message = "successful operation", response = Client.class) }) diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java index 9edc15a4fc9..1ea9d51d67b 100644 --- a/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/api/FakeApiController.java @@ -4,6 +4,7 @@ import java.math.BigDecimal; import io.swagger.model.Client; import org.joda.time.DateTime; import org.joda.time.LocalDate; +import io.swagger.model.OuterComposite; import io.swagger.annotations.*; @@ -27,6 +28,26 @@ public class FakeApiController implements FakeApi { + public ResponseEntity fakeOuterBooleanSerialize(@ApiParam(value = "Input boolean as post body" ) @Valid @RequestBody Boolean body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterCompositeSerialize(@ApiParam(value = "Input composite as post body" ) @Valid @RequestBody OuterComposite body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterNumberSerialize(@ApiParam(value = "Input number as post body" ) @Valid @RequestBody BigDecimal body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + + public ResponseEntity fakeOuterStringSerialize(@ApiParam(value = "Input string as post body" ) @Valid @RequestBody String body) { + // do some magic! + return new ResponseEntity(HttpStatus.OK); + } + public ResponseEntity testClientModel(@ApiParam(value = "client model" ,required=true ) @Valid @RequestBody Client body) { // do some magic! return new ResponseEntity(HttpStatus.OK); diff --git a/samples/server/petstore/springboot/src/main/java/io/swagger/model/OuterComposite.java b/samples/server/petstore/springboot/src/main/java/io/swagger/model/OuterComposite.java new file mode 100644 index 00000000000..2502d28ab57 --- /dev/null +++ b/samples/server/petstore/springboot/src/main/java/io/swagger/model/OuterComposite.java @@ -0,0 +1,121 @@ +package io.swagger.model; + +import java.util.Objects; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonCreator; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import java.math.BigDecimal; +import javax.validation.constraints.*; +/** + * OuterComposite + */ + +public class OuterComposite { + @JsonProperty("my_number") + private BigDecimal myNumber = null; + + @JsonProperty("my_string") + private String myString = null; + + @JsonProperty("my_boolean") + private Boolean myBoolean = null; + + public OuterComposite myNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + return this; + } + + /** + * Get myNumber + * @return myNumber + **/ + @ApiModelProperty(value = "") + public BigDecimal getMyNumber() { + return myNumber; + } + + public void setMyNumber(BigDecimal myNumber) { + this.myNumber = myNumber; + } + + public OuterComposite myString(String myString) { + this.myString = myString; + return this; + } + + /** + * Get myString + * @return myString + **/ + @ApiModelProperty(value = "") + public String getMyString() { + return myString; + } + + public void setMyString(String myString) { + this.myString = myString; + } + + public OuterComposite myBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + return this; + } + + /** + * Get myBoolean + * @return myBoolean + **/ + @ApiModelProperty(value = "") + public Boolean getMyBoolean() { + return myBoolean; + } + + public void setMyBoolean(Boolean myBoolean) { + this.myBoolean = myBoolean; + } + + + @Override + public boolean equals(java.lang.Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + OuterComposite outerComposite = (OuterComposite) o; + return Objects.equals(this.myNumber, outerComposite.myNumber) && + Objects.equals(this.myString, outerComposite.myString) && + Objects.equals(this.myBoolean, outerComposite.myBoolean); + } + + @Override + public int hashCode() { + return Objects.hash(myNumber, myString, myBoolean); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class OuterComposite {\n"); + + sb.append(" myNumber: ").append(toIndentedString(myNumber)).append("\n"); + sb.append(" myString: ").append(toIndentedString(myString)).append("\n"); + sb.append(" myBoolean: ").append(toIndentedString(myBoolean)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(java.lang.Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } +} +