cloudflare / cloudflare/chanfana

API displayed a correct path but executed with the wrong endpoint in Swagger UI

Open
#256 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
766
Forks
70
Avg merge
25m
Merged PRs (30d)
4

Description

![Image](https://github.com/user-attachments/assets/2ef95726-d8c4-4edc-a7c6-4940602131ab)

As shown in image, I executed the /config API, but it called /plaza/chat API instead.

I expected it to call /config API.

chanfana version: 2.8.0
swagger-ui version: 5.17.14 (also I tried 5.0.0 and 5.20.2 which don't work too)

openapi.json

{
"openapi": "3.1.0",
"info": {
"title": "xFly Studio API Cloudflare",
"version": "1.0.0"
},
"components": {
"schemas": {},
"parameters": {}
},
"paths": {
"/auth/login": {
"post": {
"tags": [
"auth"
],
"description": "登入",
"operationId": "post_route",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"provider": {
"type": "string"
},
"email": {
"type": "string",
"format": "email"
},
"password": {
"type": "string"
},
"providerPayload": {
"type": "object",
"properties": {}
}
}
}
}
}
},
"responses": {
"200": {
"description": "成功登入",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"new_user": {
"type": "boolean"
},
"access_token": {
"type": "string"
},
"refresh_token": {
"type": "string"
}
},
"required": [
"access_token",
"refresh_token"
]
}
}
}
}
}
}
},
"/plaza/chat": {
"get": {
"tags": [
"plaza"
],
"description": "取得聊天歷史",
"operationId": "get_route",
"parameters": [
{
"schema": {
"type": "number",
"description": "訊息取得開始時間,作為後續更新訊息用"
},
"required": false,
"description": "訊息取得開始時間,作為後續更新訊息用",
"name": "from_time",
"in": "query"
}
],
"responses": {
"200": {
"description": "取得聊天歷史",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"messages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"text": {
"type": "string"
},
"createAt": {
"type": "string"
},
"createBy": {
"type": "string"
}
},
"required": [
"type",
"text",
"createAt"
]
}
}
},
"required": [
"messages"
]
}
}
}
}
}
}
},
"/config": {
"get": {
"tags": [
"config"
],
"description": "取得Config",
"operationId": "get_route",
"responses": {
"200": {
"description": "取得Config",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"createdAt": {
"type": "string",
"format": "date-time"
}
},
"required": [
"id",
"createdAt"
]
}
}
}
}
}
}
}
},
"webhooks": {}
}

Contributor guide

Open the contributing guide

Research direction

Start with the supplied openapi.json and reproduce the issue in Swagger UI 5.17.14 using the /config GET operation. Compare the request generated for /config with the request sent to /plaza/chat, then trace how chanfana 2.8.0 generates the operation metadata; done means executing /config calls /config rather than /plaza/chat.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.