PR is almost done, three things to go, 1. A nice big test, 2. Some cleanup and self review, 3. Address reviews from first round

This commit is contained in:
Shreyas Goenka 2023-01-18 17:16:59 +01:00
parent 9e13a62b00
commit 35d9829b7b
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
3 changed files with 19 additions and 13 deletions

View File

@ -0,0 +1,12 @@
documentation: Root of the bundle config
children:
bundle:
documentation: |
Bundle contains details about this bundle, such as its name,
version of the spec (TODO), default cluster, default warehouse, etc.
children:
environment:
documentation: Environment is set by the mutator that selects the environment.
artifacts:
documentation: Artifacts contains a description of all code artifacts in this bundle.

View File

@ -7,10 +7,6 @@ import (
"strings" "strings"
) )
// TODO: Add example documentation
// TODO: Do final checks for more validation that can be added to json schema
// TODO: cleanup docs and reorder code if needed
// defines schema for a json object // defines schema for a json object
type Schema struct { type Schema struct {
// Type of the object // Type of the object

View File

@ -10,8 +10,6 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
// TODO: Have a test that combines multiple different cases
func TestIntSchema(t *testing.T) { func TestIntSchema(t *testing.T) {
var elemInt int var elemInt int
@ -1190,20 +1188,20 @@ func TestInterfaceGeneratesEmptySchema(t *testing.T) {
assert.Equal(t, expected, string(jsonSchema)) assert.Equal(t, expected, string(jsonSchema))
} }
// // Only for testing bundle, will be removed // A toy test to generate the schema for bundle. Will be removed once we have a
// command to generate the json schema
// func TestBundleSchema(t *testing.T) { // func TestBundleSchema(t *testing.T) {
// elem := config.Root{} // elem := config.Root{}
// schema, err := NewSchema(reflect.TypeOf(elem)) // docs, err := LoadDocs("./bundle_config_docs.yml")
// require.NoError(t, err)
// schema, err := NewSchema(reflect.TypeOf(elem), docs)
// assert.NoError(t, err) // assert.NoError(t, err)
// jsonSchema, err := json.MarshalIndent(schema, " ", " ") // jsonSchema, err := json.MarshalIndent(schema, " ", " ")
// assert.NoError(t, err) // assert.NoError(t, err)
// expected :=
// ``
// t.Log("[DEBUG] actual: ", string(jsonSchema)) // t.Log("[DEBUG] actual: ", string(jsonSchema))
// t.Log("[DEBUG] expected: ", expected) // assert.True(t, false)
// assert.Equal(t, expected, string(jsonSchema))
// } // }