Closed
Description
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
Metadata
Metadata
Assignees
Labels
No labels