Commit Graph

7 Commits

Author SHA1 Message Date
shreyas-goenka 5df8935de4
Add JSON schema validation for input template parameters (#598)
## Changes

This PR:
1. Adds code for reading template configs and validating them against a
JSON schema.
2. Moves the json schema struct in `bundle/schema` to a separate library
package. This struct is now reused for validating template configs.

## Tests
Unit tests
2023-08-01 14:09:27 +00:00
shreyas-goenka fc8729d162
Only treat files with .tmpl extension as templates (#594)
## Changes
In a world before this PR, all files would be treated as `go text
templates`, making the content in these files quake in fear since they
would be executed (as a template).

This PR makes it so that only files with the `.tmpl` extension are
understood to be templates. This is useful for avoiding ambiguity in
cases like where a binary file could be interpreted as a go text
template otherwise.

In order to do so, we introduce the `copyFile` struct which does a copy
of the source file from the template without loading it into memory.

## Tests
Unit tests
2023-08-01 13:43:27 +00:00
shreyas-goenka ed972f7ae0
Add url parse helper function for templates (#600)
## Tests
unit test
2023-07-27 09:51:31 +00:00
shreyas-goenka 34f196bb4e
Add unit test that raw strings are printed as is (#599)
## Changes
Add unit test that raw strings are printed as is. This method is useful
to print text that would otherwise be interpreted a go text template.
2023-07-25 17:18:43 +02:00
shreyas-goenka 47640b8b94
Add regexp compile helper function for templates (#601)
## Tests
unit test
2023-07-25 16:42:53 +02:00
shreyas-goenka 13731e144c
Fix formatting in renderer.go (#593)
## Changes
Due to a bug in Github UI, https://github.com/databricks/cli/pull/589
got merged without passing the go/fmt formatting checks

This PR fixes the formatting which breaks the PR checks
2023-07-21 11:23:47 +02:00
shreyas-goenka 02dbac7b8a
Add template renderer for Databricks templates (#589)
## Changes
This PR adds the renderer struct, which is a walker that traverses
templates and generates projects from them

## Tests
Unit tests
2023-07-21 10:59:02 +02:00