3

Is there a way to use tags (or another method) to generate interfaces in Go using oapi-codegen? I've tried:

paths:
  /foobar:
    post:
      tags:
        - FooInterface
      operationId: createFoo
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Foo'
      responses:
        201:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Foo'

Also:

tags:
  - name: foo
    description: Operations about foo
    x-oapi-codegen-server-interface-tag: FooInterface
  - name: bar
    description: Operations about bar
    x-oapi-codegen-server-interface-tag: BarInterface

but without any luck. Instead oapi-codgen generates a single "ServerInterface", necessitating implementation of a single controller.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.