-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Description
When using openapi2kong the service generation works unexpected.
For this sample OAS:
openapi: 3.0.0
info:
title: Todo Service API
version: 1.0.0
servers:
- url: https://api.example.com
paths:
/todos:
servers:
- url: https://api2.example.com
get:
summary: List all todos
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Todo'
post:
summary: Create a new todo
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title:
type: string
required:
- title
responses:
'201':
description: Todo created
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
/todos/{id}:
get:
servers:
- url: https://api2.example.com
summary: Get a specific todo
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: Successful response
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
put:
summary: Update a todo
parameters:
- name: id
in: path
required: true
schema:
type: string
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
title:
type: string
completed:
type: boolean
responses:
'200':
description: Todo updated
content:
application/json:
schema:
$ref: '#/components/schemas/Todo'
components:
schemas:
Todo:
type: object
properties:
id:
type: string
title:
type: string
completed:
type: boolean
required:
- id
- title
- completedWe generate 3 services:
_format_version: "3.0"
services:
- host: api.example.com
id: 3fb86042-1fa6-5888-a213-98f020bbe34f
name: todo-service-api
path: /
plugins: []
port: 443
protocol: https
routes:
- id: 3ba4d4cf-63bb-5500-9c11-f2570d193694
methods:
- PUT
name: todo-service-api_todos-id_put
paths:
- ~/todos/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
tags: []
- host: api2.example.com
id: e668713a-a4d9-5465-843d-29d0ec621fb6
name: todo-service-api_todos
path: /
plugins: []
port: 443
protocol: https
routes:
- id: 4d88b84d-6fc2-5301-8f28-4ce54f566f72
methods:
- GET
name: todo-service-api_todos_get
paths:
- ~/todos$
plugins: []
regex_priority: 200
strip_path: false
tags: []
- id: b4ceddce-3952-56f9-9902-b0f91c279b74
methods:
- POST
name: todo-service-api_todos_post
paths:
- ~/todos$
plugins: []
regex_priority: 200
strip_path: false
tags: []
tags: []
- host: api2.example.com
id: 188d9d80-4f32-5944-aaba-f8d981d9004f
name: todo-service-api_todos-id_get
path: /
plugins: []
port: 443
protocol: https
routes:
- id: e677a04e-2a37-51c1-809d-430de8d99c1d
methods:
- GET
name: todo-service-api_todos-id_get
paths:
- ~/todos/(?<id>[^#?/]+)$
plugins: []
regex_priority: 100
strip_path: false
tags: []
tags: []
upstreams: []
The expectation would be that all paths and operations that do not declare a servers field would use the doc level server and all that do declare a server are merged into the same service in the deck file. However it seems that for all server blocks below the doc level we are generating a service even if they already exist with the same url.
As of my discussion with @mheap we currently consider this being a bug, as there is no benefit in handling the services separately.
The deck version used is decK v1.54.0 (b46c2fd).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels