diff --git a/bundle/schema/bundle_config_docs.yml b/bundle/schema/bundle_config_docs.yml new file mode 100644 index 00000000..eeb102fc --- /dev/null +++ b/bundle/schema/bundle_config_docs.yml @@ -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. \ No newline at end of file diff --git a/bundle/schema/schema.go b/bundle/schema/schema.go index 82ceea78..0cf7d526 100644 --- a/bundle/schema/schema.go +++ b/bundle/schema/schema.go @@ -7,10 +7,6 @@ import ( "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 type Schema struct { // Type of the object diff --git a/bundle/schema/schema_test.go b/bundle/schema/schema_test.go index 2d5922e4..684c8aad 100644 --- a/bundle/schema/schema_test.go +++ b/bundle/schema/schema_test.go @@ -10,8 +10,6 @@ import ( "github.com/stretchr/testify/require" ) -// TODO: Have a test that combines multiple different cases - func TestIntSchema(t *testing.T) { var elemInt int @@ -1190,20 +1188,20 @@ func TestInterfaceGeneratesEmptySchema(t *testing.T) { 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) { // 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) // jsonSchema, err := json.MarshalIndent(schema, " ", " ") // assert.NoError(t, err) -// expected := -// `` - // t.Log("[DEBUG] actual: ", string(jsonSchema)) -// t.Log("[DEBUG] expected: ", expected) -// assert.Equal(t, expected, string(jsonSchema)) +// assert.True(t, false) // }