Closed Bug 1757809 Opened 9 months ago Closed 8 months ago

Support validation for custom string types in Json Schema

Categories

(Firefox :: Nimbus Desktop Client, task)

task

Tracking

()

RESOLVED FIXED
100 Branch
Tracking Status
firefox100 --- fixed

People

(Reporter: barret, Assigned: barret)

References

Details

Attachments

(2 files)

We use a formatting URI with %variables% which we replace in the client with the URL Formatter service, but these do not strictly validate as the URI format from JSON schema, so we need to add support for our own format.

In migrating from Ajv 6 to @cfworker/json-schema, some schemas will no longer
validate due to the format: uri annotation only being a suggestion for
strings in Ajv 6. Our URLs that use %PLACEHOLDERS% (e.g., %LOCALE%) will not
pass validation as URIs due to being interpreted as invalid URL encoding.

Here we add a facade in front of @cfworker/json-schema which defines a
moz-url-format format for strings, which runs them through
Services.urlFormatter.formatURL before attempting to validate them as URIs. We
don't simply find-replace all %PLACEHOLDERS% because the URL formatter service
only supports certain variables and will leave undefined variables as-is,
leading to a validation error (which is what we want).

Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/63ae4c9485e9
Provide a JsonSchema module that supports additional Mozilla-specific formats r=mossop,emcminn
Keywords: leave-open

Backed out 3 changesets (Bug 1757809, Bug 1755599) for causing bc failures on browser_all_files_referenced.js.
Backout link
Push with failures
Failure Log

Flags: needinfo?(brennie)

Backed out because nothing referenced JsonSchema.jsm when this landed.

Flags: needinfo?(brennie)
Keywords: leave-open
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/638deb75892a
Provide a JsonSchema module that supports additional Mozilla-specific formats r=mossop,emcminn
https://hg.mozilla.org/integration/autoland/rev/23f2509de0e5
Set the base URI for the JSON Schema validator to mozilla.org r=emcminn
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/19128d3f1917
Provide a JsonSchema module that supports additional Mozilla-specific formats r=mossop,emcminn
https://hg.mozilla.org/integration/autoland/rev/feed3e0d960a
Set the base URI for the JSON Schema validator to mozilla.org r=emcminn
Status: NEW → RESOLVED
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → 100 Branch
You need to log in before you can comment on or make changes to this bug.