From c3e6631a475af7af43a672e5a456d8ea168afaa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tanguy=20=E2=A7=93=20Herrmann?= Date: Wed, 15 Oct 2025 17:17:11 +0200 Subject: [PATCH] wip: content-type for each registered codec --- route.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/route.go b/route.go index 7ad9ca1..fe50ea4 100644 --- a/route.go +++ b/route.go @@ -143,9 +143,11 @@ func (rt *EntityRoute[Ent, EP]) generateOperation() { WithDescription("Request body for " + tag) if bodySchema != nil { - // TODO add route options multiple encoding - content := openapi3.NewContentWithSchema(bodySchema.Value, []string{"application/json"}) + // TODO: add encoding types from registered codecs + content := openapi3.NewContentWithSchema(bodySchema.Value, []string{"application/json", "text/yaml"}) + content["application/json"].Schema.Ref = "#/components/schemas/" + tag + content["text/yaml"].Schema.Ref = "#/components/schemas/" + tag requestBody.WithContent(content) } @@ -175,6 +177,7 @@ func (rt *EntityRoute[Ent, EP]) generateOperation() { panic("could not find response schema: " + tag) } + // TODO: add encoding types from registered codecs content := openapi3.NewContentWithSchema(responseSchema.Value, []string{"application/json"}) content["application/json"].Schema.Ref = "#/components/schemas/" + tag response.WithContent(content)