mirror of https://github.com/databricks/cli.git
should pass gofmt now
This commit is contained in:
parent
9ec0c5ddcd
commit
3c5ee69941
|
@ -40,27 +40,25 @@ 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 -> {
|
|
||||||
* type: object
|
- map[string]MyStruct -> { 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 -> {type: array, items: {}}
|
||||||
- []MyStruct -> {
|
for details visit: https://json-schema.org/understanding-json-schema/reference/array.html#items
|
||||||
* type: array
|
|
||||||
* items: {}
|
- []MyStruct -> {type: object, properties: {}, 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/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) {
|
func NewSchema(golangType reflect.Type, docs *Docs) (*Schema, error) {
|
||||||
seenTypes := map[reflect.Type]struct{}{}
|
seenTypes := map[reflect.Type]struct{}{}
|
||||||
|
@ -183,6 +181,7 @@ 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.
|
||||||
|
|
Loading…
Reference in New Issue