Closed Bug 1752665 Opened 2 years ago Closed 2 years ago

Validate message schemas

Categories

(Firefox :: Messaging System, enhancement, P1)

Desktop
Unspecified
enhancement

Tracking

()

RESOLVED FIXED
100 Branch
Iteration:
100.1 - March 1 - March 18
Tracking Status
firefox100 --- fixed

People

(Reporter: barret, Assigned: barret)

References

(Blocks 2 open bugs)

Details

Attachments

(4 files, 1 obsolete file)

At present we do not do any validation of message schemas, but we should start so we can handle schema divergence, etc. gracefully.

Priority: P1 → P2
Iteration: --- → 99.1 - Feb 7 - Feb 20

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).

Depends on D138925

Iteration: 99.1 - Feb 7 - Feb 20 → 99.2 - Feb 21 - Mar 6
Priority: P2 → P1
Blocks: 1757611
Depends on: 1757778
Depends on: 1757809

Comment on attachment 9264204 [details]
Bug 1752665 - Provide a JsonSchema module that supports additional Mozilla-specific formats r?gijs!,andreio!

Revision D138926 was moved to bug 1757809. Setting attachment 9264204 [details] to obsolete.

Attachment #9264204 - Attachment is obsolete: true

The previous changes to the Spotlight schema made one of the logo.imageURL or
logo.imageId required. However, this is not backwards compatible with the older
Firefoxen, so we have to support the case where logo is present (e.g., for
image.size) without either of those properties, but logoImageURL is
present.

Depends on D138928

See Also: → 1759039
Iteration: 99.2 - Feb 21 - Mar 6 → 100.1 - March 1 - March 18
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/143d1392493e
Expose feature schemas as resource:// URIs r=andreio
https://hg.mozilla.org/integration/autoland/rev/d191bf245e98
Rewrite PanelTestProvider test as xpcshell test with new json schema validator r=andreio
https://hg.mozilla.org/integration/autoland/rev/e759d7cfc1a7
Validate experiment features where we have schemas r=andreio
https://hg.mozilla.org/integration/autoland/rev/4e95d6562f3a
Make the Spotlight schema less strict with respect to images r=emcminn
Flags: needinfo?(brennie)
Pushed by brennie@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/431554e2ddd2
Expose feature schemas as resource:// URIs r=andreio
https://hg.mozilla.org/integration/autoland/rev/d5abc8bb62fd
Rewrite PanelTestProvider test as xpcshell test with new json schema validator r=andreio
https://hg.mozilla.org/integration/autoland/rev/4fc6a73e72dd
Validate experiment features where we have schemas r=andreio
https://hg.mozilla.org/integration/autoland/rev/37895d08ff95
Make the Spotlight schema less strict with respect to images r=emcminn
Regressions: 1763471
Regressions: 1766430
Blocks: 1766947
Regressions: 1767266
Regressions: 1810518
Regressions: 1806097
Regressions: 1814092
No longer regressions: 1814092
Regressions: 1814092
Regressions: 1819704
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: