Closed hugomallet closed 6 years ago
Hi,
Types are not converted if they are defined in the definitions field.
Simple example to reproduce :
const toOpenApi = require('json-schema-to-openapi-schema'); const { inspect } = require('util'); const successfulSchema = { $schema: 'http://json-schema.org/draft-04/schema#', type: 'object', properties: { issue: { type: ['string', 'null'] } } }; const failingSchema = { $schema: 'http://json-schema.org/draft-04/schema#', type: 'object', properties: { issue: { $ref: '#/definitions/issue' } }, definitions: { issue: { type: ['string', 'null'] } } }; const successfullyConvertedSchema = toOpenApi(successfulSchema); const failedConvertedSchema = toOpenApi(failingSchema); console.log('SUCCESS'); console.log(inspect(successfullyConvertedSchema, { compact: false, depth: 3 })); console.log('FAILURE'); console.log(inspect(failedConvertedSchema, { compact: false, depth: 3 }));
Expected result : failingSchema should be converted
Hugo
Hey there! Sorry but its not about definitions, it's just that this tool does not resolve $ref. There are tools around that do, and you should use those before passing the result to this document.
Hi,
Types are not converted if they are defined in the definitions field.
Simple example to reproduce :
Expected result : failingSchema should be converted
Hugo