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

Allow variable references in non-string fields in the JSON schema #1398

Merged
merged 2 commits into from
Apr 25, 2024

Conversation

shreyas-goenka
Copy link
Contributor

@shreyas-goenka shreyas-goenka commented Apr 24, 2024

Tests

Verified manually.

Before:
Screenshot 2024-04-24 at 7 18 44 PM

After:
Screenshot 2024-04-24 at 7 18 31 PM
Screenshot 2024-04-24 at 7 16 54 PM

Manually verified the schema diff is sane. Example:

<                               "type": "boolean",
<                               "description": "If inference tables are enabled or not. NOTE: If you have already disabled payload logging once, you cannot enable again."
---
>                               "description": "If inference tables are enabled or not. NOTE: If you have already disabled payload logging once, you cannot enable again.",
>                               "anyOf": [
>                                 {
>                                   "type": "boolean"
>                                 },
>                                 {
>                                   "type": "string",
>                                   "pattern": "\\$\\{([a-zA-Z]+([-_]?[a-zA-Z0-9]+)*(\\.[a-zA-Z]+([-_]?[a-zA-Z0-9]+)*)*)\\}"
>                                 }
>                               ]

@@ -14,7 +14,15 @@ func TestIntSchema(t *testing.T) {

expected :=
`{
"type": "number"
"anyOf": [
Copy link
Contributor Author

@shreyas-goenka shreyas-goenka Apr 24, 2024

Choose a reason for hiding this comment

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

The current approach is not ideal from a top down POV, and there is indeed room for refactoring out the "Go struct" -> "JSON Schema" transformation from bundle-specific transformations. That being said, I think this approach is fine given we don't anticipate a lot of changes to bundle schema generation, and it'll not be that hard to refactor if we need to in the future.

Copy link
Contributor

@pietern pietern left a comment

Choose a reason for hiding this comment

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

The asserts on the JSON serialized format are not ideal but can be addressed another time.

@shreyas-goenka shreyas-goenka added this pull request to the merge queue Apr 25, 2024
Merged via the queue into main with commit 6fd581d Apr 25, 2024
5 checks passed
@shreyas-goenka shreyas-goenka deleted the fix/var-squiggly branch April 25, 2024 11:28
pietern added a commit that referenced this pull request Apr 25, 2024
This is a bugfix release.

CLI:
 * Pass `DATABRICKS_CONFIG_FILE` for `auth profiles` ([#1394](#1394)).

Bundles:
 * Show a better error message for using wheel tasks with older DBR versions ([#1373](#1373)).
 * Allow variable references in non-string fields in the JSON schema ([#1398](#1398)).
 * Fix variable overrides in targets for non-string variables ([#1397](#1397)).
 * Fix bundle schema for variables ([#1396](#1396)).
 * Fix bundle documentation URL ([#1399](#1399)).

Internal:
 * Removed autogenerated docs for the CLI commands ([#1392](#1392)).
 * Remove `JSON.parse` call from homebrew-tap action ([#1393](#1393)).
 * Ensure that Python dependencies are installed during upgrade ([#1390](#1390)).
@pietern pietern mentioned this pull request Apr 25, 2024
github-merge-queue bot pushed a commit that referenced this pull request Apr 25, 2024
This is a bugfix release.

CLI:
* Pass `DATABRICKS_CONFIG_FILE` for `auth profiles`
([#1394](#1394)).

Bundles:
* Show a better error message for using wheel tasks with older DBR
versions ([#1373](#1373)).
* Allow variable references in non-string fields in the JSON schema
([#1398](#1398)).
* Fix variable overrides in targets for non-string variables
([#1397](#1397)).
* Fix bundle schema for variables
([#1396](#1396)).
* Fix bundle documentation URL
([#1399](#1399)).

Internal:
* Removed autogenerated docs for the CLI commands
([#1392](#1392)).
* Remove `JSON.parse` call from homebrew-tap action
([#1393](#1393)).
* Ensure that Python dependencies are installed during upgrade
([#1390](#1390)).
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