Skip to content

Conversation

@jr3cermak
Copy link
Contributor

@VyseExhale : This is similar to your pull request. There are other places to add the x-dbtype. The reflect_type entry translates the MySQL numeric types to actual types. For now, the other db's will have to tweak the code to provide the full type translation (IE: SqlServer will show numbers for x-dbtype). Since we are just including an x-dbtype, this does not really impact the swagger 2.0 standard at the moment. I tested this against the MySQL test database and resultant json at swagger.io. It is fine. The unit tests for sqlite, postgresql and mysql pass.

It is a step in the right direction I think. Note the icon is really a binary data blob instead of a string. In actuality, I believe you deliver it as a string translated to hex?

            icon:
            type: string
            x-dbtype: blob

Running tests with phpunit-5.7
PHP 7.0.15 (cli) (built: Jan 18 2017 11:21:05) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2017 Zend Technologies

SQLlite
PHPUnit 5.7.13 by Sebastian Bergmann and contributors.

................................................................. 65 / 73 ( 89%)
........ 73 / 73 (100%)

Time: 1.11 seconds, Memory: 10.00MB

OK (73 tests, 107 assertions)

MySQL
PHPUnit 5.7.13 by Sebastian Bergmann and contributors.

................................................................. 65 / 73 ( 89%)
........ 73 / 73 (100%)

Time: 4.25 seconds, Memory: 10.00MB

OK (73 tests, 108 assertions)

PostgreSQL
PHPUnit 5.7.13 by Sebastian Bergmann and contributors.

................................................................. 65 / 73 ( 89%)
........ 73 / 73 (100%)

Time: 1.33 seconds, Memory: 10.00MB

OK (73 tests, 108 assertions)

@BarryDam
Copy link
Contributor

perfect!

@mevdschee
Copy link
Owner

In actuality, I believe you deliver it as a string translated to hex?

Binary fields are exposed from the driver as hex and then converted to base64 for delivery to the end user.

@mevdschee mevdschee merged commit 113c000 into mevdschee:master Feb 25, 2017
mevdschee added a commit that referenced this pull request Feb 25, 2017
mevdschee added a commit that referenced this pull request Feb 26, 2017
@mevdschee
Copy link
Owner

I made the code use "format" to describe the contents of a type "string", while using "x-dbtype" for the database type (so just as proposed and strictly following the standard). I haven't tested properly yet. Maybe you guys can help me.

mevdschee added a commit that referenced this pull request Feb 26, 2017
mevdschee added a commit that referenced this pull request Feb 26, 2017
@mevdschee mevdschee self-assigned this Mar 3, 2017
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.

3 participants