Skip to content

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

Merged
shreyas-goenka merged 2 commits into
mainfrom
fix/var-squiggly
Apr 25, 2024
Merged

Allow variable references in non-string fields in the JSON schema#1398
shreyas-goenka merged 2 commits into
mainfrom
fix/var-squiggly

Conversation

@shreyas-goenka

@shreyas-goenkashreyas-goenka commented Apr 24, 2024

Copy link
Copy Markdown
Contributor

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]+)*)*)\\}"
> }
> ]

expected :=
`{
"type": "number"
"anyOf": [

@shreyas-goenkashreyas-goenkaApr 24, 2024

Copy link
Copy Markdown
ContributorAuthor

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.

@pieternpietern left a comment

Copy link
Copy Markdown
Contributor

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 queueApr 25, 2024
Merged via the queue into main with commit 6fd581dApr 25, 2024
@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)).
@pieternpietern mentioned this pull request Apr 25, 2024
github-merge-queueBot 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)).
denik pushed a commit that referenced this pull request May 20, 2026
)
## Tests
Verified manually.
Before:
<img width="373" alt="Screenshot 2024-04-24 at 7 18 44 PM"
src="https://github.com/databricks/cli/assets/88374338/b4aef51f-0c16-4589-9d47-cdec9ab91158">
After:
<img width="364" alt="Screenshot 2024-04-24 at 7 18 31 PM"
src="https://github.com/databricks/cli/assets/88374338/3d8e412e-77ee-4641-943d-f99eab26ba02">
<img width="356" alt="Screenshot 2024-04-24 at 7 16 54 PM"
src="https://github.com/databricks/cli/assets/88374338/2aed369a-3c6a-4754-9c76-0969423f319e">
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]+)*)*)\\}"
> }
> ]
```
denik pushed a commit that referenced this pull request May 20, 2026
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 freeto 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.

2 participants

@shreyas-goenka@pietern