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

Schema Validation v2 #724

Open
9 tasks
pivotaljohn opened this issue Aug 29, 2022 · 0 comments
Open
9 tasks

Schema Validation v2 #724

pivotaljohn opened this issue Aug 29, 2022 · 0 comments

Comments

@pivotaljohn
Copy link
Contributor

pivotaljohn commented Aug 29, 2022

(this is the next feature increment of #561)


As a Configuration Author
I want to declare what constitutes a valid Data Value right in my schema definition
In a way that requires even less custom Starlark code from me ⭐
And I can write fewer annotations ⭐ because ytt can confidently infer for what have written.
So that*

  • I can state those invariants in one central place and know they will be respected throughout the execution
  • those who use my ytt library and violate one of those variants will receive a helpful error message
  • and my overall maintenance effort/costs are less than before. ⭐

(⭐ = a desired improvement on top of the MVP.)

[proposal]
[getting started]


Backlog

UX:

  • Use custom violation messages
    • on @assert/validate, implement 3-tuple rules where the third tuple is the violation template; to @schema/validation, add 3-tuple tules.
    • note: this is critical to improve the DX around unit testing (detailed in a conversation on #741)
  • disallow @schema/validation in non-schema documents.
  • disallow @assert/validate in schema documents.

Fast Follow: other must-have OOTB rules

  • matches=

Programmatic Validation of YAML

  • Validate a YAML document that contains @assert/validate annotations
    • expose assert.is_valid() as a method in @ytt:assert module

Include Validations in Schema Inspect

Authoring Conveniences:

  • Set a default validation for descendent Data Values (@schema/validate-string-default)
  • Infer @schema/nullable for all children implicated in a @schema/validation one_not_null=

Resources

Related Issues:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: To Triage
Development

No branches or pull requests

1 participant