Skip to content

Add JSON schema for package index #183

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

Merged
merged 5 commits into from
Jun 7, 2021
Merged

Add JSON schema for package index #183

merged 5 commits into from
Jun 7, 2021

Conversation

per1234
Copy link
Contributor

@per1234 per1234 commented Jun 6, 2021

This schema defines the data structure of the Arduino package index at three compliance levels:

  • permissive: the minimum accepted format. This allows for a gradual deprecation following specification changes.
  • specification: the format as defined in the official specification
  • strict: best practices

Helper functions for reading package indexes and validating them against the schema are added, at this point for use in
the tests, but also for the schema-based rules to come.

@per1234 per1234 added type: enhancement Proposed improvement topic: code Related to content of the project itself labels Jun 6, 2021
@per1234 per1234 requested review from cmaglie and umbynos June 6, 2021 18:43
@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2021

Codecov Report

Merging #183 (5861954) into main (53c1162) will decrease coverage by 0.08%.
The diff coverage is 83.56%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #183      +/-   ##
==========================================
- Coverage   84.45%   84.37%   -0.09%     
==========================================
  Files          43       43              
  Lines        3017     3078      +61     
==========================================
+ Hits         2548     2597      +49     
- Misses        375      381       +6     
- Partials       94      100       +6     
Flag Coverage Δ
unit 84.37% <83.56%> (-0.09%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ternal/rule/ruleconfiguration/ruleconfiguration.go 100.00% <ø> (ø)
internal/rule/schema/testdata/bindata.go 33.01% <ø> (ø)
internal/project/packageindex/packageindex.go 84.61% <80.00%> (-4.86%) ⬇️
internal/rule/schema/schemadata/bindata.go 51.65% <80.00%> (+3.02%) ⬆️
internal/rule/rulefunction/packageindex.go 82.60% <100.00%> (+13.37%) ⬆️
internal/rule/schema/parsevalidationresult.go 93.25% <100.00%> (+0.23%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8ee91f5...5861954. Read the comment docs.

per1234 added 5 commits June 7, 2021 01:23
…finitions file

Since this was previously only used for library.properties, it was in that schema file, but now it will be shared with
the package index schema, and so should be in the appropriate file for that usage.
The JSON schema validation result parsing infrastructure provides general purpose capabilities for identifying the
instance and schema pointers related to a validation failure. However, when a specific type of schema keyword is used in
multiple places, it is convenient to create a dedicated wrapper function to facilitate that use case. Previously the
"format" keyword was only used for one thing in the library.properties schemas, which made it not worth a convenience
function. The package index schema uses "format" keyword also, so it now becomes worthwhile having a convenience parsing
function for it.
The JSON schema validation result parsing infrastructure provides general purpose capabilities for identifying the
instance and schema pointers related to a validation failure. However, when a specific type of schema keyword is used in
multiple places, it is convenient to create a dedicated wrapper function to facilitate that use case. Although present in
the schemas for the sake of completeness, there are no rules for checking schema validation results for the "type"
keyword because the Arduino "properties" data format treats all values as strings. For this reason, there was no convenience
function for this keyword. Due to using the JSON data format, which allows for any type, there will be type checking
schema-based rules for the package index project type. So it now becomes worthwhile having a convenience parsing function
for the "type" keyword.
…sing

The JSON schema validation result parsing infrastructure provides general purpose capabilities for identifying the
instance and schema pointers related to a validation failure. However, when a specific type of schema keyword is used in
multiple places, it is convenient to create a dedicated wrapper function to facilitate that use case. Previously the
"additionalProperties" keyword was not used in any rules, which made it not worth a convenience function. The package
index schema uses the "additionalProperties" keyword, so it now becomes worthwhile having a
convenience parsing function for it.
This schema defines the data structure of the Arduino package index at three compliance levels:

- permissive: the minimum accepted format. This allows for a gradual deprecation following specification changes.
- specification: the format as defined in the official specification
- strict: best practices

Helper functions for reading package indexes and validating them against the schema are added, at this point for use in
the tests, but also for the schema-based rules to come.
@per1234 per1234 merged commit 539e940 into arduino:main Jun 7, 2021
@per1234 per1234 deleted the package-index-schema branch June 7, 2021 08:36
@per1234 per1234 self-assigned this Nov 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: enhancement Proposed improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants