-
-
Notifications
You must be signed in to change notification settings - Fork 624
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
Bring schema in house #910
Conversation
Quick note. I know that single commits are preferred, but I thought it would be slightly easier to review as separate commits since the first commit is just copying the schema as-is and the other two allow you to see the changes that I've made. I'm happy to squash these once reviewed. |
a160baa
to
060dfc4
Compare
Hi @pd93, This makes sense. I didn't know it was possible to reference another file via a URL to make this possible. Some comments:
|
- Also reorder them both to match the struct definitions. This makes it easier to compare them
060dfc4
to
620e695
Compare
Yeah, agreed. I think the first step would be to get this merged and then I can open a PR on their side. and ask @madskristensen if this is the correct approach. If it's not, we can always revert this change. Nothing will change until a PR is merged in schemastore anyway.
This is a great idea, I've pushed a change. |
Thanks @pd93! |
The "Check Taskfiles" template workflow validates the project's taskfiles against the official JSON schema. The contents of that schema was recently moved from the previous location in the Schema Store to the Task project repository: go-task/task#910 An attempt was made to mitigate the impact of that move by replacing the content in the original schema with an external reference to the new one. However, the schema validator used by the workflow does not automatically follow external references, which caused the workflow to fail: schema /home/runner/work/_temp/taskfile-schema/taskfile.json is invalid error: can't resolve reference https://taskfile.dev/schema.json from id # Although this could be resolved by also downloading the referenced schema, since the original schema intentionally does not contain anything of value, the better fix is to simply use the real schema directly in the workflow.
The "Check Taskfiles" template workflow validates the project's taskfiles against the official JSON schema. The contents of that schema was recently moved from the previous location in the Schema Store to the Task project repository: go-task/task#910 An attempt was made to mitigate the impact of that move by replacing the content in the original schema with an external reference to the new one. However, the schema validator used by the workflow does not automatically follow external references, which caused the workflow to fail: schema /home/runner/work/_temp/taskfile-schema/taskfile.json is invalid error: can't resolve reference https://taskfile.dev/schema.json from id # Although this could be resolved by also downloading the referenced schema, since the original schema intentionally does not contain anything of value, the better fix is to simply use the real schema directly in the workflow.
The "Check Taskfiles" template workflow validates the project's taskfiles against the official JSON schema. The contents of that schema was recently moved from the previous location in the Schema Store to the Task project repository: go-task/task#910 An attempt was made to mitigate the impact of that move by replacing the content in the original schema with an external reference to the new one. However, the schema validator used by the workflow does not automatically follow external references, which caused the workflow to fail: schema /home/runner/work/_temp/taskfile-schema/taskfile.json is invalid error: can't resolve reference https://taskfile.dev/schema.json from id # Although this could be resolved by also downloading the referenced schema, since the original schema intentionally does not contain anything of value, the better fix is to simply use the real schema directly in the workflow.
Since the Taskfile schema was added to SchemaStore/schemastore, it has slowly diverged as features have been added and documentation changed. This means that users are often left with an error message in their editor saying that a field is not supported when it is.
This PR brings the Taskfile schema back into the Task repo. This will allow us to ensure that it is updated whenever a new feature is added and that users will not run into errors when they shouldn't.
In order to get this to work properly, we will need to update the schema in SchemaStore/schemastore to look like this:
A good example of another project that already does this is MarkdownLint. You can see the schema here and the reference in schemastore here.
Once this change is merged and the schemastore reference is updated, we should also update the contribution guide to ask contributors to keep the schema up-to-date when making changes.
In addition to bringing the schema in-house, I've also updated the schema descriptions and the docs so that they match (updating both where appropriate) and I've reordered all the keys in both so that they appear in the same order as the Go structs. This makes it much easier to "spot the difference", so it is less likely that keys are missed in the future.