Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add validation for saveWebClientState, postMovie, and postScreenshot #390

Merged
merged 17 commits into from
Jun 20, 2024

Conversation

dgarciabriseno
Copy link
Contributor

This change adds a json schema validator to strictly validate the contents of the web client state being saved, and validate the given arguments for postMovie and postScreenshot.

This is implemented via a new "schema" validator on the existing InputValidator.
JSON schemas should be placed in the management/schema and then copied to docroot/schema via management/schema/deploy.sh.

  • Schema files in the management/schema may contain template parameters populated by the database.
  • Schema files in docroot/schema are final schema files that may be accessed globally by any json schema validator (not only helioviewer).

To validate a json field, the input to the validator looks like this:

$expected = array(
  'schema' => array('json' => 'https://api.helioviewer.org/schema/some_schema.json')
)

Where the first schema key tells the validator to use the schema validator, and the second array is in the form input_parameter_key => schema_file.

@dgarciabriseno dgarciabriseno merged commit bc7bca8 into Helioviewer-Project:main Jun 20, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants