voxpupuli / metadata-json-lint

Tool to check the validity of Puppet metadata.json files
Apache License 2.0
30 stars 27 forks source link

Replace conditionals/custom checks with a JSON schema #68

Closed domcleal closed 7 years ago

domcleal commented 7 years ago

Validating metadata.json with a JSON schema provides very easy and reliable type checking, key checking, and basic validation of string formats and lengths without duplicated code or needing to add lots of very similar acceptance tests.

It also standardises error responses, using the top-level key name in the JSON format mode for any errors within that part of the document.


Obsoletes #59 and similar changes.

Validated against all VP modules, no new errors logged.

domcleal commented 7 years ago

This refactoring PR can wait until the current round of 1.2.x bug fix PRs are reviewed and released, it's not urgent.

ghoneycutt commented 7 years ago

+1 to this approach of using a schema

rnelson0 commented 7 years ago

I'd like to see if @jbondpdx can give the schema a once-over as well, to see if there are any known issues coming down the road, and to see if DOCUMENT-387 has a resolution before we commit to this.

jbondpdx commented 7 years ago

No known issues pending afaik, but I am in fact working on a fix for DOCUMENT-387. It's taking longer than it should because I'm also restructuring the page, but I'm hoping to get a PR to the docs site tomorrow.

If it helps, the section on requirements says:

The requirements key specifies external requirements for the module, particularly the Puppet version required. Although you can express any requirement here, the Puppet Forge module pages and search function support only the "puppet" requirement for Puppet version.

Specify requirements in the following format:

  • "name": The name of the requirement.
  • "version_requirement": A semver version range similar to dependencies.
"requirements": [
  {"name": "pe”, “version_requirement”: “3.x”}
]

For Puppet Enterprise versions, specify the core Puppet version of that version of Puppet Enterprise. For example, Puppet Enterprise 2017.1 contained Puppet 4.9. We do not recommend expressing requirements for Puppet versions earlier than 3.0, because they do not follow semver.

For information about formatting version requirements, see the related topic about version specifiers in module metadata.

domcleal commented 7 years ago

Rebased, removing the broken URL for the summary warning. I think the schema matches what you're proposing for DOCUMENT-387, so thanks for that.

rnelson0 commented 7 years ago

I think release 1.2.2 is okay now, but though I approved this I'm not hitting merge cause I haven't had time to look into it and I don't have the time right now to delve into that. @domcleal go ahead and merge if you think we're good to go.

domcleal commented 7 years ago

Will do, thanks.