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