From 2ca648718adc9abeba048efc2460abb41e9a076b Mon Sep 17 00:00:00 2001 From: Shreyas Goenka Date: Thu, 19 Jan 2023 15:33:32 +0100 Subject: [PATCH] this should take care of fmt issues --- bundle/schema/schema.go | 54 ++++++++++++++++++++--------------------- go.mod | 2 +- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/bundle/schema/schema.go b/bundle/schema/schema.go index f0ef2fd7..710eaf0d 100644 --- a/bundle/schema/schema.go +++ b/bundle/schema/schema.go @@ -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 { diff --git a/go.mod b/go.mod index d3d17e82..5924117b 100644 --- a/go.mod +++ b/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 )