epugh opened a new pull request, #4154:
URL: https://github.com/apache/solr/pull/4154

   Replaces legacy V1 admin API calls (`CollectionAdminRequest`, 
`CoreAdminRequest`) in the `bin/solr` CLI tools with generated V2 OpenAPI SolrJ 
classes. Also adds a new proper SolrJ V2 endpoint for `GET /cluster/nodes` that 
was previously missing, eliminating the need for a `GenericV2SolrRequest` 
workaround.
   
   I used Copilot for this, and here is the agent chat: 
https://github.com/epugh/solr/tasks/3c2f15c6-c0c7-4e39-b6b6-1cd51f8e7aa4
   
   
   ## Migrated calls
   
   | Class | Method | Before → After |
   |---|---|---|
   | `CLIUtils` | `safeCheckCollectionExists` | `CollectionAdminRequest.List` → 
`CollectionsApi.ListCollections` |
   | `CreateTool` | `createCore` | `CoreAdminRequest.createCore` → 
`CoresApi.CreateCore` |
   | `CreateTool` | `createCollection` | 
`CollectionAdminRequest.createCollection` → `CollectionsApi.CreateCollection` |
   | `DeleteTool` | `deleteCollection` | 
`CollectionAdminRequest.deleteCollection` → `CollectionsApi.DeleteCollection` |
   | `DeleteTool` | `deleteCore` | `CoreAdminRequest.Unload` → 
`CoresApi.UnloadCore` |
   | `StatusTool` | `getCloudStatus` | `CollectionAdminRequest.ClusterStatus` → 
`ClusterApi.ListClusterNodes` + `CollectionsApi.ListCollections` |
   
   ## Verbose output restored via Jackson
   
   The old V1 code serialized `NamedList` responses with noggit's `JSONWriter`. 
V2 response POJOs are Jackson-annotated, so verbose output now uses 
`JacksonContentWriter.DEFAULT_MAPPER.writerWithDefaultPrettyPrinter()` — 
actually cleaner output since the responses are already proper JSON objects:
   
   ```java
   // CreateTool, DeleteTool — after req.process():
   if (isVerbose() && response != null) {
     echo(JacksonContentWriter.DEFAULT_MAPPER
         .writerWithDefaultPrettyPrinter()
         .writeValueAsString(response));
   }
   ```
   
   ## New `GET /cluster/nodes` V2 API (SolrJ support)
   
   `StatusTool` previously fell back to `GenericV2SolrRequest` because SolrJ 
had no typed class for this endpoint. The full API pipeline was wired up:
   
   - **`ListClusterNodesResponse`** — new model with `Set<String> nodes`
   - **`ListClusterNodesApi`** — new endpoint interface at 
`@Path("/cluster/nodes")`
   - **`ListClusterNodes`** — new Jersey implementation registered in 
`CollectionsHandler`
   - **`ClusterApi.ListClusterNodes`** — generated SolrJ request class 
(replaces `GenericV2SolrRequest`)
   
   ```java
   // Before
   NamedList<Object> resp = solrClient.request(
       new GenericV2SolrRequest(SolrRequest.METHOD.GET, "/cluster/nodes", 
SolrRequestType.ADMIN));
   var liveNodes = (Collection<?>) resp.get("nodes");
   
   // After
   var resp = new ClusterApi.ListClusterNodes().process(solrClient);
   var liveNodes = resp.nodes; // Set<String>
   ```
   
   ## Not migrated
   
   Snapshot tools (`SnapshotCreateTool`, `SnapshotDeleteTool`, etc.) are 
intentionally excluded as candidates for removal.
   
   In fact, we may just remove them...?
   
   # Tests
   
   Existing tests + bats tests all pass.


-- 
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]

Reply via email to