mirror of https://github.com/databricks/cli.git
this should take care of fmt issues
This commit is contained in:
parent
761186680f
commit
2ca648718a
|
@ -39,27 +39,27 @@ type Schema struct {
|
|||
|
||||
// This function translates golang types into json schema. Here is the mapping
|
||||
// between json schema types and golang types
|
||||
// - GolangType -> Javascript type / Json Schema2
|
||||
// - bool -> boolean
|
||||
// - string -> string
|
||||
// - int (all variants) -> number
|
||||
// - float (all variants) -> number
|
||||
// - map[string]MyStruct -> {
|
||||
// type: object
|
||||
// additionalProperties: {}
|
||||
// }
|
||||
// for details visit: https://json-schema.org/understanding-json-schema/reference/object.html#additional-properties
|
||||
// - []MyStruct -> {
|
||||
// type: array
|
||||
// items: {}
|
||||
// }
|
||||
// for details visit: https://json-schema.org/understanding-json-schema/reference/array.html#items
|
||||
// - []MyStruct -> {
|
||||
// type: object
|
||||
// properties: {}
|
||||
// additionalProperties: false
|
||||
// }
|
||||
// for details visit: https://json-schema.org/understanding-json-schema/reference/object.html#properties
|
||||
// - GolangType -> Javascript type / Json Schema2
|
||||
// - bool -> boolean
|
||||
// - string -> string
|
||||
// - int (all variants) -> number
|
||||
// - float (all variants) -> number
|
||||
// - map[string]MyStruct -> {
|
||||
// type: object
|
||||
// additionalProperties: {}
|
||||
// }
|
||||
// for details visit: https://json-schema.org/understanding-json-schema/reference/object.html#additional-properties
|
||||
// - []MyStruct -> {
|
||||
// type: array
|
||||
// items: {}
|
||||
// }
|
||||
// for details visit: https://json-schema.org/understanding-json-schema/reference/array.html#items
|
||||
// - []MyStruct -> {
|
||||
// type: object
|
||||
// properties: {}
|
||||
// additionalProperties: false
|
||||
// }
|
||||
// for details visit: https://json-schema.org/understanding-json-schema/reference/object.html#properties
|
||||
func NewSchema(golangType reflect.Type, docs *Docs) (*Schema, error) {
|
||||
seenTypes := map[reflect.Type]struct{}{}
|
||||
debugTrace := list.New()
|
||||
|
@ -181,12 +181,12 @@ func getStructFields(golangType reflect.Type) []reflect.StructField {
|
|||
}
|
||||
|
||||
// params:
|
||||
// golangType: golang type for which json schema properties to generate
|
||||
// docs: Struct containing documentation to be injected into the json schema generated
|
||||
// seenTypes : set of golang types already seen in path during recursion.
|
||||
// Used to identify cycles.
|
||||
// debugTrace: linked list of golang types encounted. In case of errors this
|
||||
// helps log where the error originated from
|
||||
// golangType: golang type for which json schema properties to generate
|
||||
// docs: Struct containing documentation to be injected into the json schema generated
|
||||
// seenTypes : set of golang types already seen in path during recursion.
|
||||
// Used to identify cycles.
|
||||
// debugTrace: linked list of golang types encounted. In case of errors this
|
||||
// helps log where the error originated from
|
||||
func toSchema(golangType reflect.Type, docs *Docs, seenTypes map[reflect.Type]struct{}, debugTrace *list.List) (*Schema, error) {
|
||||
// *Struct and Struct generate identical json schemas
|
||||
if golangType.Kind() == reflect.Pointer {
|
||||
|
|
2
go.mod
2
go.mod
|
@ -57,6 +57,6 @@ require (
|
|||
google.golang.org/genproto v0.0.0-20221206210731-b1a01be3a5f6 // indirect
|
||||
google.golang.org/grpc v1.51.0 // indirect
|
||||
google.golang.org/protobuf v1.28.1 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||
gopkg.in/yaml.v2 v2.4.0
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue