Move regex validation checks to template schema#108
Merged
shreyas-goenka merged 11 commits intomainfrom Nov 9, 2023
Merged
Conversation
Contributor
arpitjasa-db
left a comment
There was a problem hiding this comment.
This is awesome thanks a ton @shreyas-goenka ! I'll approve once the CLI PR merges and we can test this out with some project generations
arpitjasa-db
reviewed
Nov 2, 2023
Contributor
There was a problem hiding this comment.
@shreyas-goenka would you mind updating the tests in tests/test_create_project.py::test_generate_fails_with_invalid_params for the expected error once the CLI update goes out? I believe the tests should pass after that and we can merge this in!
Collaborator
Author
|
This PR requires a CLI side fix before proceeding: databricks/cli#959 |
github-merge-queue bot
pushed a commit
to databricks/cli
that referenced
this pull request
Nov 7, 2023
## Changes This PR removes validation for default value against the regex pattern specified in a JSON schema at schema load time. This is required because #795 introduces parameterising the default value as a Go text template impling that the default value now does not necessarily have to match the pattern at schema load time. This will also unblock: databricks/mlops-stacks#108 Note, this does not remove runtime validation for input parameters right before template initialization, which happens here: https://github.com/databricks/cli/blob/fb32e78c9b9fb000ce898b8a60b0b47920f487d3/libs/template/materialize.go#L76 ## Tests Changes to existing test.
arpitjasa-db
approved these changes
Nov 9, 2023
Contributor
arpitjasa-db
left a comment
There was a problem hiding this comment.
Approved with one minor ask, thanks @shreyas-goenka !
arpitjasa-db
approved these changes
Nov 9, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes
This PR moves regex validation checks to the template schema. This has the following advantages:
Note: We first need to get databricks/cli#912 in, and set / update the minimum CLI version for mlops-stacks before this PR can be merged.
Tests
Tested manually. Here are the cases:
Case project_name: ab
Case project_name: abcd/
Case staging URL: abc