Schema naming in openapi.json #123
-
It is possible to force operation names with Is there any way to force struct name in |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Not sure if I properly understand the question, but if you want to apply changes to OpanAPI operation, that is created from usecase, you can use annotation on s.Get("/foo", fooUsecase(), func(h *nethttp.Handler) {
h.OperationAnnotations = append(h.OperationAnnotations, func(op *openapi3.Operation) error {
op.WithID("foo")
return nil
})
}) |
Beta Was this translation helpful? Give feedback.
-
My question is about go structs (openapi schemas) not go functions (openapi operations). For example go struct
becomes Question is about changing schema name not title in
|
Beta Was this translation helpful? Give feedback.
-
This customization can be done with s.OpenAPICollector.Reflector().InterceptDefName(func(t reflect.Type, defaultDefName string) string {
return strings.ReplaceAll(defaultDefName, "Items", "")
}) |
Beta Was this translation helpful? Give feedback.
This customization can be done with
InterceptDefName
hook.