[Question] Swagger UI fails to load API definition: Bad Request for /openapi.json
Problem Type (问题类型)
other exception / error (其他异常报错)
Before submit
- [x] 我已经确认现有的 Issues 与 FAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)
Environment (环境信息)
- Server Version: 1.5.0 (Apache Release Version)
- Backend: MySQL
- OS: Ubuntu
Your Question (问题描述)
Vertex/Edge example (问题点 / 边数据举例)
Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
Hi @LYD031106! I'm Dosu and I’m helping the incubator-hugegraph team.
The 400 Bad Request error when loading /openapi.json in HugeGraph 1.5.0 is usually caused by a misconfiguration or validation failure in the API server. The endpoint is served by the OpenAPI resource, and errors can occur if the request is malformed, the HTTP method is incorrect, or the OpenAPI resource initialization fails due to configuration issues—especially with parameters like restserver.openapi.resource_packages that control which APIs are included in the spec. Exception handling in HugeGraph will return a 400 error if an IllegalArgumentException or HugeException is thrown during request processing, with details in the server logs and the JSON error response [source].
To troubleshoot: check your rest-server.properties for correct OpenAPI/Swagger configuration, especially the resource package setting; review server logs for error details when the 400 occurs; and try accessing /openapi.json directly to see the full error response. Issues with servlet registration, resource scanning, or missing annotations in your API code can also cause this error. No recent code changes or documentation updates address this issue specifically.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
It seems there is no problem
The current server in use is an Alibaba Cloud server with 2 CPU cores and 2 GB of memory. Log observations indicate that a significant amount of GC was triggered during access to Swagger, which is likely the main reason for the access failures. The issue has been resolved after upgrading to a server with larger memory for deployment, and normal access has been restored.