Nswag Generate a C# Interface from openapi yaml

39 Views Asked by At

Given the following example OpenAPI spec YAML, how can I ensure that that the Greeting component is generated as a C# interface, instead of a class, when using NSwag.MSBuild version 13.15.10 ?

I have tried both x-implements: ['com.example.ICustomInterface'] and x-interface: true but neither work. Can not find any documentation.

openapi: 3.0.0
info:
  title: Simple API
  version: 1.0.0
paths:
  /hello:
    get:
      summary: Get a greeting
      responses:
        '200':
          description: A successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    description: A greeting message
                    example: Hello, World!
components:
  schemas:
    Greeting:
      type: object
      properties:
        message:
          type: string
          description: A greeting message
0

There are 0 best solutions below