-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Replace conditionals/custom checks with a JSON schema #68
Conversation
This refactoring PR can wait until the current round of 1.2.x bug fix PRs are reviewed and released, it's not urgent. |
+1 to this approach of using a schema |
lib/metadata-json-lint/schema.rb
Outdated
}, | ||
'summary' => { | ||
'type' => 'string', | ||
'maxLength' => 144, # from https://forge.puppetlabs.com/razorsedge/snmp/3.3.1/scores |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what's being referenced at that URL, I don't see any error/warning there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No true, I copied this from the old check added in 6863e8f, not sure why there's no warning now. Perhaps the Forge behaviour has changed or the warning isn't displayed for old versions. I think I'll leave the check in though as the summary is meant to be "one line" according to the spec.
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. |
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
|
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.
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. |
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. |
Will do, thanks. |
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.