-
Notifications
You must be signed in to change notification settings - Fork 75
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
⚙️ Use simple validators in TOC #1172
Conversation
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.
Verbosity 🚀. @fwkoch I think your review here would be helpful.
"test:watch": "vitest watch", | ||
"build:esm": "tsc", | ||
"build:schema": "npx ts-json-schema-generator --path src/types.ts --type TOC -o ./src/schema.json", |
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.
I feel like we could keep this around, even if we aren't using 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.
Sure but we don't publish it yet. I'm thinking let's add it 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.
Looks nice - I suggested some changes to tighten up the types so we don't accidentally let errors sneak through. Let me know if you have questions...
packages/myst-toc/src/toc.ts
Outdated
outputEntry.file = validateString(outputEntry.file, incrementOptions('file', opts)); | ||
|
||
outputEntry = validateCommonEntry(outputEntry, opts); | ||
if (!outputEntry) { |
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.
Don't think this is possible with how validateCommonEntry
is defined (see the corresponding type updates I made).
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.
No longer, indeed!
f20ce45
to
3d3e914
Compare
Co-authored-by: Franklin Koch <[email protected]>
Co-authored-by: Franklin Koch <[email protected]>
2018149
to
ad50fcc
Compare
As we want to integrate TOC validation with our config system, and raise informative errors, this PR drops schema generation in favour of explicit imperative validation (until we get around to moving to a schema/ORM based approach).