Skip to content

Commit 19e0a20

Browse files
authored
Merge pull request #178 from SamMayWork/fix-swagger
fix: Schema Type for JSONAny to be an object
2 parents 862d2d7 + 4ef131e commit 19e0a20

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pkg/ffapi/openapi3.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,8 @@ func (sg *SwaggerGen) getPathItem(doc *openapi3.T, path string) *openapi3.PathIt
152152
func (sg *SwaggerGen) initInput(op *openapi3.Operation) {
153153
op.RequestBody = &openapi3.RequestBodyRef{
154154
Value: &openapi3.RequestBody{
155-
Content: openapi3.Content{},
155+
Required: true,
156+
Content: openapi3.Content{},
156157
},
157158
}
158159
}
@@ -225,7 +226,13 @@ func (sg *SwaggerGen) addCustomType(t reflect.Type, schema *openapi3.Schema) {
225226
case "FFBigInt":
226227
schema.Type = &openapi3.Types{openapi3.TypeString}
227228
case "JSONAny":
228-
schema.Type = &openapi3.Types{openapi3.TypeString}
229+
schema.Type = &openapi3.Types{openapi3.TypeObject}
230+
True := true
231+
schema.AdditionalProperties = openapi3.AdditionalProperties{Has: &True}
232+
}
233+
234+
if schema.Items != nil && schema.Items.Value != nil {
235+
schema.Items.Value.Nullable = false
229236
}
230237
}
231238

0 commit comments

Comments
 (0)