EugeneYushin opened a new issue, #7861:
URL: https://github.com/apache/kyuubi/issues/7861

   ### Code of Conduct
   
   - [x] I agree to follow this project's [Code of 
Conduct](https://www.apache.org/foundation/policies/conduct)
   
   
   ### Search before asking
   
   - [x] I have searched in the 
[issues](https://github.com/apache/kyuubi/issues?q=is%3Aissue) and found no 
similar issues.
   
   
   ### Describe the bug
   
   ### Summary
   
   The OpenAPI document served by the Kyuubi server at `/api/openapi.json` and 
`/api/openapi.yaml` does not describe the response body correctly for a number 
of endpoints. This breaks client generation from the spec: generated clients 
get no response type, or a type that does not match what the server returns.
   
   Checked against `master` (`1.13.0-SNAPSHOT`), by fetching the spec from a 
locally built server.
   
   ### Affected endpoints
   
   #### Response schema is wrong
   
   | Endpoint | Spec says | Server actually returns |
   |---|---|---|
   | `POST /v1/sessions/{sessionHandle}/operations/statement` | 
`OperationHandle` = `{ hasResultSet: boolean (writeOnly) }`, with no 
`identifier` | `{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/typeInfo` | same as above | 
`{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/catalogs` | same as above | 
`{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/schemas` | same as above | 
`{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/tables` | same as above | 
`{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/tableTypes` | same as above 
| `{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/columns` | same as above | 
`{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/functions` | same as above | 
`{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/primaryKeys` | same as above 
| `{"identifier": "<uuid>"}` |
   | `POST /v1/sessions/{sessionHandle}/operations/crossReference` | same as 
above | `{"identifier": "<uuid>"}` |
   | `GET /v1/admin/server` | array of `OperationData` | `ServerData[]` |
   
   #### Response schema is missing (200 response has no `schema`)
   
   | Endpoint | Server returns |
   |---|---|
   | `POST /v1/sessions` | `{"identifier": "<uuid>", "kyuubiInstance": 
"<host:port>"}` (`SessionHandle`). The schema exists under `components.schemas` 
but no operation references it. |
   | `GET /v1/admin/engine` | list of `Engine` |
   | `GET /v1/version` | `VersionInfo` |
   | `DELETE /v1/admin/engine` | not described |
   | `DELETE /v1/admin/operations/{operationHandle}` | not described |
   | `DELETE /v1/admin/sessions/{sessionHandle}` | not described |
   | `DELETE /v1/sessions/{sessionHandle}` | not described |
   | `PUT /v1/operations/{operationHandle}` | not described |
   | `POST /v1/admin/refresh/hadoop_conf` | not described |
   | `POST /v1/admin/refresh/user_defaults_conf` | not described |
   | `POST /v1/admin/refresh/kubernetes_conf` | not described |
   | `POST /v1/admin/refresh/unlimited_users` | not described |
   | `POST /v1/admin/refresh/deny_users` | not described |
   | `POST /v1/admin/refresh/deny_ips` | not described |
   | `POST /v1/data-agent/{sessionHandle}/chat` | not described |
   | `POST /v1/data-agent/{sessionHandle}/approve` | not described |
   | `GET/DELETE /v1/statement/executing/{queryId}/{slug}/{token}` | not 
described |
   | `GET/DELETE /v1/statement/queued/{queryId}/{slug}/{token}` | not described 
|
   | `GET /v1/statement/test` | not described |
   
   ### How to reproduce
   
   1. Start a Kyuubi server with the REST frontend enabled (default port 10099).
   2. Fetch the spec:
      ```bash
      curl -s http://localhost:10099/api/openapi.json
      ```
   3. Inspect 
`paths["/v1/sessions"].post.responses["200"].content["application/json"]`. It 
is `{}`, with no `schema`.
   4. Inspect `components.schemas.OperationHandle`. Its only property is 
`hasResultSet` (`writeOnly: true`), and `identifier` is absent.
   5. Compare with a real call:
      ```bash
      # POST /api/v1/sessions
      {"identifier":"<uuid>","kyuubiInstance":"<host>:10099"}
      # POST /api/v1/sessions/{handle}/operations/statement
      {"identifier":"<uuid>"}
      ```
      The responses match the types in the REST API docs, but not the generated 
spec.
   
   ### Impact
   
   Clients generated from the OpenAPI spec (for example with 
`openapi-generator`) cannot read the session handle or operation handle from 
the responses. The spec cannot be used as the contract for external 
integrations such as SRE tooling or a Python client.
   
   ### Related
   
   - #2550 ("Kyuubi swagger does not show the request/response schema") is 
closed, but the gaps listed above remain on `master`.
   
   ### Affects Version(s)
   
   master
   
   ### Kyuubi Server Log Output
   
   ```logtalk
   
   ```
   
   ### Kyuubi Engine Log Output
   
   ```logtalk
   
   ```
   
   ### Kyuubi Server Configurations
   
   ```yaml
   
   ```
   
   ### Kyuubi Engine Configurations
   
   ```yaml
   
   ```
   
   ### Additional context
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [ ] Yes. I would be willing to submit a PR with guidance from the Kyuubi 
community to fix.
   - [ ] No. I cannot submit a PR at this time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [I] [Bug] openapi spec ... EugeneYushin (via GitHub) via notifications

Reply via email to