AKIRA-MIYAKE / serverless-import-swagger

Import functions from OpenAPI spec file to serverless.yml

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multiple paths having the same operationId results in only one event source

Jaystified opened this issue · comments

For example:

paths:
  /aaa:
    get:
      operationId: fooBar
      responses:
        200:
          content:
            application/json:
              schema:
                type: object
  /bbb:
    get:
      operationId: fooBar
      responses:
        200:
          content:
            application/json:
              schema:
                type: object

Which results in:

  fooBar:
    handler: "handler.fooBar"
    events:
    - http:
        path: "/api/v1/bbb"
        method: "get"
        integration: "lambda-proxy"

One of the event sources becomes "lost".

This is not an issue of sis but an upstream issue in OpenAPI/Swagger.

Unfortunately, operationId can not be duplicated.

https://swagger.io/docs/specification/paths-and-operations/

operationId is an optional unique string used to identify an operation.
If provided, these IDs must be unique among all operations described in your API.

If we want attach serveral API paths (http event) to single Lambda, we should alias each paths like fooBar and fooBarAlias1 or alike.

So it is a spec issue, then.