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

test(lib/data): ReplacementsSchema #31714

Merged
merged 6 commits into from
Oct 16, 2024

Conversation

RahulGautamSingh
Copy link
Collaborator

@RahulGautamSingh RahulGautamSingh commented Sep 30, 2024

Changes

Add JsonSchema and ZodSchema for the replacements.json file.

Context

It will help users detect errors when adding new replacements instantly + he updated file will get validated against the zod schema during CI, leading to quicker PR merges & less reviews.
Ref: #29942 (comment)

Documentation (please check one with an [x])

  • I have updated the documentation, or
  • No documentation update is required

How I've tested my work (please select one)

I have verified these changes via:

  • Code inspection only, or
  • Newly added/modified unit tests, or
  • No unit tests but ran on a real repository, or
  • Both unit tests + ran on a real repository

@RahulGautamSingh RahulGautamSingh marked this pull request as draft September 30, 2024 23:01
@RahulGautamSingh RahulGautamSingh marked this pull request as ready for review October 3, 2024 22:34
Copy link
Collaborator

@secustor secustor left a comment

Choose a reason for hiding this comment

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

Can we generate the schema automatically with zod-to-json-schema?

tools/schemas/replacements-schema.json Outdated Show resolved Hide resolved
tools/schemas/schema.ts Outdated Show resolved Hide resolved
@RahulGautamSingh
Copy link
Collaborator Author

Can we generate the schema automatically with zod-to-json-schema?

Will it be useful? ie. can we use thus generated schemas for better UX?

@secustor
Copy link
Collaborator

secustor commented Oct 6, 2024

Can we generate the schema automatically with zod-to-json-schema?

Will it be useful? ie. can we use thus generated schemas for better UX?

We would not to have to manage a JSON and zod schema at the same time.

@RahulGautamSingh
Copy link
Collaborator Author

RahulGautamSingh commented Oct 7, 2024

We would not to have to manage a JSON and zod schema at the same time.

Got that.

For this we will need to add one step in the build process to save the schemas created using zod-to-json in corresponding json files, which will be referenced from the data json files (replacements.json).

But, most users who come to add one replacement/monorepo won't run the build command I think as its not very necessary.
So, its better to have the json schemas ready in this case, rather than them being available after pnpm build.

Copy link
Collaborator

@secustor secustor left a comment

Choose a reason for hiding this comment

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

I, have meant that the json schema file still gets commited.

Though lets keep it like that. I guess there will be not many changes to the schema anyway.

tools/schemas/schema.ts Show resolved Hide resolved
secustor
secustor previously approved these changes Oct 7, 2024
tools/schemas/schema.ts Outdated Show resolved Hide resolved
tools/schemas/schema.ts Outdated Show resolved Hide resolved
Copy link
Collaborator

@HonkingGoose HonkingGoose left a comment

Choose a reason for hiding this comment

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

I'm happy with the text. I'll let the maintainers check the code and technical working.

@rarkins rarkins added this pull request to the merge queue Oct 16, 2024
Merged via the queue into renovatebot:main with commit 88e1f18 Oct 16, 2024
38 checks passed
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 38.124.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants