Skip to content

openapi2kong generates duplicate plugin IDs when Content-Type header uses enum with multiple values #1856

@pexa-alao

Description

@pexa-alao

The openapi2kong command generates duplicate plugin IDs when a Content-Type header parameter is defined as an enum with multiple
values in an OpenAPI 3.0 specification. This results in invalid Kong configuration that fails validation with the error:
entity already exists.

Oas file:

openapi: 3.0.3
info:
  version: v1
  title: Example API
paths:
  /api/v1/example:
    post:
      operationId: exampleOperation
      x-kong-plugin-rate-limiting-advanced:
        enabled: true
        config:
          limit: [500]
      parameters:
        - name: Content-Type
          in: header
          required: true
          schema:
            type: string
            enum:
              - application/xml
              - text/xml

Generate Kong configuration:
deck file openapi2kong --spec ./oas.yaml --output-file deck.yaml

Validate the generated configuration:
deck file validate deck.yaml

oas-minimal.yaml

deck.yaml

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions