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

feat: enums and arrays on new ctype metaschema #740

Merged
merged 6 commits into from
Mar 21, 2023

Conversation

rflechtner
Copy link
Contributor

@rflechtner rflechtner commented Mar 16, 2023

fixes KILTProtocol/ticket#2456

Amends the new CType metaschema with new features:

  • Allowable values for properties of string, number & integer types can be restricted with an enum validator.
  • Arrays are allowed, with all items validating against a schema normally used to validate simple properties (i.e., boolean, string, or number, schema, or a CType reference).
  • Length assertions are allowed for arrays and strings.
  • Maximum and minimum value assertions are allowed for numbers and integers.

How to test:

It's easiest to play with the metaschema (which you can also download from https://gateway.pinata.cloud/ipfs/bafybeiah66wbkhqbqn7idkostj2iqyan2tstc4tpqt65udlhimd7hcxjyq) by validating your desired CTypes against it on https://www.jsonschemavalidator.net.

Checklist:

  • I have verified that the code works
  • I have verified that the code is easy to understand
    • If not, I have left a well-balanced amount of inline comments
  • I have left the code in a better state
  • I have documented the changes (where applicable)

Sorry, something went wrong.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@rflechtner rflechtner self-assigned this Mar 16, 2023
@rflechtner rflechtner marked this pull request as ready for review March 20, 2023 10:58
@rflechtner rflechtner force-pushed the rf-extend-ctype-features branch from e5cc1fa to 031f861 Compare March 20, 2023 13:32
Copy link
Member

@ntn-x2 ntn-x2 left a comment

Choose a reason for hiding this comment

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

Looks good to me! Just a question: I guess this definition does not allow for nested object definitions, right?

@rflechtner rflechtner merged commit 97c9361 into develop Mar 21, 2023
@rflechtner rflechtner deleted the rf-extend-ctype-features branch March 21, 2023 18:52
@rflechtner rflechtner mentioned this pull request Jun 8, 2023
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.

None yet

2 participants