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

Publish Arduino project JSON schemas to "JSON Schema Store" #567

Open
3 tasks done
per1234 opened this issue Jun 30, 2023 · 0 comments
Open
3 tasks done

Publish Arduino project JSON schemas to "JSON Schema Store" #567

per1234 opened this issue Jun 30, 2023 · 0 comments
Assignees
Labels
criticality: medium Of moderate impact type: enhancement Proposed improvement

Comments

@per1234
Copy link
Contributor

per1234 commented Jun 30, 2023

Describe the request

Many of the Arduino Lint rules related to the contents of the Arduino Project data files (library.properties, boards.txt, boards.local.txt, platform.txt, platform.local.txt, programmers.txt, package index) are based on a collection of JSON schemas:

https://github.com/arduino/arduino-lint/tree/main/etc/schemas

It is possible that, in addition to their primary purpose of use internal to Arduino Lint, the schemas might be used by Arduino developers to obtain on the fly validations while editing these project configuration files, as is done with other common data files. High quality programming editors (e.g., VS Code) have the capability to use schemas in this way.

JSON Schema Store is a popular source of JSON schemas. There is some level of integration of the schemas listed on the store with common programming editors and IDEs:

https://www.schemastore.org/json/#editors

🙂 Publishing the Arduino project data file JSON schemas on JSON Schema Store will make it easier for the Arduino community to discover and use these existing resources.

Describe the current behavior

The existence of the schemas is not advertised in any way.

🙁 It is likely that very few Arduino developers are aware of the availability of these schemas. Even after they become aware of their existence, it may be unnecessarily difficult to integrate them into a programming editor and maintain them.

Additional context

Hosting Strategy

JSON Schema Store allows self-hosting schemas, which would be convenient as it would allow us to continue maintaining only a single copy of these files. However, the use of $ref in the Arduino project schemas makes this impossible:

https://github.com/SchemaStore/schemastore/blob/master/CONTRIBUTING.md#how-to-ref-from-schema_xjson-to-schema_yjson

How to $ref from schema_x.json to schema_y.json

  • Both schemas must exist locally in SchemaStore.

So it will be necessary to host the schemas in the SchemaStore/schemastore repository. Since work on the Arduino Lint codebase is often coupled with work in the schemas, removing the schemas from this repository and consuming the files from the JSON Schema Store would make development of Arduino Lint more difficult and time consuming so I think it will be best to host a copy of the schemas in the arduino/arduino-lint and SchemaStore/schemastore repositories both.

It will be important to keep these copies in sync (pushing changes made in the arduino/arduino-lint repository to JSON Schema Store as well as pulling in any changes that might have been made by contributors in the SchemaStore/schemastore repository). I recommend adding a GitHub Actions workflow to this repository to check for an out of sync state between the two copies. This can be done by downloading the schemas from JSON Schema Store and then doing a diff between the downloaded files and the files in the arduino/arduino-lint repository.

From my experience making several contributions to various schemas in the SchemaStore/schemastore repository over the years, I have been very impressed by the level of maintenance of the repository. High quality PRs are merged in a matter of days if not hours.

Usability of Schemas

The library.properties, boards.txt, boards.local.txt, platform.txt, platform.local.txt, and programmers.txt files use Arduino's bespoke "properties" data format. I fear this would make it quite difficult to integrate those JSON schemas into an editor in a useful capacity. I think the capability to parse the data files into a standard data structure would need to be implemented (which could be done using the github.com/arduino/go-properties-orderedmap Go module). So I'm not sure the very hypothetical benefits of publishing those schemas to the JSON Schema Store would be worth the effort to submit and maintain them on that platform.

Since the package index files use the standard JSON data format, I think the package index schema should be relatively easy to use.


Requested by @Freed-Wu at arduino/arduino-language-server#164 (comment)

Issue checklist

  • I searched for previous requests in the issue tracker
  • I verified the feature was still missing when using the latest nightly build
  • My request contains all necessary details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
criticality: medium Of moderate impact type: enhancement Proposed improvement
Projects
None yet
Development

No branches or pull requests

1 participant