Skip to content

Unnecessary Service is created when deck file openapi2kong is run. #1640

@mheap

Description

@mheap

When converting an OpenAPI Spec (OAS) that defines URLs within the paths section using deck file openapi2kong, a Service with host: localhost and no associated Routes is created in addition to the Services defined by the specified URLs.

openapi: 3.0.3
info:
  title: Multi-Service API
  version: 1.0.0

paths:
  /users:
    get:
      servers:
        - url: https://user-service.example.com
      responses:
        '200':

  /orders:
    post:
      servers:
        - url: https://order-service.example.com
      responses:
        '201':

The output after conversion is as follows.

_format_version: "3.0"
services:
- host: localhost
  id: eff78c7b-04db-5898-9e25-bd40f5cde525
  name: multi-service-api
  path: /
  plugins: []
  port: 443
  protocol: https
  routes: []
  tags: []
- host: order-service.example.com
  id: 8b6ad746-12b9-50fd-8604-5e7768c4f5e9
  name: multi-service-api_orders_post
  path: /
  plugins: []
  port: 443
  protocol: https
  routes:
  - id: e8d42325-3ee0-57b3-9883-5ea51618f4ac
    methods:
    - POST
    name: multi-service-api_orders_post
    paths:
    - ~/orders$
    plugins: []
    regex_priority: 200
    strip_path: false
    tags: []
  tags: []
- host: user-service.example.com
  id: 6e5e1d3b-894b-5ce8-b807-532df7b6d01d
  name: multi-service-api_users_get
  path: /
  plugins: []
  port: 443
  protocol: https
  routes:
  - id: 744254cb-7b0f-527d-a9e3-41998313e8fd
    methods:
    - GET
    name: multi-service-api_users_get
    paths:
    - ~/users$
    plugins: []
    regex_priority: 200
    strip_path: false
    tags: []
  tags: []
upstreams: []

Perhaps deck adds localhost for those who omit the url, but it is an unnecessary block in this use case.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions