Add valibot schemas for trail type - #14542
Closed
marjisound wants to merge 2 commits into
Closed
marjisound wants to merge 2 commits into
marjisound wants to merge 2 commits into
Conversation
Contributor
Author
|
Look at this ticket for more info #14548 |
|
"This PR is stale because it has been open 30 days with no activity. Unless a comment is added or the “stale” label removed, this will be closed in 3 days" |
|
This PR was closed because it has been stalled for 3 days with no activity. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this change?
This PR is introducing
valibotfor theFETrailType. The advantage of using valibot is that we can validate theFETrailTypejson responses in the client. Currently the client side calls to get the list of trails are not doing any validation.The cncern of doing this, is that we have to replace all the types within FETrailType into their alternative valibot schemas. Then we can use them as typescript types by using the valibot
Outputtype. e.g.type FETrailType = Output<typeof FETrailTypeSchema>;.This means, the
FEFormatalso needs to be converted into a valibot schema. But because FEFormat is used in all of the article and front data models that are processed server side, we had to run gen-schemas to generate new json schemas. The generated schemas seems to have lost their named types for the new valibot types, which is not idea.The TypeScript JSON Schema generator (typescript-json-schema) is now inlining the entire type definition instead of creating a reference to a named type.
We are going to look into how to fix this.