-
Notifications
You must be signed in to change notification settings - Fork 62
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
Migrate Validation to Typebox #772
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
8257099
Add YFinance Typebox types + validation & coercion
eddie-atkinson 81cb253
Add Typebox search module
eddie-atkinson c008cca
Add QuoteSummary Typebox module
eddie-atkinson 9062fa4
Add Screener Typebox module
eddie-atkinson 4b4efee
Add RecommendationBySymbol module
eddie-atkinson 38e4bd3
Add Options Typebox Module
eddie-atkinson f67181d
Add Insights Typebox Module
eddie-atkinson 99b089a
Add Historical module
eddie-atkinson ff19859
Add FundamentalsTimeSeries module
eddie-atkinson fc450b9
Adds DailyGainers Module
eddie-atkinson 8805004
Adds Chart module
eddie-atkinson 873a0a5
Add quote typebox module, migrate quoteCombine and move over options …
eddie-atkinson 6af931d
Remove JSON schema validation pathway entirely
eddie-atkinson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@gadicc I guess this is probably a breaking change given the docs previously stated users could use this if required.
Note: We can support this if desired, by having this as an option on the config object to strip extraneous properties and then using that config value to run
Clean
from typebox to trim the result sets.Though I'm not sure I understand the use case for wanting to throw if the payload has extraneous properties but otherwise matches our validation spec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is something I would actually like to keep, in one form or another. Doesn't necessarily need identical API since we prefixed with
_
.For the user, most will never need this unless they're pedantic. We don't need to cover this.
For contributors, this has been the most useful way to see if we're adequately covering the entire response (that's why it's the default for
NODE_ENV=test
. I don't really want to accept commits unless they actually provide full typing for everything Yahoo is supplying - otherwise tests should fail.So, the big requirement here is more for test validation during development rather than regular runtime validation of the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok not an issue.
I've added this as an option to the
options.validation
field and set it to default toNODE_ENV === "test"
so that covers off the need for stricter types during development, whilst giving the options for callers to specify it themselves where it's useful to them with the caveat that it's an internal only option.Let me know if this is sufficient to support all parties, if not I can have a bit more of a think about it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brilliant, yes, that's absolutely perfect! 🙏