From 76371e0dae79e423ced236a9cc81ef297fc46b10 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Jun 2024 01:34:00 +0000 Subject: [PATCH] Bump github.com/swaggest/openapi-go from 0.2.50 to 0.2.51 Bumps [github.com/swaggest/openapi-go](https://github.com/swaggest/openapi-go) from 0.2.50 to 0.2.51. - [Release notes](https://github.com/swaggest/openapi-go/releases) - [Commits](https://github.com/swaggest/openapi-go/compare/v0.2.50...v0.2.51) --- updated-dependencies: - dependency-name: github.com/swaggest/openapi-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- .../swaggest/openapi-go/internal/json_schema.go | 12 ++++++++++-- vendor/modules.txt | 2 +- 4 files changed, 14 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index ce83619e9..b88b8dc4c 100644 --- a/go.mod +++ b/go.mod @@ -48,7 +48,7 @@ require ( github.com/smartystreets/gunit v1.4.5 github.com/stretchr/testify v1.9.0 github.com/swaggest/jsonschema-go v0.3.70 - github.com/swaggest/openapi-go v0.2.50 + github.com/swaggest/openapi-go v0.2.51 github.com/zitadel/oidc/v2 v2.12.0 go.opentelemetry.io/contrib/instrumentation/github.com/gin-gonic/gin/otelgin v0.49.0 go.opentelemetry.io/contrib/propagators/jaeger v1.27.0 diff --git a/go.sum b/go.sum index ccd7b67e9..d62c0b6ca 100644 --- a/go.sum +++ b/go.sum @@ -379,8 +379,8 @@ github.com/swaggest/assertjson v1.9.0 h1:dKu0BfJkIxv/xe//mkCrK5yZbs79jL7OVf9Ija7 github.com/swaggest/assertjson v1.9.0/go.mod h1:b+ZKX2VRiUjxfUIal0HDN85W0nHPAYUbYH5WkkSsFsU= github.com/swaggest/jsonschema-go v0.3.70 h1:8Vx5nm5t/6DBFw2+WC0/Vp1ZVe9/4mpuA0tuAe0wwCI= github.com/swaggest/jsonschema-go v0.3.70/go.mod h1:7N43/CwdaWgPUDfYV70K7Qm79tRqe/al7gLSt9YeGIE= -github.com/swaggest/openapi-go v0.2.50 h1:5yQ7N/IhMK9bQSk2yFAEbB75DvoXzyEmji3Q2iS++is= -github.com/swaggest/openapi-go v0.2.50/go.mod h1:5R2TWYBz0U7P3vwIwN0ytwSxqONXZnbiAaa+DQ3Sq1k= +github.com/swaggest/openapi-go v0.2.51 h1:G8MGdLS4dLz9EZMQtp1aEX57FeiTGcn2utNyaSnwk8Y= +github.com/swaggest/openapi-go v0.2.51/go.mod h1:5R2TWYBz0U7P3vwIwN0ytwSxqONXZnbiAaa+DQ3Sq1k= github.com/swaggest/refl v1.3.0 h1:PEUWIku+ZznYfsoyheF97ypSduvMApYyGkYF3nabS0I= github.com/swaggest/refl v1.3.0/go.mod h1:3Ujvbmh1pfSbDYjC6JGG7nMgPvpG0ehQL4iNonnLNbg= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= diff --git a/vendor/github.com/swaggest/openapi-go/internal/json_schema.go b/vendor/github.com/swaggest/openapi-go/internal/json_schema.go index a7166c99b..f19d55f02 100644 --- a/vendor/github.com/swaggest/openapi-go/internal/json_schema.go +++ b/vendor/github.com/swaggest/openapi-go/internal/json_schema.go @@ -66,6 +66,14 @@ func ReflectRequestBody( hasTaggedFields = refl.HasTaggedFields(input, t) } + hasJSONSchemaStruct := false + + refl.WalkFieldsRecursively(reflect.ValueOf(input), func(v reflect.Value, _ reflect.StructField, _ []reflect.StructField) { + if v.Type() == reflect.TypeOf(jsonschema.Struct{}) { + hasJSONSchemaStruct = true + } + }) + // Form data can not have map or array as body. if !hasTaggedFields && len(mapping) == 0 && tag != tagJSON { return nil, false, nil @@ -74,7 +82,7 @@ func ReflectRequestBody( // If `formData` is defined on a request body `json` is ignored. if tag == tagJSON && (refl.HasTaggedFields(input, tagFormData) || refl.HasTaggedFields(input, tagForm)) && - !forceJSONRequestBody { + !forceJSONRequestBody && !hasJSONSchemaStruct { return nil, false, nil } @@ -89,7 +97,7 @@ func ReflectRequestBody( } // JSON can be a map or array without field tags. - if !hasTaggedFields && len(mapping) == 0 && !refl.IsSliceOrMap(input) && + if !hasTaggedFields && !hasJSONSchemaStruct && len(mapping) == 0 && !refl.IsSliceOrMap(input) && refl.FindEmbeddedSliceOrMap(input) == nil && !isProcessWithoutTags { return nil, false, nil } diff --git a/vendor/modules.txt b/vendor/modules.txt index db5b96beb..d72329025 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -422,7 +422,7 @@ github.com/stretchr/testify/require # github.com/swaggest/jsonschema-go v0.3.70 ## explicit; go 1.18 github.com/swaggest/jsonschema-go -# github.com/swaggest/openapi-go v0.2.50 +# github.com/swaggest/openapi-go v0.2.51 ## explicit; go 1.18 github.com/swaggest/openapi-go github.com/swaggest/openapi-go/internal