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

Invalid options ("#/definitions/SearchOptions") #24

Closed
pudgereyem opened this issue Feb 8, 2021 · 2 comments · Fixed by #27
Closed

Invalid options ("#/definitions/SearchOptions") #24

pudgereyem opened this issue Feb 8, 2021 · 2 comments · Fixed by #27
Labels

Comments

@pudgereyem
Copy link
Contributor

pudgereyem commented Feb 8, 2021

Issue

When calling the search module without passing queryOptionsOverrides it'll throw an error.

UnhandledPromiseRejectionWarning: InvalidOptionsError: yahooFinance.search called with invalid options.

How to replicate

await yahooFinance2.search('Apple');

Possible solution

I think it's related to this commit.

The data flow is this:

  1. User calls search('Apple') without queryOptionsOverrides
  2. search module calls moduleExec, where query.overrides is undefined
  3. moduleExec calls validateAndCoerceTypes() where it passes an undefined object
  4. validateAndCoerceTypes tries to validate an undefined object

And the issue is in 3), that we are trying to validate the overrides solely. We should validate the DEFAULTS + OVERRIDES.

@pudgereyem
Copy link
Contributor Author

@gadicc I'll prepare a PR for this. Should be a one line change.

@gadicc
Copy link
Owner

gadicc commented Feb 10, 2021

🎉 This issue has been resolved in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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