mikunn / openapi-schema-to-json-schema

Converts OpenAPI Schema Object to JSON Schema
75 stars 6 forks source link

Improve support for `nullable` #18

Closed ehmicky closed 6 years ago

ehmicky commented 6 years ago

At the moment, nullable is converted to JSON schema by adding null to type, e.g. { "nullable": true, "type": "string" } becomes { "type": ["string", "null"] }.

enum should also be modified in the same way, e.g. { "nullable": true, "type": "string", "enum": ["a", "b"] } becomes { "type": ["string", "null"], "enum": ["a", "b", null] }.

ehmicky commented 6 years ago

Thanks, great!