diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java index 86dc9997010e..82f87d6b8008 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppQtAbstractCodegen.java @@ -176,6 +176,22 @@ public String toModelImport(String name) { return "#include \"" + folder + name + ".h\""; } + /** + * Resolve a schema reference. If the schema has a $ref, return the referenced schema. + * This is for nested maps. + */ + private Schema resolveSchema(Schema schema) { + if (schema == null) { + return null; + } + if (StringUtils.isNotEmpty(schema.get$ref())) { + String ref = ModelUtils.getSimpleRef(schema.get$ref()); + Schema resolved = ModelUtils.getSchema(openAPI, ref); + return resolved != null ? resolved : schema; + } + return schema; + } + /** * Optional - type declaration. This is a String which is used by the templates to instantiate your * types. There is typically special handling for different property types @@ -185,15 +201,22 @@ public String toModelImport(String name) { @Override @SuppressWarnings("rawtypes") public String getTypeDeclaration(Schema p) { - String openAPIType = getSchemaType(p); + // Resolve the schema to check for nested maps/arrays - refs that point to map schemas + Schema resolved = resolveSchema(p); - if (ModelUtils.isArraySchema(p)) { - Schema inner = ModelUtils.getSchemaItems(p); + if (ModelUtils.isArraySchema(resolved)) { + Schema inner = ModelUtils.getSchemaItems(resolved); return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">"; - } else if (ModelUtils.isMapSchema(p)) { - Schema inner = ModelUtils.getAdditionalProperties(p); - return getSchemaType(p) + ""; - } else if (ModelUtils.isBinarySchema(p)) { + } else if (ModelUtils.isMapSchema(resolved)) { + Schema inner = ModelUtils.getAdditionalProperties(resolved); + // inner can be null if additionalProperties is a boolean or not present + String innerType = inner != null ? getTypeDeclaration(inner) : PREFIX + "Object"; + return getSchemaType(p) + ""; + } + + // For non-containers, use the original schema to preserve model names + String openAPIType = getSchemaType(p); + if (ModelUtils.isBinarySchema(p)) { return getSchemaType(p); } else if (ModelUtils.isFileSchema(p)) { return getSchemaType(p); @@ -210,29 +233,32 @@ public String getTypeDeclaration(Schema p) { @Override @SuppressWarnings("rawtypes") public String toDefaultValue(Schema p) { - if (ModelUtils.isBooleanSchema(p)) { + Schema schema = resolveSchema(p); + if (ModelUtils.isBooleanSchema(schema)) { return "false"; - } else if (ModelUtils.isDateSchema(p)) { + } else if (ModelUtils.isDateSchema(schema)) { return "NULL"; - } else if (ModelUtils.isDateTimeSchema(p)) { + } else if (ModelUtils.isDateTimeSchema(schema)) { return "NULL"; - } else if (ModelUtils.isNumberSchema(p)) { - if (SchemaTypeUtil.FLOAT_FORMAT.equals(p.getFormat())) { + } else if (ModelUtils.isNumberSchema(schema)) { + if (SchemaTypeUtil.FLOAT_FORMAT.equals(schema.getFormat())) { return "0.0f"; } return "0.0"; - } else if (ModelUtils.isIntegerSchema(p)) { - if (SchemaTypeUtil.INTEGER64_FORMAT.equals(p.getFormat())) { + } else if (ModelUtils.isIntegerSchema(schema)) { + if (SchemaTypeUtil.INTEGER64_FORMAT.equals(schema.getFormat())) { return "0L"; } return "0"; - } else if (ModelUtils.isMapSchema(p)) { - Schema inner = ModelUtils.getAdditionalProperties(p); - return "QMap()"; - } else if (ModelUtils.isArraySchema(p)) { - Schema inner = ModelUtils.getSchemaItems(p); + } else if (ModelUtils.isMapSchema(schema)) { + Schema inner = ModelUtils.getAdditionalProperties(schema); + // inner can be null if additionalProperties is a boolean or not present + String innerType = inner != null ? getTypeDeclaration(inner) : PREFIX + "Object"; + return "QMap()"; + } else if (ModelUtils.isArraySchema(schema)) { + Schema inner = ModelUtils.getSchemaItems(schema); return "QList<" + getTypeDeclaration(inner) + ">()"; - } else if (ModelUtils.isStringSchema(p)) { + } else if (ModelUtils.isStringSchema(schema)) { return "QString(\"\")"; } else if (!StringUtils.isEmpty(p.get$ref())) { return toModelName(ModelUtils.getSimpleRef(p.get$ref())) + "()"; diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java index 56b3d87f6f75..5a8e523cf513 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppRestSdkClientCodegen.java @@ -291,6 +291,15 @@ public CodegenModel fromModel(String name, Schema model) { } } + // Handle additionalProperties for models that have both properties and additionalProperties + Schema addlProps = ModelUtils.getAdditionalProperties(model); + if (addlProps != null && model.getProperties() != null && !model.getProperties().isEmpty()) { + // This model has both defined properties AND additionalProperties + codegenModel.additionalPropertiesType = getTypeDeclaration(addlProps); + // Add import for web::json::value which is used to store additional properties + codegenModel.imports.add("#include "); + } + return codegenModel; } @@ -362,6 +371,34 @@ public String toApiFilename(String name) { return toApiName(name); } + /** + * Resolve a schema reference. If the schema has a $ref, return the referenced schema. + * This is for nested maps. + */ + private Schema resolveSchema(Schema schema) { + if (schema == null) { + return null; + } + if (StringUtils.isNotEmpty(schema.get$ref())) { + String ref = ModelUtils.getSimpleRef(schema.get$ref()); + Schema resolved = ModelUtils.getSchema(openAPI, ref); + return resolved != null ? resolved : schema; + } + return schema; + } + + /** + * Check if a schema is a pure map (has additionalProperties but no defined properties). + * Schemas with both properties and additionalProperties should be treated as models, not maps. + */ + private boolean isPureMapSchema(Schema schema) { + if (!ModelUtils.isMapSchema(schema)) { + return false; + } + // If the schema has defined properties, it's not a pure map + return schema.getProperties() == null || schema.getProperties().isEmpty(); + } + /** * Optional - type declaration. This is a String which is used by the * templates to instantiate your types. There is typically special handling @@ -372,15 +409,23 @@ public String toApiFilename(String name) { */ @Override public String getTypeDeclaration(Schema p) { - String openAPIType = getSchemaType(p); + // Resolve the schema to check for nested maps/arrays - refs that point to map schemas + Schema resolved = resolveSchema(p); - if (ModelUtils.isArraySchema(p)) { - Schema inner = ModelUtils.getSchemaItems(p); + if (ModelUtils.isArraySchema(resolved)) { + Schema inner = ModelUtils.getSchemaItems(resolved); return getSchemaType(p) + "<" + getTypeDeclaration(inner) + ">"; - } else if (ModelUtils.isMapSchema(p)) { - Schema inner = ModelUtils.getAdditionalProperties(p); - return getSchemaType(p) + ""; - } else if (ModelUtils.isFileSchema(p) || ModelUtils.isBinarySchema(p)) { + } else if (isPureMapSchema(resolved)) { + // Only treat as map if it has additionalProperties but NO defined properties + Schema inner = ModelUtils.getAdditionalProperties(resolved); + // inner can be null if additionalProperties is a boolean or not present + String innerType = inner != null ? getTypeDeclaration(inner) : "std::shared_ptr"; + return getSchemaType(p) + ""; + } + + // For non-containers, use the original schema to preserve model names + String openAPIType = getSchemaType(p); + if (ModelUtils.isFileSchema(p) || ModelUtils.isBinarySchema(p)) { return "std::shared_ptr<" + openAPIType + ">"; } else if (ModelUtils.isStringSchema(p) || ModelUtils.isDateSchema(p) || ModelUtils.isDateTimeSchema(p) @@ -414,8 +459,10 @@ public String toDefaultValue(Schema p) { return "0L"; } return "0"; - } else if (ModelUtils.isMapSchema(p)) { - String inner = getSchemaType(ModelUtils.getAdditionalProperties(p)); + } else if (isPureMapSchema(p)) { + Schema innerSchema = ModelUtils.getAdditionalProperties(p); + // innerSchema can be null if additionalProperties is a boolean or not present + String inner = innerSchema != null ? getSchemaType(innerSchema) : "std::shared_ptr"; return "std::map()"; } else if (ModelUtils.isArraySchema(p)) { String inner = getSchemaType(ModelUtils.getSchemaItems(p)); diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTinyClientCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTinyClientCodegen.java index 3c7b176654a4..7c55e0fbb24b 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTinyClientCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/CppTinyClientCodegen.java @@ -208,9 +208,23 @@ public String getTypeDeclaration(String str) { return str; } + /** + * Resolve a schema reference. If the schema has a $ref, return the referenced schema. + * This is for nested maps. + */ + private Schema resolveSchema(Schema schema) { + if (schema == null) { + return null; + } + if (StringUtils.isNotEmpty(schema.get$ref())) { + String ref = ModelUtils.getSimpleRef(schema.get$ref()); + Schema resolved = ModelUtils.getSchema(openAPI, ref); + return resolved != null ? resolved : schema; + } + return schema; + } + private void makeTypeMappings() { - // Types - String cpp_array_type = "std::list"; typeMapping = new HashMap<>(); typeMapping.put("string", "std::string"); @@ -219,7 +233,8 @@ private void makeTypeMappings() { typeMapping.put("long", "long"); typeMapping.put("boolean", "bool"); typeMapping.put("double", "double"); - typeMapping.put("array", cpp_array_type); + typeMapping.put("array", "std::list"); + typeMapping.put("map", "std::map"); typeMapping.put("number", "long"); typeMapping.put("binary", "std::string"); typeMapping.put("password", "std::string"); @@ -255,6 +270,19 @@ public String toInstantiationType(Schema p) { @Override public String getTypeDeclaration(Schema p) { + // Only resolve for nested maps - check if a $ref points to a map schema + Schema resolved = resolveSchema(p); + + // Handle nested maps: if a $ref resolves to a map schema, build the nested type + if (ModelUtils.isMapSchema(resolved)) { + Schema inner = ModelUtils.getAdditionalProperties(resolved); + // inner can be null if additionalProperties is a boolean or not present + String innerType = inner != null ? getTypeDeclaration(inner) : "std::string"; + return getSchemaType(p) + ""; + } + + // For everything else (including arrays), use the original behavior + // The templates handle adding array item types themselves String openAPIType = getSchemaType(p); if (languageSpecificPrimitives.contains(openAPIType)) { return toModelName(openAPIType); @@ -296,7 +324,7 @@ public String toModelImport(String name) { return "#include "; } else if (name.equals("std::list")) { return "#include "; - } else if (name.equals("Map")) { + } else if (name.equals("Map") || name.equals("std::map")) { return "#include "; } return "#include \"" + name + ".h\""; diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache index 69b6901da1e2..34f86032806b 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-header.mustache @@ -261,6 +261,23 @@ public: {{/isInherited}} {{/vars}} + {{#additionalPropertiesType}} + + /// + /// Get additional properties (properties not defined in the schema) + /// + std::map getAdditionalProperties() const; + bool additionalPropertiesIsSet() const; + void unsetAdditionalProperties(); + /// + /// Set additional properties + /// + void setAdditionalProperties(const std::map& value); + /// + /// Add a single additional property + /// + void addAdditionalProperty(const utility::string_t& key, const web::json::value& value); + {{/additionalPropertiesType}} protected: {{#vars}} @@ -285,6 +302,10 @@ protected: {{/isInherited}} {{/vars}} + {{#additionalPropertiesType}} + std::map m_AdditionalProperties; + bool m_AdditionalPropertiesIsSet; + {{/additionalPropertiesType}} }; {{/isEnum}} diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache index 697f90b2b39b..1f242863da9a 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/model-source.mustache @@ -207,6 +207,9 @@ void {{classname}}::setValue({{classname}}::e{{classname}} const value) {{/isNullable}} {{/isInherited}} {{/vars}} + {{#additionalPropertiesType}} + m_AdditionalPropertiesIsSet = false; + {{/additionalPropertiesType}} } {{classname}}::~{{classname}}() @@ -262,6 +265,16 @@ web::json::value {{classname}}::toJson() const {{/isNullable}} {{/isInherited}} {{/vars}} + {{#additionalPropertiesType}} + // Serialize additional properties + if(m_AdditionalPropertiesIsSet) + { + for(const auto& item : m_AdditionalProperties) + { + val[item.first] = item.second; + } + } + {{/additionalPropertiesType}} return val; } @@ -295,6 +308,24 @@ bool {{classname}}::fromJson(const web::json::value& val) } {{/isInherited}} {{/vars}} + {{#additionalPropertiesType}} + // Capture additional properties (keys not defined in the schema) + if(val.is_object()) + { + for(const auto& item : val.as_object()) + { + // Skip known properties + {{#vars}} + {{^isInherited}} + if(item.first == utility::conversions::to_string_t(_XPLATSTR("{{baseName}}"))) continue; + {{/isInherited}} + {{/vars}} + // This is an additional property + m_AdditionalProperties[item.first] = item.second; + m_AdditionalPropertiesIsSet = true; + } + } + {{/additionalPropertiesType}} return ok; } @@ -515,6 +546,36 @@ void {{classname}}::unset{{name}}() {{/isNullable}} } {{/isInherited}}{{/vars}} +{{#additionalPropertiesType}} + +std::map {{classname}}::getAdditionalProperties() const +{ + return m_AdditionalProperties; +} + +void {{classname}}::setAdditionalProperties(const std::map& value) +{ + m_AdditionalProperties = value; + m_AdditionalPropertiesIsSet = true; +} + +void {{classname}}::addAdditionalProperty(const utility::string_t& key, const web::json::value& value) +{ + m_AdditionalProperties[key] = value; + m_AdditionalPropertiesIsSet = true; +} + +bool {{classname}}::additionalPropertiesIsSet() const +{ + return m_AdditionalPropertiesIsSet; +} + +void {{classname}}::unsetAdditionalProperties() +{ + m_AdditionalProperties.clear(); + m_AdditionalPropertiesIsSet = false; +} +{{/additionalPropertiesType}} {{/isEnum}} {{/oneOf}} {{#modelNamespaceDeclarations}} diff --git a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache index b97a7ad8da5f..f80ede1609cb 100644 --- a/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-rest-sdk-client/modelbase-header.mustache @@ -17,6 +17,7 @@ #include #include +#include #include #include diff --git a/modules/openapi-generator/src/main/resources/cpp-tiny/model-body.mustache b/modules/openapi-generator/src/main/resources/cpp-tiny/model-body.mustache index 056ff957c200..52b12f493e4a 100644 --- a/modules/openapi-generator/src/main/resources/cpp-tiny/model-body.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-tiny/model-body.mustache @@ -141,14 +141,14 @@ bourne::json } {{#vars}} -{{dataType}}{{#isContainer}}{{#isMap}}{{/isMap}}{{^isMap}}<{{#items}}{{dataType}}{{/items}}>{{/isMap}}{{/isContainer}} +{{#isMap}}{{{dataType}}}{{/isMap}}{{^isMap}}{{dataType}}{{#isArray}}<{{#items}}{{dataType}}{{/items}}>{{/isArray}}{{/isMap}} {{classname}}::{{getter}}() { return {{name}}; } void -{{classname}}::{{setter}}({{dataType}} {{#isContainer}}{{#isMap}}{{/isMap}}{{^isMap}}<{{#items}}{{dataType}}{{/items}}>{{/isMap}}{{/isContainer}} {{name}}) +{{classname}}::{{setter}}({{#isMap}}{{{dataType}}}{{/isMap}}{{^isMap}}{{dataType}}{{#isArray}}<{{#items}}{{dataType}}{{/items}}>{{/isArray}}{{/isMap}} {{name}}) { this->{{name}} = {{name}}; } diff --git a/modules/openapi-generator/src/main/resources/cpp-tiny/model-header.mustache b/modules/openapi-generator/src/main/resources/cpp-tiny/model-header.mustache index a71ba0677c12..9db9e588c1cb 100644 --- a/modules/openapi-generator/src/main/resources/cpp-tiny/model-header.mustache +++ b/modules/openapi-generator/src/main/resources/cpp-tiny/model-header.mustache @@ -51,27 +51,32 @@ public: {{#vars}} /*! \brief Get {{{description}}} */ - {{dataType}}{{#isContainer}}{{#isMap}}{{/isMap}}{{^isMap}}<{{#items}}{{dataType}}{{/items}}>{{/isMap}}{{/isContainer}} {{getter}}(); + {{#isMap}}{{{dataType}}}{{/isMap}}{{^isMap}}{{dataType}}{{#isArray}}<{{#items}}{{dataType}}{{/items}}>{{/isArray}}{{/isMap}} {{getter}}(); /*! \brief Set {{{description}}} */ - void {{setter}}({{dataType}} {{#isContainer}}{{#isMap}}{{/isMap}}{{^isMap}}<{{#items}}{{dataType}}{{/items}}>{{/isMap}}{{/isContainer}} {{name}}); + void {{setter}}({{#isMap}}{{{dataType}}}{{/isMap}}{{^isMap}}{{dataType}}{{#isArray}}<{{#items}}{{dataType}}{{/items}}>{{/isArray}}{{/isMap}} {{name}}); {{/vars}} private: {{#vars}} - {{^isContainer}} + {{#isMap}} + {{{dataType}}} {{name}}; + {{/isMap}} + {{^isMap}} + {{#isArray}} + {{dataType}}<{{#items}}{{dataType}}{{/items}}> {{name}}; + {{/isArray}} + {{^isArray}} {{#isPrimitiveType}} {{dataType}} {{name}}{}; {{/isPrimitiveType}} {{^isPrimitiveType}} {{dataType}} {{name}}; {{/isPrimitiveType}} - {{/isContainer}} - {{#isContainer}} - {{dataType}}{{#isMap}}{{/isMap}}{{^isMap}}<{{#items}}{{dataType}}{{/items}}>{{/isMap}} {{name}}; - {{/isContainer}} + {{/isArray}} + {{/isMap}} {{/vars}} }; {{/model}} diff --git a/modules/openapi-generator/src/test/resources/3_0/cpp-nested-maps.yaml b/modules/openapi-generator/src/test/resources/3_0/cpp-nested-maps.yaml new file mode 100644 index 000000000000..dc9905aeccb1 --- /dev/null +++ b/modules/openapi-generator/src/test/resources/3_0/cpp-nested-maps.yaml @@ -0,0 +1,42 @@ +openapi: "3.0.0" +info: + title: Nested Maps Test + description: Test case for nested map types (Record>) + version: "1.0.0" +paths: + /test: + get: + summary: Test endpoint with nested maps + operationId: getNestedMaps + responses: + "200": + description: OK + content: + application/json: + schema: + $ref: '#/components/schemas/TestModel' + +components: + schemas: + # Inner map: Record + Record_string.string_: + type: object + additionalProperties: + type: string + + # Outer map: Record> + Record_string.Record_string.string__: + type: object + additionalProperties: + $ref: "#/components/schemas/Record_string.string_" + + # Model that uses the nested map + TestModel: + type: object + properties: + id: + type: string + simpleMap: + $ref: "#/components/schemas/Record_string.string_" + nestedMap: + $ref: "#/components/schemas/Record_string.Record_string.string__" diff --git a/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml index 294e342164cd..de3c4640eb23 100644 --- a/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml +++ b/modules/openapi-generator/src/test/resources/3_0/cpp-restsdk/petstore.yaml @@ -876,4 +876,34 @@ components: format: "uuid" pattern: "[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}" type: "string" - + StringMap: + description: A simple string to string map + type: object + additionalProperties: + type: string + NestedStringMap: + description: A nested map (string to map of string to string) + type: object + additionalProperties: + $ref: '#/components/schemas/StringMap' + PetStatistics: + description: Statistics about a pet including nested map for health records + type: object + properties: + groomingHistory: + description: Map of date to grooming notes + $ref: '#/components/schemas/StringMap' + healthRecords: + description: Nested map - category to (date to record) + $ref: '#/components/schemas/NestedStringMap' + SchemaWithPropsAndAddlProps: + description: Object with both defined properties and additionalProperties + type: object + nullable: true + properties: + propA: + type: string + propB: + type: string + additionalProperties: {} + diff --git a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES index 2408edf0ae03..bf35a16fd6f5 100644 --- a/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES +++ b/samples/client/petstore/cpp-restsdk/client/.openapi-generator/FILES @@ -24,6 +24,8 @@ include/CppRestPetstoreClient/model/CreateUserOrPet_request.h include/CppRestPetstoreClient/model/Order.h include/CppRestPetstoreClient/model/Page.h include/CppRestPetstoreClient/model/Pet.h +include/CppRestPetstoreClient/model/PetStatistics.h +include/CppRestPetstoreClient/model/SchemaWithPropsAndAddlProps.h include/CppRestPetstoreClient/model/SchemaWithSet.h include/CppRestPetstoreClient/model/SchemaWithSet_vaccinationBook.h include/CppRestPetstoreClient/model/Tag.h @@ -49,6 +51,8 @@ src/model/CreateUserOrPet_request.cpp src/model/Order.cpp src/model/Page.cpp src/model/Pet.cpp +src/model/PetStatistics.cpp +src/model/SchemaWithPropsAndAddlProps.cpp src/model/SchemaWithSet.cpp src/model/SchemaWithSet_vaccinationBook.cpp src/model/Tag.cpp diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h index 85a79e30c726..42458cd9f4ea 100644 --- a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/ModelBase.h @@ -27,6 +27,7 @@ #include #include +#include #include #include diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/PetStatistics.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/PetStatistics.h new file mode 100644 index 000000000000..0ed643c873fd --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/PetStatistics.h @@ -0,0 +1,93 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.19.0-SNAPSHOT. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * PetStatistics.h + * + * Statistics about a pet including nested map for health records + */ + +#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_PetStatistics_H_ +#define ORG_OPENAPITOOLS_CLIENT_MODEL_PetStatistics_H_ + +#include + +#include "CppRestPetstoreClient/ModelBase.h" + +#include +#include + +namespace org { +namespace openapitools { +namespace client { +namespace model { + + + +/// +/// Statistics about a pet including nested map for health records +/// +class PetStatistics + : public ModelBase +{ +public: + PetStatistics(); + virtual ~PetStatistics(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// PetStatistics members + + + /// + /// A simple string to string map + /// + std::map getGroomingHistory() const; + bool groomingHistoryIsSet() const; + void unsetGroomingHistory(); + void setGroomingHistory(const std::map& value); + + /// + /// A nested map (string to map of string to string) + /// + std::map> getHealthRecords() const; + bool healthRecordsIsSet() const; + void unsetHealthRecords(); + void setHealthRecords(const std::map>& value); + + +protected: + std::map m_GroomingHistory; + bool m_GroomingHistoryIsSet; + + std::map> m_HealthRecords; + bool m_HealthRecordsIsSet; + +}; + + +} +} +} +} + +#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_PetStatistics_H_ */ diff --git a/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithPropsAndAddlProps.h b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithPropsAndAddlProps.h new file mode 100644 index 000000000000..6d83ec89435b --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/include/CppRestPetstoreClient/model/SchemaWithPropsAndAddlProps.h @@ -0,0 +1,106 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.19.0-SNAPSHOT. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + +/* + * SchemaWithPropsAndAddlProps.h + * + * Object with both defined properties and additionalProperties + */ + +#ifndef ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithPropsAndAddlProps_H_ +#define ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithPropsAndAddlProps_H_ + +#include + +#include "CppRestPetstoreClient/ModelBase.h" + +#include +#include +#include +#include "CppRestPetstoreClient/AnyType.h" + +namespace org { +namespace openapitools { +namespace client { +namespace model { + + + +/// +/// Object with both defined properties and additionalProperties +/// +class SchemaWithPropsAndAddlProps + : public ModelBase +{ +public: + SchemaWithPropsAndAddlProps(); + virtual ~SchemaWithPropsAndAddlProps(); + + ///////////////////////////////////////////// + /// ModelBase overrides + + void validate() override; + + web::json::value toJson() const override; + bool fromJson(const web::json::value& json) override; + + void toMultipart(std::shared_ptr multipart, const utility::string_t& namePrefix) const override; + bool fromMultiPart(std::shared_ptr multipart, const utility::string_t& namePrefix) override; + + + ///////////////////////////////////////////// + /// SchemaWithPropsAndAddlProps members + + + utility::string_t getPropA() const; + bool propAIsSet() const; + void unsetPropA(); + void setPropA(const utility::string_t& value); + + utility::string_t getPropB() const; + bool propBIsSet() const; + void unsetPropB(); + void setPropB(const utility::string_t& value); + + + /// + /// Get additional properties (properties not defined in the schema) + /// + std::map getAdditionalProperties() const; + bool additionalPropertiesIsSet() const; + void unsetAdditionalProperties(); + /// + /// Set additional properties + /// + void setAdditionalProperties(const std::map& value); + /// + /// Add a single additional property + /// + void addAdditionalProperty(const utility::string_t& key, const web::json::value& value); + +protected: + utility::string_t m_PropA; + bool m_PropAIsSet; + + utility::string_t m_PropB; + bool m_PropBIsSet; + + std::map m_AdditionalProperties; + bool m_AdditionalPropertiesIsSet; +}; + + +} +} +} +} + +#endif /* ORG_OPENAPITOOLS_CLIENT_MODEL_SchemaWithPropsAndAddlProps_H_ */ diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/PetStatistics.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/PetStatistics.cpp new file mode 100644 index 000000000000..2b393c30e600 --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/src/model/PetStatistics.cpp @@ -0,0 +1,171 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.19.0-SNAPSHOT. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "CppRestPetstoreClient/model/PetStatistics.h" + +namespace org { +namespace openapitools { +namespace client { +namespace model { + +PetStatistics::PetStatistics() +{ + m_GroomingHistoryIsSet = false; + m_HealthRecordsIsSet = false; +} + +PetStatistics::~PetStatistics() +{ +} + +void PetStatistics::validate() +{ + // TODO: implement validation +} + +web::json::value PetStatistics::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_GroomingHistoryIsSet) + { + + val[utility::conversions::to_string_t(_XPLATSTR("groomingHistory"))] = ModelBase::toJson(m_GroomingHistory); + } + if(m_HealthRecordsIsSet) + { + + val[utility::conversions::to_string_t(_XPLATSTR("healthRecords"))] = ModelBase::toJson(m_HealthRecords); + } + + return val; +} + +bool PetStatistics::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("groomingHistory")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("groomingHistory"))); + if(!fieldValue.is_null()) + { + std::map refVal_setGroomingHistory; + ok &= ModelBase::fromJson(fieldValue, refVal_setGroomingHistory); + setGroomingHistory(refVal_setGroomingHistory); + + } + } + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("healthRecords")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("healthRecords"))); + if(!fieldValue.is_null()) + { + std::map> refVal_setHealthRecords; + ok &= ModelBase::fromJson(fieldValue, refVal_setHealthRecords); + setHealthRecords(refVal_setHealthRecords); + + } + } + return ok; +} + +void PetStatistics::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) + { + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); + } + if(m_GroomingHistoryIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("groomingHistory")), m_GroomingHistory)); + } + if(m_HealthRecordsIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("healthRecords")), m_HealthRecords)); + } +} + +bool PetStatistics::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) + { + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("groomingHistory")))) + { + std::map refVal_setGroomingHistory; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("groomingHistory"))), refVal_setGroomingHistory ); + setGroomingHistory(refVal_setGroomingHistory); + } + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("healthRecords")))) + { + std::map> refVal_setHealthRecords; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("healthRecords"))), refVal_setHealthRecords ); + setHealthRecords(refVal_setHealthRecords); + } + return ok; +} + + +std::map PetStatistics::getGroomingHistory() const +{ + return m_GroomingHistory; +} + + +void PetStatistics::setGroomingHistory(const std::map& value) +{ + m_GroomingHistory = value; + m_GroomingHistoryIsSet = true; +} + +bool PetStatistics::groomingHistoryIsSet() const +{ + return m_GroomingHistoryIsSet; +} + +void PetStatistics::unsetGroomingHistory() +{ + m_GroomingHistoryIsSet = false; +} +std::map> PetStatistics::getHealthRecords() const +{ + return m_HealthRecords; +} + + +void PetStatistics::setHealthRecords(const std::map>& value) +{ + m_HealthRecords = value; + m_HealthRecordsIsSet = true; +} + +bool PetStatistics::healthRecordsIsSet() const +{ + return m_HealthRecordsIsSet; +} + +void PetStatistics::unsetHealthRecords() +{ + m_HealthRecordsIsSet = false; +} + +} +} +} +} + + diff --git a/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithPropsAndAddlProps.cpp b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithPropsAndAddlProps.cpp new file mode 100644 index 000000000000..dd1862585dee --- /dev/null +++ b/samples/client/petstore/cpp-restsdk/client/src/model/SchemaWithPropsAndAddlProps.cpp @@ -0,0 +1,223 @@ +/** + * OpenAPI Petstore + * This is a sample server Petstore server. For this sample, you can use the api key `special-key` to test the authorization filters. + * + * The version of the OpenAPI document: 1.0.0 + * + * NOTE: This class is auto generated by OpenAPI-Generator 7.19.0-SNAPSHOT. + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + + +#include "CppRestPetstoreClient/model/SchemaWithPropsAndAddlProps.h" + +namespace org { +namespace openapitools { +namespace client { +namespace model { + +SchemaWithPropsAndAddlProps::SchemaWithPropsAndAddlProps() +{ + m_PropA = utility::conversions::to_string_t(""); + m_PropAIsSet = false; + m_PropB = utility::conversions::to_string_t(""); + m_PropBIsSet = false; + m_AdditionalPropertiesIsSet = false; +} + +SchemaWithPropsAndAddlProps::~SchemaWithPropsAndAddlProps() +{ +} + +void SchemaWithPropsAndAddlProps::validate() +{ + // TODO: implement validation +} + +web::json::value SchemaWithPropsAndAddlProps::toJson() const +{ + web::json::value val = web::json::value::object(); + if(m_PropAIsSet) + { + + val[utility::conversions::to_string_t(_XPLATSTR("propA"))] = ModelBase::toJson(m_PropA); + } + if(m_PropBIsSet) + { + + val[utility::conversions::to_string_t(_XPLATSTR("propB"))] = ModelBase::toJson(m_PropB); + } + // Serialize additional properties + if(m_AdditionalPropertiesIsSet) + { + for(const auto& item : m_AdditionalProperties) + { + val[item.first] = item.second; + } + } + + return val; +} + +bool SchemaWithPropsAndAddlProps::fromJson(const web::json::value& val) +{ + bool ok = true; + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("propA")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("propA"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPropA; + ok &= ModelBase::fromJson(fieldValue, refVal_setPropA); + setPropA(refVal_setPropA); + + } + } + if(val.has_field(utility::conversions::to_string_t(_XPLATSTR("propB")))) + { + const web::json::value& fieldValue = val.at(utility::conversions::to_string_t(_XPLATSTR("propB"))); + if(!fieldValue.is_null()) + { + utility::string_t refVal_setPropB; + ok &= ModelBase::fromJson(fieldValue, refVal_setPropB); + setPropB(refVal_setPropB); + + } + } + // Capture additional properties (keys not defined in the schema) + if(val.is_object()) + { + for(const auto& item : val.as_object()) + { + // Skip known properties + if(item.first == utility::conversions::to_string_t(_XPLATSTR("propA"))) continue; + if(item.first == utility::conversions::to_string_t(_XPLATSTR("propB"))) continue; + // This is an additional property + m_AdditionalProperties[item.first] = item.second; + m_AdditionalPropertiesIsSet = true; + } + } + return ok; +} + +void SchemaWithPropsAndAddlProps::toMultipart(std::shared_ptr multipart, const utility::string_t& prefix) const +{ + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) + { + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); + } + if(m_PropAIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("propA")), m_PropA)); + } + if(m_PropBIsSet) + { + multipart->add(ModelBase::toHttpContent(namePrefix + utility::conversions::to_string_t(_XPLATSTR("propB")), m_PropB)); + } +} + +bool SchemaWithPropsAndAddlProps::fromMultiPart(std::shared_ptr multipart, const utility::string_t& prefix) +{ + bool ok = true; + utility::string_t namePrefix = prefix; + if(namePrefix.size() > 0 && namePrefix.substr(namePrefix.size() - 1) != utility::conversions::to_string_t(_XPLATSTR("."))) + { + namePrefix += utility::conversions::to_string_t(_XPLATSTR(".")); + } + + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("propA")))) + { + utility::string_t refVal_setPropA; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("propA"))), refVal_setPropA ); + setPropA(refVal_setPropA); + } + if(multipart->hasContent(utility::conversions::to_string_t(_XPLATSTR("propB")))) + { + utility::string_t refVal_setPropB; + ok &= ModelBase::fromHttpContent(multipart->getContent(utility::conversions::to_string_t(_XPLATSTR("propB"))), refVal_setPropB ); + setPropB(refVal_setPropB); + } + return ok; +} + + +utility::string_t SchemaWithPropsAndAddlProps::getPropA() const +{ + return m_PropA; +} + + +void SchemaWithPropsAndAddlProps::setPropA(const utility::string_t& value) +{ + m_PropA = value; + m_PropAIsSet = true; +} + +bool SchemaWithPropsAndAddlProps::propAIsSet() const +{ + return m_PropAIsSet; +} + +void SchemaWithPropsAndAddlProps::unsetPropA() +{ + m_PropAIsSet = false; +} +utility::string_t SchemaWithPropsAndAddlProps::getPropB() const +{ + return m_PropB; +} + + +void SchemaWithPropsAndAddlProps::setPropB(const utility::string_t& value) +{ + m_PropB = value; + m_PropBIsSet = true; +} + +bool SchemaWithPropsAndAddlProps::propBIsSet() const +{ + return m_PropBIsSet; +} + +void SchemaWithPropsAndAddlProps::unsetPropB() +{ + m_PropBIsSet = false; +} + + +std::map SchemaWithPropsAndAddlProps::getAdditionalProperties() const +{ + return m_AdditionalProperties; +} + +void SchemaWithPropsAndAddlProps::setAdditionalProperties(const std::map& value) +{ + m_AdditionalProperties = value; + m_AdditionalPropertiesIsSet = true; +} + +void SchemaWithPropsAndAddlProps::addAdditionalProperty(const utility::string_t& key, const web::json::value& value) +{ + m_AdditionalProperties[key] = value; + m_AdditionalPropertiesIsSet = true; +} + +bool SchemaWithPropsAndAddlProps::additionalPropertiesIsSet() const +{ + return m_AdditionalPropertiesIsSet; +} + +void SchemaWithPropsAndAddlProps::unsetAdditionalProperties() +{ + m_AdditionalProperties.clear(); + m_AdditionalPropertiesIsSet = false; +} +} +} +} +} + + diff --git a/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.cpp b/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.cpp index 7c5d4dee655a..5310dfa133da 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.cpp +++ b/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.cpp @@ -106,7 +106,7 @@ ApiResponse::getCode() } void -ApiResponse::setCode(int code) +ApiResponse::setCode(int code) { this->code = code; } @@ -118,7 +118,7 @@ ApiResponse::getType() } void -ApiResponse::setType(std::string type) +ApiResponse::setType(std::string type) { this->type = type; } @@ -130,7 +130,7 @@ ApiResponse::getMessage() } void -ApiResponse::setMessage(std::string message) +ApiResponse::setMessage(std::string message) { this->message = message; } diff --git a/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.h b/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.h index dbaf8abcaf38..7ffab8d7ed2e 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.h +++ b/samples/client/petstore/cpp-tiny/lib/Models/ApiResponse.h @@ -51,21 +51,21 @@ class ApiResponse{ /*! \brief Set */ - void setCode(int code); + void setCode(int code); /*! \brief Get */ std::string getType(); /*! \brief Set */ - void setType(std::string type); + void setType(std::string type); /*! \brief Get */ std::string getMessage(); /*! \brief Set */ - void setMessage(std::string message); + void setMessage(std::string message); private: diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Category.cpp b/samples/client/petstore/cpp-tiny/lib/Models/Category.cpp index aa76177dae7c..c3a78824b457 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Category.cpp +++ b/samples/client/petstore/cpp-tiny/lib/Models/Category.cpp @@ -85,7 +85,7 @@ Category::getId() } void -Category::setId(long id) +Category::setId(long id) { this->id = id; } @@ -97,7 +97,7 @@ Category::getName() } void -Category::setName(std::string name) +Category::setName(std::string name) { this->name = name; } diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Category.h b/samples/client/petstore/cpp-tiny/lib/Models/Category.h index 9c90e3dd4160..b5869017edf4 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Category.h +++ b/samples/client/petstore/cpp-tiny/lib/Models/Category.h @@ -51,14 +51,14 @@ class Category{ /*! \brief Set */ - void setId(long id); + void setId(long id); /*! \brief Get */ std::string getName(); /*! \brief Set */ - void setName(std::string name); + void setName(std::string name); private: diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Order.cpp b/samples/client/petstore/cpp-tiny/lib/Models/Order.cpp index ca7083516acc..9ceb7a72009f 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Order.cpp +++ b/samples/client/petstore/cpp-tiny/lib/Models/Order.cpp @@ -169,7 +169,7 @@ Order::getId() } void -Order::setId(long id) +Order::setId(long id) { this->id = id; } @@ -181,7 +181,7 @@ Order::getPetId() } void -Order::setPetId(long petId) +Order::setPetId(long petId) { this->petId = petId; } @@ -193,7 +193,7 @@ Order::getQuantity() } void -Order::setQuantity(int quantity) +Order::setQuantity(int quantity) { this->quantity = quantity; } @@ -205,7 +205,7 @@ Order::getShipDate() } void -Order::setShipDate(std::string shipDate) +Order::setShipDate(std::string shipDate) { this->shipDate = shipDate; } @@ -217,7 +217,7 @@ Order::getStatus() } void -Order::setStatus(std::string status) +Order::setStatus(std::string status) { this->status = status; } @@ -229,7 +229,7 @@ Order::isComplete() } void -Order::setComplete(bool complete) +Order::setComplete(bool complete) { this->complete = complete; } diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Order.h b/samples/client/petstore/cpp-tiny/lib/Models/Order.h index 6f36404f959a..fda67c81d6ed 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Order.h +++ b/samples/client/petstore/cpp-tiny/lib/Models/Order.h @@ -51,42 +51,42 @@ class Order{ /*! \brief Set */ - void setId(long id); + void setId(long id); /*! \brief Get */ long getPetId(); /*! \brief Set */ - void setPetId(long petId); + void setPetId(long petId); /*! \brief Get */ int getQuantity(); /*! \brief Set */ - void setQuantity(int quantity); + void setQuantity(int quantity); /*! \brief Get */ std::string getShipDate(); /*! \brief Set */ - void setShipDate(std::string shipDate); + void setShipDate(std::string shipDate); /*! \brief Get Order Status */ std::string getStatus(); /*! \brief Set Order Status */ - void setStatus(std::string status); + void setStatus(std::string status); /*! \brief Get */ bool isComplete(); /*! \brief Set */ - void setComplete(bool complete); + void setComplete(bool complete); private: diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Pet.cpp b/samples/client/petstore/cpp-tiny/lib/Models/Pet.cpp index 43d7b89c40f6..a32c12164a3b 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Pet.cpp +++ b/samples/client/petstore/cpp-tiny/lib/Models/Pet.cpp @@ -205,7 +205,7 @@ Pet::getId() } void -Pet::setId(long id) +Pet::setId(long id) { this->id = id; } @@ -217,7 +217,7 @@ Pet::getCategory() } void -Pet::setCategory(Category category) +Pet::setCategory(Category category) { this->category = category; } @@ -229,7 +229,7 @@ Pet::getName() } void -Pet::setName(std::string name) +Pet::setName(std::string name) { this->name = name; } @@ -241,7 +241,7 @@ Pet::getPhotoUrls() } void -Pet::setPhotoUrls(std::list photoUrls) +Pet::setPhotoUrls(std::list photoUrls) { this->photoUrls = photoUrls; } @@ -253,7 +253,7 @@ Pet::getTags() } void -Pet::setTags(std::list tags) +Pet::setTags(std::list tags) { this->tags = tags; } @@ -265,7 +265,7 @@ Pet::getStatus() } void -Pet::setStatus(std::string status) +Pet::setStatus(std::string status) { this->status = status; } diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Pet.h b/samples/client/petstore/cpp-tiny/lib/Models/Pet.h index 3329735f8a16..7bd5d117a8ec 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Pet.h +++ b/samples/client/petstore/cpp-tiny/lib/Models/Pet.h @@ -54,42 +54,42 @@ class Pet{ /*! \brief Set */ - void setId(long id); + void setId(long id); /*! \brief Get */ Category getCategory(); /*! \brief Set */ - void setCategory(Category category); + void setCategory(Category category); /*! \brief Get */ std::string getName(); /*! \brief Set */ - void setName(std::string name); + void setName(std::string name); /*! \brief Get */ std::list getPhotoUrls(); /*! \brief Set */ - void setPhotoUrls(std::list photoUrls); + void setPhotoUrls(std::list photoUrls); /*! \brief Get */ std::list getTags(); /*! \brief Set */ - void setTags(std::list tags); + void setTags(std::list tags); /*! \brief Get pet status in the store */ std::string getStatus(); /*! \brief Set pet status in the store */ - void setStatus(std::string status); + void setStatus(std::string status); private: diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Tag.cpp b/samples/client/petstore/cpp-tiny/lib/Models/Tag.cpp index 2a7acb6b22b4..51468e93c112 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Tag.cpp +++ b/samples/client/petstore/cpp-tiny/lib/Models/Tag.cpp @@ -85,7 +85,7 @@ Tag::getId() } void -Tag::setId(long id) +Tag::setId(long id) { this->id = id; } @@ -97,7 +97,7 @@ Tag::getName() } void -Tag::setName(std::string name) +Tag::setName(std::string name) { this->name = name; } diff --git a/samples/client/petstore/cpp-tiny/lib/Models/Tag.h b/samples/client/petstore/cpp-tiny/lib/Models/Tag.h index e05bcdc92900..af035f6f0455 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/Tag.h +++ b/samples/client/petstore/cpp-tiny/lib/Models/Tag.h @@ -51,14 +51,14 @@ class Tag{ /*! \brief Set */ - void setId(long id); + void setId(long id); /*! \brief Get */ std::string getName(); /*! \brief Set */ - void setName(std::string name); + void setName(std::string name); private: diff --git a/samples/client/petstore/cpp-tiny/lib/Models/User.cpp b/samples/client/petstore/cpp-tiny/lib/Models/User.cpp index cad8a872247b..04efa2722133 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/User.cpp +++ b/samples/client/petstore/cpp-tiny/lib/Models/User.cpp @@ -211,7 +211,7 @@ User::getId() } void -User::setId(long id) +User::setId(long id) { this->id = id; } @@ -223,7 +223,7 @@ User::getUsername() } void -User::setUsername(std::string username) +User::setUsername(std::string username) { this->username = username; } @@ -235,7 +235,7 @@ User::getFirstName() } void -User::setFirstName(std::string firstName) +User::setFirstName(std::string firstName) { this->firstName = firstName; } @@ -247,7 +247,7 @@ User::getLastName() } void -User::setLastName(std::string lastName) +User::setLastName(std::string lastName) { this->lastName = lastName; } @@ -259,7 +259,7 @@ User::getEmail() } void -User::setEmail(std::string email) +User::setEmail(std::string email) { this->email = email; } @@ -271,7 +271,7 @@ User::getPassword() } void -User::setPassword(std::string password) +User::setPassword(std::string password) { this->password = password; } @@ -283,7 +283,7 @@ User::getPhone() } void -User::setPhone(std::string phone) +User::setPhone(std::string phone) { this->phone = phone; } @@ -295,7 +295,7 @@ User::getUserStatus() } void -User::setUserStatus(int userStatus) +User::setUserStatus(int userStatus) { this->userStatus = userStatus; } diff --git a/samples/client/petstore/cpp-tiny/lib/Models/User.h b/samples/client/petstore/cpp-tiny/lib/Models/User.h index 84de5204ced8..9b1fce2614c4 100644 --- a/samples/client/petstore/cpp-tiny/lib/Models/User.h +++ b/samples/client/petstore/cpp-tiny/lib/Models/User.h @@ -51,56 +51,56 @@ class User{ /*! \brief Set */ - void setId(long id); + void setId(long id); /*! \brief Get */ std::string getUsername(); /*! \brief Set */ - void setUsername(std::string username); + void setUsername(std::string username); /*! \brief Get */ std::string getFirstName(); /*! \brief Set */ - void setFirstName(std::string firstName); + void setFirstName(std::string firstName); /*! \brief Get */ std::string getLastName(); /*! \brief Set */ - void setLastName(std::string lastName); + void setLastName(std::string lastName); /*! \brief Get */ std::string getEmail(); /*! \brief Set */ - void setEmail(std::string email); + void setEmail(std::string email); /*! \brief Get */ std::string getPassword(); /*! \brief Set */ - void setPassword(std::string password); + void setPassword(std::string password); /*! \brief Get */ std::string getPhone(); /*! \brief Set */ - void setPhone(std::string phone); + void setPhone(std::string phone); /*! \brief Get User Status */ int getUserStatus(); /*! \brief Set User Status */ - void setUserStatus(int userStatus); + void setUserStatus(int userStatus); private: diff --git a/samples/client/petstore/cpp-tiny/lib/service/StoreApi.h b/samples/client/petstore/cpp-tiny/lib/service/StoreApi.h index dd29c9f96e1e..2a104628cdfd 100644 --- a/samples/client/petstore/cpp-tiny/lib/service/StoreApi.h +++ b/samples/client/petstore/cpp-tiny/lib/service/StoreApi.h @@ -8,8 +8,8 @@ #include "Helpers.h" #include -#include #include "Order.h" +#include namespace Tiny {