JSON schema for manifest.json is invalid

Issue Description:

I understand that the steps here ( https://overwolf.github.io/docs/api/manifest-json#validate-your-manifestjson ) expect the developer to manually copy/paste both the schema and the app’s manifest into some web UI to validate for every release. However, that’s not at all desirable and is the only manual step in our release packaging, so I have automated it.

In doing so, however, I’ve found that the provided JSON Schema file is:

  1. Invalid JSON
  2. Invalid JSON Schema

More specifically, the JSON Schema is ironically invalid JSON because it contains multiple C-style comments. Those can be easily deleted. Also, the schema itself is invalid, since it uses regex flags within the pattern, which is not an officially supported feature of JSON Schema.

  1. A relevant ticket for this: https://github.com/json-schema-org/JSON-Schema-Test-Suite/issues/215#issuecomment-367418604
  2. The relevant spec for this: https://json-schema.org/latest/json-schema-validation.html#rfc.section.7.3.8

The solution there is to either not use case-insensitive strings or to update the pattern to support them. For example, (?i)(user|overwolf) would become ([uU][sS][eE][rR]|[oO][vV][eE][rR][wW][oO][lL][fF]. I think the first option is favorable, though: just require the strings to be the correct case. If you update the docs to provide an automated way for people to validate their schema, they’ll be immediately informed when they have schema issues anyway, including incorrect casing for their strings.

I have fixed all issues around this, though, and the working JSON Schema is here: https://gist.github.com/jeaye/88580b11fdba870cf8bd055b430526c8

Steps to reproduce:

I’m going to override the purpose of this “Steps to reproduce” section to instead talk about the steps which developers should take in order to validate their manifest.json automatically. Based on my research, the most popular and active project for this is within the NPM ecosystem, which should be familiar to most OW devs. The package is ajv ( https://ajv.js.org/ ) and we can very simply pull the latest manifest and validate it like so (this is using my manifest, since it’s valid):

curl -s -o manifest.schema.json "https://gist.githubusercontent.com/jeaye/88580b11fdba870cf8bd055b430526c8/raw/2ddd1d4035a42ff7fddcd75abcd9f1e6bffdce8d/valid-manifest-schema.json"
npx ajv-cli -s manifest.schema.json -d manifest.json

Of course, this could actually just be a single command, so there’s no need to save the current manifest.schema.json at all. That way people can always use the latest schema whenever they validate:

npx ajv-cli -s <(curl -s "https://gist.githubusercontent.com/jeaye/88580b11fdba870cf8bd055b430526c8/raw/2ddd1d4035a42ff7fddcd75abcd9f1e6bffdce8d/valid-manifest-schema.json") -d manifest.json

Impact for my app: [low, mid, high, show-stopper]

Requiring a manual step in the release process is a very big hindrance when it comes to modern practices of CI and CD. Since this is the only manual step, this is a blocker for our ability to continuously package, optimize, and validate our Overwolf zips. Overall, mid-level impact, but enough that you will hopefully take the new schema I’ve provided and update your documentation so that developers can automate this process.

So, to wrap things up, I would very much appreciate it if you guys incorporated my schema fixes, at the very least. From there, I strongly recommend you allow devs to automate this validation using ajv and that you update the docs to prefer this over manual copy/paste into a web UI.

Please attach a zip package of your logs

@jeaye thanks for the great post!

First of all, I took your updated schema and enhanced it even more. I added some missing fields and defined required properties. I upload everything to our public gists repository, so everyone can suggest an update (by creating apull request): https://github.com/overwolf/community-gists/blob/master/overwolf-manifest-schema.json

Of course, I update the link in the docs as well.
In addition, tomorrow I will add to the docs also instructions how to use the ajv-cli npm package.

So thanks a lot for the great idea. If you have more suggestions please feel free to write here or to contact me/us.

Eran

@jeaye as promised, I updated our docs: https://overwolf.github.io/docs/topics/validate-your-manifest.

Note that in VS Code terminal I couldn’t make the one-line command work.

This line trigger an error:
ajv validate -s <(curl -s "https://raw.githubusercontent.com/overwolf/community-gists/master/overwolf-manifest-schema.json") -d manifest.json

I can’t make a pipeline work in the windows terminal yet… If you have a solution for that, please let me know :slight_smile:

Thanks,
Eran

Thanks for this writeup :slight_smile:

@eransharv Ah, I don’t know about the Windows terminal support. We do almost all of our development on GNU/Linux and macOS (using Electron), which have saner terminal support. On Windows, when we have to use it, we use WSL1 + Docker to get a saner development environment for our tooling.

It’s great to see these changes applied. Cheers!