Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[cpp-restsdk] Fix handling of UUID types #554

Merged
merged 1 commit into from
Jul 14, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ public String getTypeDeclaration(Schema p) {
return getSchemaType(p) + "<utility::string_t, " + getTypeDeclaration(inner) + ">";
} else if (ModelUtils.isStringSchema(p)
|| ModelUtils.isDateSchema(p) || ModelUtils.isDateTimeSchema(p)
|| ModelUtils.isFileSchema(p)
|| ModelUtils.isFileSchema(p) || ModelUtils.isUUIDSchema(p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Peaches491 thanks again for the PR. Should the isStringSchema check at line 301 already cover that (type: string)?

    public static boolean isStringSchema(Schema schema) {
        if (schema instanceof StringSchema || SchemaTypeUtil.STRING_TYPE.equals(schema.getType())) {
            return true;
        }
        return false;
    }

Ref: https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/ModelUtils.java#L324-L329

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe so, since adding this caused the generated code to be different. Specifically, string parameters with format: "uuid" were no longer used a std::shared_ptr<utilities::string_t> and instead just used the expected utilities::string_t

Copy link
Member

@wing328 wing328 Jul 14, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. I did a test with latest master and got:

         int64_t petId,
-        boost::optional<utility::string_t> name,
+        boost::optional<std::shared_ptr<utility::string_t>> name,
         boost::optional<utility::string_t> status

|| languageSpecificPrimitives.contains(openAPIType)) {
return toModelName(openAPIType);
}
Expand Down