Skip to content

Commit

Permalink
fix: disable default required type for mongoose conditional required …
Browse files Browse the repository at this point in the history
…fields (#204)
  • Loading branch information
antoniopresto authored and nodkz committed Jan 21, 2020
1 parent f5b5530 commit dfa0e21
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/resolvers/createMany.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function createMany<TSource: MongooseDocument, TContext>(
for (const field in tree) {
if (tree.hasOwnProperty(field)) {
const fieldOptions = tree[field];
if (fieldOptions.required) {
if (fieldOptions.required && typeof fieldOptions.required !== 'function') {
requiredFields.push(field);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/resolvers/createOne.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function createOne<TSource: MongooseDocument, TContext>(
for (const field in tree) {
if (tree.hasOwnProperty(field)) {
const fieldOptions = tree[field];
if (fieldOptions.required) {
if (fieldOptions.required && typeof fieldOptions.required !== 'function') {
requiredFields.push(field);
}
}
Expand Down

0 comments on commit dfa0e21

Please sign in to comment.