Skip to content

docs: add schema validation for manifest json files#22517

Merged
HowardBraham merged 2 commits intodevelopfrom
add-manifest-schema-validation
Jan 22, 2024
Merged

docs: add schema validation for manifest json files#22517
HowardBraham merged 2 commits intodevelopfrom
add-manifest-schema-validation

Conversation

@davidmurdoch
Copy link
Copy Markdown
Contributor

@davidmurdoch davidmurdoch commented Jan 12, 2024

Description

Adds schema validation for manifest.json files for VSCode users.

This PR adds tooltip documentation showing what manifest.json keys do:

image

And shows errors when values are used that aren't permitted by the schema:

image

Related issues

Fixes:

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@davidmurdoch davidmurdoch requested a review from a team as a code owner January 12, 2024 15:57
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@davidmurdoch davidmurdoch added the team-extension-platform Extension Platform team label Jan 12, 2024
@davidmurdoch davidmurdoch force-pushed the add-manifest-schema-validation branch from 7f4eb2e to ab8eb15 Compare January 12, 2024 15:59
DDDDDanica
DDDDDanica previously approved these changes Jan 12, 2024
"javascript.preferences.importModuleSpecifier": "relative",
"json.schemas": [
{
"fileMatch": ["app/manifest/*/*.json"],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we restrict this just to the "base" and "chrome" manifests? It looks like this schema was just written for the Chrome extension manifest, not for Firefox.

Though the schema does seem to allow extra properties, so maybe it works adequately well for Firefox as well 🤔 Offhand I'm not aware of them using the same property for different things.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't matter which way to me, though it is useful in the partial manifest files too, I think.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, we can try applying to both, and restrict it just to Chrome+base if it causes issues.

I've tested it out, and it looks like there are no errors with the Firefox manifest. Just a few Firefox-specific keys that are missing from the schema.

Copy link
Copy Markdown
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [7ee9eb3]
Page Load Metrics (1102 ± 87 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint802961266029
domContentLoaded9213396230
load7511406110218187
domInteractive9213396230
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@HowardBraham HowardBraham merged commit 3fe9956 into develop Jan 22, 2024
@HowardBraham HowardBraham deleted the add-manifest-schema-validation branch January 22, 2024 18:41
@github-actions github-actions bot locked and limited conversation to collaborators Jan 22, 2024
@metamaskbot metamaskbot added the release-11.10.0 Issue or pull request that will be included in release 11.10.0 label Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-11.10.0 Issue or pull request that will be included in release 11.10.0 team-extension-platform Extension Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants