Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add check for if query property is required #10

Open
wants to merge 1 commit into
base: refactor/querys
Choose a base branch
from

Conversation

iainkirkpatrick
Copy link
Member

currently connect throws if options.query is a single object (rather than an array) and that object is missing any of the properties (name, service, params, id, dependencies)

this adds a check for if the property is actually required - only 'service' should be

N.B. there's also a separate but related bug i think in that if you currently pass in an array of query objects for options.query, without all the properties specified, connect doesn't throw... i.e. the array of queries is not being asserted correctly. brain too tired to work on it more tonight tho

@@ -59,6 +59,7 @@ const hasProperties = curry((propertyTypes, object) => {
type,
required = false
} = propertyType
if (!required) return true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this changes everything that's not required into an any type, this means you can put anything in a non-required field and it's valid. instead i think we should check if it's not required and you put a nil value, it's good.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh good thought @ahdinosaur - of course - will look at this again 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants