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

Support Ranges & Integer Validation In Config Schemas #10118

Open
wants to merge 1 commit into
base: v2
Choose a base branch
from

Conversation

solonovamax
Copy link

↪️ Pull Request

Adds support for config schemas with ranges & integer restrictions.

Closes #10117

💻 Examples

Example usage:

const JPEG_OUTPUT_SCHEMA: SchemaEntity = {
  type: 'object',
  properties: {
    quality: {
      type: 'number',
      min: 1,
      max: 100,
      integer: true,
    }
  }
}

this restricts the quality parameter to be an integer in the range of 1-100, and it will fail with an error if it is not.

🚨 Test instructions

I did not add any tests for it because there wasn't really any existing tests for the config schema stuff.
Testing it manually should be quite easy, just make a config schema with a restriction on the range or a restriction to only integers, and then make a config which violates that restriction.

✔️ PR Todo

  • Added/updated unit tests for this change
  • Filled out test instructions (In case there aren't any unit tests)
  • Included links to related issues/PRs

Also adds in a few missing properties for sharp

Signed-off-by: solonovamax <[email protected]>
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.

Support Ranges & Integer Validation In Config Schemas
1 participant