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

Provide an official JSON Schema for the config file #2113

Closed
jonasbb opened this issue Aug 26, 2019 · 5 comments · Fixed by SchemaStore/schemastore#815
Closed

Provide an official JSON Schema for the config file #2113

jonasbb opened this issue Aug 26, 2019 · 5 comments · Fixed by SchemaStore/schemastore#815
Assignees
Labels
F: version-updates ⬆️ Issues specific to version updates T: feature-request Requests for new features

Comments

@jonasbb
Copy link

jonasbb commented Aug 26, 2019

It would be great if dependabot could release an official JSON Schema for the config file format.
Ideally this would also be added to schemastore such that editors can pick up the new file automatically.
Publishing the schema allows users to benefit from auto completion in their editors, for example with VS Code.

It seems that the config validator on the dependabot website already uses a JSON schema, so it might be enough to simply publish that one.

bmuskalla referenced this issue in bmuskalla/schemastore Oct 6, 2019
Documenation for configuration: https://dependabot.com/docs/config-file/
This fixes dependabot/feedback#651
bmuskalla referenced this issue in bmuskalla/schemastore Oct 6, 2019
Documentation for configuration: https://dependabot.com/docs/config-file/
This fixes dependabot/feedback#651
@bmuskalla
Copy link

I took the liberty to do this. The pull requests has a full schema matching the current documentation on the website.
If you want to try this out locally, you can use VSCode + YAML
Given the pull request is not yet merged, you need this in your settings to enable the schema for the dependabot files:

"yaml.schemas": {
  "<path to schema>/dependabot.json": ".dependabot/config.yml",
}

Here is a quick preview how the file can now be edited within code
dependabot_schema

@feelepxyz
Copy link
Contributor

@bmuskalla nice work! Sorry for not getting to this, we've ended up with a JSON schema which isn't directly usable for the entire config file so not sure how to best re-construct and publish it. We validate each update config against a different sub-schema to get better errors. Tried using anyOf to do this but this resulted in really poor errors.

I've just created a Gist with the one we use as we have some subtle differences between package managers: https://gist.github.com/feelepxyz/d2c8f58359f29a4b4cdc935530060aae

Would love any ideas on how we could build a usable single schema that generates good error messages.

@bmuskalla
Copy link

@feelepxyz thanks for sharing. Indeed, having validation for those subtle differences is super important. I think we're in luck here. JSON Schema draft-07 supports conditional subschemas (read if/then/else - who knew this was a thing) and it seems most json/yaml parsers do understand draft -07. A tried it out in a small example, at least validation works properly in VSCode. Example makes it so the valid options version_requirement_updates depend on the value of package_manager: https://gist.github.com/bmuskalla/a30b3387e5ed97195154e7ab692f2841

Screen Shot 2019-10-07 at 4 11 52 PM

Would that work for you? If so, let me know and I can try to rework the schema to use the conditionals as well.

madskristensen referenced this issue in SchemaStore/schemastore Oct 7, 2019
Documentation for configuration: https://dependabot.com/docs/config-file/
This fixes dependabot/feedback#651
@feelepxyz
Copy link
Contributor

@bmuskalla I'll give that a go when I get a moment, if it works we could easily add an API endpoint for the schema.

@infin8x infin8x transferred this issue from dependabot/feedback Jun 29, 2020
@infin8x infin8x added F: version-updates ⬆️ Issues specific to version updates T: feature-request Requests for new features labels Jul 20, 2020
@thepwagner
Copy link
Contributor

This is a duplicate of #1927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: version-updates ⬆️ Issues specific to version updates T: feature-request Requests for new features
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants