From 3c5ee699414e2a1ea2846cca7fc225ab95295ffb Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Thu, 19 Jan 2023 16:12:24 +0100 Subject: [PATCH] should pass gofmt now --- bundle/schema/schema.go | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/bundle/schema/schema.go b/bundle/schema/schema.go index 69c0fb748..aaf0868f3 100644 --- a/bundle/schema/schema.go +++ b/bundle/schema/schema.go @@ -40,27 +40,25 @@ 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 + + - 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{}{} @@ -183,6 +181,7 @@ 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.