Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors the database “endpoints” surface to improve naming clarity and address the mismatch between “client-usable” URLs vs Data API URLs (Issue #294), including renaming the api endpoint/command concept to client and adding a distinct curl endpoint type for /api/v1/json.
Changes:
- Renames the
apiendpoint/command toclientand updates snapshots/tests accordingly. - Introduces a new
CURLendpoint type and updates the endpoints list output to showclient+curlinstead ofapi+data-api. - Centralizes base URL computation via
Endpoint.apiBaseUrl(...)and updates legacy endpoint wiring.
Reviewed changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/Endpoint.java |
Renames/reshapes endpoint types (CLIENT, CURL) and centralizes base URL logic. |
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsCmd.java |
Swaps EndpointsApiCmd for EndpointsClientCmd in subcommand registration. |
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsClientCmd.java |
Adds new client subcommand returning the “client” base URL. |
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsDataApiCmd.java |
Re-points data-api subcommand to use the new CURL endpoint type. |
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/legacy/EndpointApiCmd.java |
Updates legacy command to use Endpoint.CLIENT. |
src/test/java/com/dtsx/astra/cli/snapshot/commands/db/endpoints/EndpointsClientCmdSnapshotTest.java |
Renames snapshot test to validate the new client subcommand. |
src/test/resources/snapshots/_db/_endpoints/** |
Updates snapshots for list/client outputs to reflect new endpoint naming and ordering. |
Comments suppressed due to low confidence (1)
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsCmd.java:16
- The
endpointscommand registersEndpointsDataApiCmdbut there is no subcommand namedcurl, even thoughEndpointnow includesCURLandendpoints listdisplays it ascurl. If the intent is to introduce acurlendpoint (per PR description and snapshots), add a dedicatedcurlsubcommand (or renameEndpointsDataApiCmdtocurland keepdata-apias an alias) so the listed endpoint name matches an actual command users can run.
@Command(
name = "endpoints",
description = "Get various endpoints for your database",
subcommands = {
EndpointsListCmd.class,
EndpointsClientCmd.class,
EndpointsDataApiCmd.class,
EndpointsSwaggerCmd.class,
EndpointsPlaygroundCmd.class,
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/main/java/com/dtsx/astra/cli/commands/db/endpoints/EndpointsDataApiCmd.java
Show resolved
Hide resolved
|
I don't mind having a specific endpoint for curl data api but I wouldn't call it "client" and "curl", I'd just leave it as "api" and add "data-api" so it's both backwards and forwards compatable if we really want we can add "data-api-client" as an alias to "api" though |
Fixes #294
This pull request refactors the database API endpoint commands and their naming to improve clarity and consistency. The primary change is the renaming of the
apiendpoint and command toclient, with additional adjustments to endpoint types, command classes, and test snapshots to match the new naming convention. It also introduces a newcurlendpoint and cleans up some internal logic.Key changes include:
Endpoint and Command Refactoring:
APIendpoint toCLIENTin theEndpointenum, updated its logic, and replaced all uses ofapiwithclientthroughout the codebase. TheEndpointsApiCmdclass was removed and replaced byEndpointsClientCmd. [1] [2] [3] [4]EndpointApiCmdto use the newCLIENTendpoint instead ofAPI.Endpoint List and Output Updates:
clientandcurlendpoints instead ofapianddata-api, and updated the corresponding test snapshots in CSV, JSON, and human-readable formats. [1] [2] [3] [4] [5]Internal Logic Improvements:
apiBaseUrlto centralize the logic for determining the API base URL in theEndpointenum.EndpointsDataApiCmdto use the newCURLendpoint type.Test and Snapshot Updates:
ApitoClientto match the new endpoint naming, and updated the test commands accordingly. [1] [2] [3] [4] [5] [6]These changes improve the clarity of endpoint naming and ensure consistency across commands, code, and documentation.