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:
- Invalid JSON
- 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.
- A relevant ticket for this: regular expressions should support flags · Issue #215 · json-schema-org/JSON-Schema-Test-Suite · GitHub
- The relevant spec for this: Redirecting…
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: A valid JSON Schema for manifest.json · GitHub
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