Skip to content

Commit

Permalink
Merge pull request #15235 from Automattic/vkarpov15/gh-15184-refactor…
Browse files Browse the repository at this point in the history
…-map

refactor(schema): consolidate unnecessary conditionals in map toJSONSchema
  • Loading branch information
vkarpov15 authored Feb 6, 2025
2 parents 3501adf + d412624 commit ce1f8ad
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions lib/schema/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,7 @@ class SchemaMap extends SchemaType {

const isRequired = this.options.required && typeof this.options.required !== 'function';
const result = createJSONSchemaTypeDefinition('object', 'object', useBsonType, isRequired);

if (embeddedSchemaType.schema) {
result.additionalProperties = useBsonType
? { ...embeddedSchemaType.toJSONSchema(options) }
: { ...embeddedSchemaType.toJSONSchema(options) };
} else {
result.additionalProperties = embeddedSchemaType.toJSONSchema(options);
}
result.additionalProperties = embeddedSchemaType.toJSONSchema(options);

return result;
}
Expand Down

0 comments on commit ce1f8ad

Please sign in to comment.