Update schemaUtils31X.js

refactoring
This commit is contained in:
Luis Tejeda
2022-02-02 16:28:51 -06:00
parent 70c4e3181a
commit c5e8394672

View File

@@ -96,15 +96,9 @@ module.exports = {
if (hasExamplesInRoot && typeIsAnArray) { if (hasExamplesInRoot && typeIsAnArray) {
let foundType = this.findTypeByExample(schema.examples[0], schema.type); let foundType = this.findTypeByExample(schema.examples[0], schema.type);
if (foundType) { schema.type = foundType ? foundType : schema.type[0];
schema.type = foundType;
schema.example = schema.examples[0]; schema.example = schema.examples[0];
} }
else {
schema.type = schema.type[0];
schema.example = schema.examples[0];
}
}
if (hasExamplesInRoot && !typeIsAnArray) { if (hasExamplesInRoot && !typeIsAnArray) {
schema.example = schema.examples[0]; schema.example = schema.examples[0];