mirror of https://github.com/databricks/cli.git
updated formatting on doc strings
This commit is contained in:
parent
d00cee4680
commit
e4935642ca
|
@ -36,40 +36,31 @@ type Schema struct {
|
||||||
Required []string `json:"required,omitempty"`
|
Required []string `json:"required,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// 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
|
||||||
|
// Javascript Primitives:
|
||||||
- GolangType -> Javascript type / Json Schema2
|
// - bool -> boolean
|
||||||
|
// - string -> string
|
||||||
Javascript Primitives:
|
// - int (all variants) -> number
|
||||||
- bool -> boolean
|
// - float (all variants) -> number
|
||||||
- string -> string
|
// Json Schema2 Fields:
|
||||||
- int (all variants) -> number
|
// - map[string]MyStruct -> {
|
||||||
- float (all variants) -> number
|
// type: object
|
||||||
|
// additionalProperties: {}
|
||||||
Json Schema2 Fields:
|
// }
|
||||||
- map[string]MyStruct -> {
|
// for details visit: https://json-schema.org/understanding-json-schema/reference/object.html#additional-properties
|
||||||
type: object
|
// - []MyStruct -> {
|
||||||
additionalProperties: {}
|
// type: array
|
||||||
}
|
// items: {}
|
||||||
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/array.html#items
|
||||||
- []MyStruct -> {
|
// - []MyStruct -> {
|
||||||
type: array
|
// type: object
|
||||||
items: {}
|
// properties: {}
|
||||||
}
|
// additionalProperties: false
|
||||||
|
// }
|
||||||
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/object.html#properties
|
||||||
|
|
||||||
|
|
||||||
- []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) {
|
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()
|
||||||
|
@ -160,9 +151,9 @@ func safeToSchema(golangType reflect.Type, docs *Docs, debugTraceId string, seen
|
||||||
|
|
||||||
// Adds the member fields of golangType to the passed slice. Needed because
|
// Adds the member fields of golangType to the passed slice. Needed because
|
||||||
// golangType can contain embedded fields (aka anonymous)
|
// golangType can contain embedded fields (aka anonymous)
|
||||||
//
|
|
||||||
// The function traverses the embedded fields in a breadth first manner
|
// The function traverses the embedded fields in a breadth first manner
|
||||||
//
|
|
||||||
// params:
|
// params:
|
||||||
// fields: slice to which member fields of golangType will be added to
|
// fields: slice to which member fields of golangType will be added to
|
||||||
func getStructFields(golangType reflect.Type) []reflect.StructField {
|
func getStructFields(golangType reflect.Type) []reflect.StructField {
|
||||||
|
|
Loading…
Reference in New Issue