[REQ] [GO] Support yaml endpoints
Created by: mathnogueira
Is your feature request related to a problem? Please describe.
My API has two kinds of endpoints, most of them use application/json
but a few rely on text/x-yaml
. As it is today, we are forced to override the generated code in order to decode the request and encode the response properly for a YAML endpoint. It would be extremely helpful if the generator could generate code that supports encoding/decoding YAML.
Describe the solution you'd like
Be able to define an endpoint that accepts text/x-yaml
and the go-server generator can generate an endpoint implementation capable of encoding/decoding YAML.
Describe alternatives you've considered
So far we could only achieve this by replacing the handler function for each YAML route, but this is not a good approach, it would be nice to have it out of the box.
Example of what we are doing:
routes[c.getRouteIndex("GetRunResultJUnit")].HandlerFunc = c.GetRunResultJUnit
routes[c.getRouteIndex("GetTestVersionDefinitionFile")].HandlerFunc = c.GetTestVersionDefinitionFile
Additional context
Example of endpoint:
/test.yaml:
put:
tags:
- definition
summary: Update a test using its definition
operationId: updateTestDefinition
requestBody:
content:
text/x-yaml:
schema:
type: object
properties:
id:
type: string
name:
type: string
# rest of the properties
responses:
200:
description: Test updated successfully