janhoy opened a new pull request, #4942: URL: https://github.com/apache/solr/pull/4942
# Description
Three "V2 API" examples in the Schema API ref guide don't work as printed. I
hit this trying to edit schema fields over v2.
1. **Both copy-field V2 tabs point at a GET-only endpoint.** They POST a
v1 keyed-object body to /api/collections/techproducts/schema`, which only
carries `@GET`, so it answers `405` with `Allow:
GET,OPTIONS` and an empty body — no hint that `/schema/bulk` is one
segment away.
2. **The one correct bulk example is invalid JSON** — missing comma after
each `"operationType"`.
3. **That same snippet uses the v1 prefix** `/solr/<coll>/schema/bulk`,
which doesn't resolve the JAX-RS resource; it falls through to managed-resource
handling under the v1 `SchemaHandler`: `400
"Expected Map to create a new ManagedResource but received a
java.util.ArrayList"`.
# Solution
Both copy-field tabs now use `POST /api/collections/<coll>/schema/bulk` with
the `operationType`-discriminated list form; the bulk example gets its commas
and the `/api/...` prefix. Also documented that v2 names the attribute
`destinations` — an **alias**, not a rename (`@JsonAlias("dest")`, `dest` still
parses) — and that `/schema` is GET-only in v2, so the bulk endpoint is
discoverable from the prose.
# Tests
Verified against a live Solr 10.0.0 SolrCloud node: reproduced both original
failures, confirmed every path in the file now routes (reads `200`, writes
reach `SchemaManager`), and confirmed the corrected copy-field bodies parse and
validate, including via the `dest` alias. Probes used invalid payloads and
nonexistent field names, with zero schema residue afterwards. Every JSON
payload in the file now parses except the two **v1** examples with deliberately
repeated keys, which noggit accepts by design. `buildLocalAntoraSite` clean, no
new warnings.
Written with the assistance of Claude Code
--
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]
