Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #14814
Closed
Open
Issue created Feb 24, 2023 by Administrator@rootContributor

[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
Assignee
Assign to
Time tracking