Skip to content

Migrate PackageAPI endpoints from @EndPoint/@Command to JAX-RS#4178

Open
epugh wants to merge 9 commits intoapache:mainfrom
epugh:copilot/migrate-packageapi-to-jax-rs
Open

Migrate PackageAPI endpoints from @EndPoint/@Command to JAX-RS#4178
epugh wants to merge 9 commits intoapache:mainfrom
epugh:copilot/migrate-packageapi-to-jax-rs

Conversation

@epugh
Copy link
Contributor

@epugh epugh commented Mar 2, 2026

Migrates org.apache.solr.pkg.PackageAPI from Solr's homegrown @EndPoint/@Command dispatch to standard JAX-RS annotations, consistent with other V2 APIs (ClusterFileStore, ZookeeperRead, ClusterProperty).

This has a pretty hefty update to the patterns, but I thought it was better to do it now while v2 api's are "experimental".

New REST endpoints

The command-based POST pattern is replaced with RESTful routes:

Old New
POST /cluster/package {"add": {"package":"p","version":"v","files":[...]}} POST /cluster/package/{name}/versions
POST /cluster/package {"delete": {"pkg":"p","version":"v"}} DELETE /cluster/package/{name}/versions/{version}
POST /cluster/package {"refresh": "name"} POST /cluster/package/{name}/refresh
GET /cluster/package unchanged
GET /cluster/package/{name} unchanged

Key structural changes

  • PackageAPI — new JAX-RS implementation (extends JerseyResource implements PackageApis); replaces the old Edit/Read inner classes (~220 lines removed)
  • PackageStore — renamed from the old PackageAPI; now clearly a ZK data/state holder (Packages, PkgVersion, ZK watcher), not an endpoint class. THIS WAS A BIG REFACTORING
  • solr/api module — new PackageApis.java (JAX-RS interface), PackagesResponse.java, AddPackageVersionRequestBody.java; OAS generation produces PackageApi SolrJ request classes automatically
  • PackageAPITest — integration test using SolrCloudTestCase (ZK required) with generated PackageApi SolrJ request classes
  • TestPackages — updated to use new endpoints; error path changed from /details[0]/errorMessages[0] to /msg
  • package-manager-internals.adoc — updated endpoint reference and curl examples

Copilot AI and others added 8 commits March 1, 2026 13:42
- Replace PackagePayload.AddVersion with AddPackageVersionRequestBody
- Move package name from body to URL: POST /cluster/package/{name}/versions
- Replace delete command pattern with DELETE /cluster/package/{name}/versions/{version}
- Replace refresh command with POST /cluster/package/{name}/refresh
- Update errPath in testAPI from /details[0]/errorMessages[0] to /msg
- Remove all add.pkg assignments (pkg now lives in URL path)
- Replace add.pkg references in verifyComponent() with literal package name strings
- Update import: remove PackagePayload, add AddPackageVersionRequestBody (sorted)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
…sponse.error field

Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
Co-authored-by: epugh <22395+epugh@users.noreply.github.com>
@epugh epugh marked this pull request as ready for review March 2, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants