apidaora icon indicating copy to clipboard operation
apidaora copied to clipboard

Generate app from openapi spec

Open dutradda opened this issue 5 years ago • 0 comments

Uses an openapi file to create the asgi app, looking like this:

from apidaora import appdaora_spec


async def my_operation(user_name):
    return 'Hello World!'


app = appdaora_spec('myapi.yaml', {'my_operation': my_operation}, modulefile=__file__)

The openapi specification will look like this:

paths:
  /hello:
    summary: Performs hello operations
    post:
      operationId: my_operation
      parameters:
         - name: user_name
           in: query
           schema: str
      responses:
        '204':
          description: Creates hello message
          content:
            application/json:
              schema: string

Acceptance Criterias:

  • Must inferes for missing returing types/codes.
  • Must raises error for missing parameters or for parameters not described on openapi spec.
  • Must raises error for incompatibility between operation annotations and openapi spec.

dutradda avatar Sep 26 '19 01:09 dutradda