mirror of https://github.com/databricks/cli.git
added comment for what to do about cycles in json schema
This commit is contained in:
parent
7385f37df6
commit
2a66a2fc74
|
@ -7,12 +7,11 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const MaxHistoryOccurances = 3
|
// TODO: Add tests for the error cases, forcefully triggering them
|
||||||
|
// TODO: Add ignore for -
|
||||||
// TODO: add tests for the error cases, forcefully triggering them
|
// TODO: Add required validation for omitempty
|
||||||
// TODO: Add support for refs in case of a cycle
|
// TODO: Add example documentation
|
||||||
// TODO: handle case of self referential pointers in structs
|
// TODO: Do final checks for more validation that can be added to json schema
|
||||||
// TODO: add ignore for -
|
|
||||||
|
|
||||||
type Schema struct {
|
type Schema struct {
|
||||||
Type JavascriptType `json:"type"`
|
Type JavascriptType `json:"type"`
|
||||||
|
@ -32,6 +31,12 @@ type Item struct {
|
||||||
Properties map[string]*Property `json:"properties,omitempty"`
|
Properties map[string]*Property `json:"properties,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NOTE about loops in golangType: Right now we error out if there is a loop
|
||||||
|
// in the types traversed when generating the json schema. This can be solved
|
||||||
|
// using $refs but there is complexity around making sure we do not create json
|
||||||
|
// schema's where properties indirectly refer to each other, which would be an
|
||||||
|
// invalid json schema. See https://json-schema.org/understanding-json-schema/structuring.html#recursion
|
||||||
|
// for more details
|
||||||
func NewSchema(golangType reflect.Type) (*Schema, error) {
|
func NewSchema(golangType reflect.Type) (*Schema, error) {
|
||||||
seenTypes := map[reflect.Type]struct{}{}
|
seenTypes := map[reflect.Type]struct{}{}
|
||||||
debugTrace := list.New()
|
debugTrace := list.New()
|
||||||
|
|
Loading…
Reference in New Issue