-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move bundle schema update to an internal module (#1012)
## Changes This PR: 1. Move code to load bundle JSON Schema descriptions from the OpenAPI spec to an internal Go module 2. Remove command line flags from the `bundle schema` command. These flags were meant for internal processes and at no point were meant for customer use. 3. Regenerate `bundle_descriptions.json` 4. Add support for `bundle: "deprecated"`. The `environments` field is tagged as deprecated in this PR and consequently will no longer be a part of the bundle schema. ## Tests Tested by regenerating the CLI against its current OpenAPI spec (as defined in `__openapi_sha`). The `bundle_descriptions.json` in this PR was generated from the code generator. Manually checked that the autocompletion / descriptions from the new bundle schema are correct.
- Loading branch information
1 parent
a6752a5
commit 6002f49
Showing
9 changed files
with
3,992 additions
and
3,158 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package main | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"log" | ||
"os" | ||
|
||
"github.com/databricks/cli/bundle/schema" | ||
) | ||
|
||
func main() { | ||
if len(os.Args) != 2 { | ||
fmt.Println("Usage: go run main.go <output-file>") | ||
os.Exit(1) | ||
} | ||
|
||
// Output file, to write the generated schema descriptions to. | ||
outputFile := os.Args[1] | ||
|
||
// Input file, the databricks openapi spec. | ||
inputFile := os.Getenv("DATABRICKS_OPENAPI_SPEC") | ||
if inputFile == "" { | ||
log.Fatal("DATABRICKS_OPENAPI_SPEC environment variable not set") | ||
} | ||
|
||
// Generate the schema descriptions. | ||
docs, err := schema.UpdateBundleDescriptions(inputFile) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
result, err := json.MarshalIndent(docs, "", " ") | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
|
||
// Write the schema descriptions to the output file. | ||
err = os.WriteFile(outputFile, result, 0644) | ||
if err != nil { | ||
log.Fatal(err) | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.