JSON Schema for F-Droid Data metadata files is now available

If you are contributing to F-Droid Data by writing metadata files, this might be something for you:

From now, there is a schema for “F-Droid Data metadata” at https://www.schemastore.org/json/. It defines what’s needed in a metadata file and which values are acceptable. If you are interested in learning more about what JSON Schemas are and how the work, you can take a look at https://json-schema.org/.

Some editors or IDEs offer intelligent code completion based on JSON schemas, like auto-completion and syntax checks. This might help with writeing metadata files faster, avoiding typos etc.

IDEs I know supporting YAML validation based on JSON schemas are:

  • IntelliJ based IDEs by JetBrains (e.g. IntelliJ IDEA Community Edition, PyCharm Community)
  • VSCode
  • Programs listed in “Supporting editors” at schemastore.org (scroll down)

The JetBrains IDEs with “Community” in their name as well as VSCode are free software: see JetBrains/intellij-community and microsoft/vscode (although you might prefer VSCodium/vscodium).

The IntelliJ based IDEs should support YAML metadata validation out of the box, if you are working in your F-Droid Data fork. (All files matching metadata/*.yml will get validated.) If not, you might have to change the settings at File | Settings | Languages & Frameworks | Schemas and DTDs | Remote JSON Schemas to automatically fetch schema files from schemastore.org.

At VSCode, you first have to install the YAML extension from Redhat. You probably need to enable pulling schemas from schemastore.org at Preferences: Open Settings (UI) > Extensions > YAML. Unfortunately, my experience was, that validation is sometimes wrong, since the extension uses YAML version 1.1, not 1.2, so values like yes get interpreted as boolean but are actually strings in YAML 1.2.

Coming to an end, some might still wonder why I am talking about JSON schemas, but the metadata files are actually YAMLs. The short answer is: they are compatible with each other. For the long answer, feel free to read here.

Have a nice day! :sun_with_face:


This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.