Skip to content

Qt5: Added missing datatype handlers for QByteArray for swagger-type "byte"#3476

Merged
wing328 merged 2 commits intoswagger-api:masterfrom
philicious:qt5-generator-fixes
Jul 29, 2016
Merged

Qt5: Added missing datatype handlers for QByteArray for swagger-type "byte"#3476
wing328 merged 2 commits intoswagger-api:masterfrom
philicious:qt5-generator-fixes

Conversation

@philicious
Copy link
Copy Markdown
Contributor

Now you can have sth like this in your swagger and it will work with Qt5 SDK

  ProductObject:
    type: object
    properties:
      image:
        type: string
        format: byte

the property will be base64 encoded/decoded to/from JSON

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 29, 2016

@philicious thanks for the PR to improve the Qt5 C++ generator.

I noticed that you described the image as type: string, format: byte (base64-encoded string). Should it be better described as type: string, format:binary instead?

Ref: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#data-types

@wing328 wing328 added this to the v2.2.1 milestone Jul 29, 2016
@philicious
Copy link
Copy Markdown
Contributor Author

@wing328 actually no. Binary would be an octet stream. And I think you cannot wrap any octet / byte in JSON as that's a string. So you need encoding

@wing328 wing328 merged commit 293096f into swagger-api:master Jul 29, 2016
@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 29, 2016

@philicious thanks for the swift response and PR merged.

@wing328
Copy link
Copy Markdown
Contributor

wing328 commented Jul 29, 2016

@philicious for your upcoming PRs, please also run ./bin/qt5-petstore.sh to update the Qt5 C++ Petstore sample.

@philicious
Copy link
Copy Markdown
Contributor Author

oh right @wing328 , will do. I forgot about it since my last PR 😇

btw I think its only #3410 missing now for fully implementing swagger spec datatypes in Qt5 generator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants