mikunn / openapi-schema-to-json-schema

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

feat: adds option to delete Swagger Extension properties in schema objects. #26

Closed Shockolate closed 1 year ago

Shockolate commented 6 years ago

Deletes unsupported Swagger Extensions properties when converting to JSON Schema.

ehmicky commented 6 years ago

Just as a note: JSON schema v4 does allow properties which are not valid JSON schema v4 keywords (such as OpenAPI's x-* properties): https://tools.ietf.org/html/draft-zyp-json-schema-04#section-3.2

But it could be useful for people that want to opt-in to get rid of them!

Shockolate commented 6 years ago

Oh! I did not know that, @ehmicky , thanks.

I'll leave it up to @mikunn to merge or deny.

ehmicky commented 6 years ago

I think it would still be useful as an opt-in for users that want cleaner JSON schemas.

philsturgeon commented 4 years ago

I merged this in with my fork and it was throwing up errors:

    ✖ should be equivalent
    -----------------------
      operator: deepEqual
      expected: |-
        { $schema: 'http://json-schema.org/draft-04/schema#', type: 'object', properties: { boolProperty: { type: 'boolean', 'x-extension-property': true }, 'x-extension-property': true }, 'x-extension-property': true }
      actual: |-
        { type: 'object', properties: { boolProperty: { type: 'boolean', 'x-extension-property': true } }, 'x-extension-property': true, $schema: 'http://json-schema.org/draft-04/schema#' }
      at: Test.<anonymous> (/Users/phil/src/openapi-contrib/openapi-schema-to-json-schema/test/extension_properties.test.js:64:10)
      stack: |-
  Error: should be equivalent

fancy fixing it and making a new PR over here? https://github.com/openapi-contrib/openapi-schema-to-json-schema