adityamparikh opened a new pull request, #314:
URL: https://github.com/apache/solr-mcp/pull/314

   Stacked on #308 (`feat/schema-contracts`). Review that one first; this PR 
adds a single commit on top of it.
   
   **Before:** once Solr ships 
[SOLR-18678](https://issues.apache.org/jira/browse/SOLR-18678), a field such as 
`id` that carries `dc:description = "unique document identifier"` would come 
back from `get-schema` without its description, because #308's typed records 
drop every attribute the contract doesn't name.
   
   **After:** `get-schema` returns that field as
   
   ```json
   {"name":"id","type":"string","metadata":{"dc:description":"unique document 
identifier","ext:internal":false}}
   ```
   
   and `add-fields` / `add-field-types` send `metadata` back to the Schema API 
unchanged, so it round-trips. Fields, dynamic fields and field types all carry 
it; it is absent when the schema declares none.
   
   **Why now:** SOLR-18678 (Andrzej Bialecki, Part 1) adds typed key-value 
metadata to fields, dynamic fields and field types so people and agents can 
tell what a field holds. That is exactly the client an MCP server is. The 1.0.0 
record shapes in #308 aren't released yet, so adding a nullable component costs 
nothing today and would be a breaking change later.
   
   **How:** `CollectionSchema.Field` and `CollectionSchema.FieldType` gain a 
nullable `Map<String, Object> metadata`, copied unmodifiable in the schema's 
key order, with Solr's value types (booleans, numbers, lists, nested objects) 
kept as is. The container is still being discussed on the Jira: Andrzej's 
[comment](https://issues.apache.org/jira/browse/SOLR-18678?focusedCommentId=18149785#comment-18149785)
 proposes a typed `NamedList<Object>`, and Ivan Saric's [Nov 26 
comment](https://issues.apache.org/jira/browse/SOLR-18678?focusedCommentId=18151562#comment-18151562)
 proposes a `SimpleOrderedMap` with unique keys so `/schema/fields` renders a 
JSON object whatever `json.nl` is. The parser accepts both: a JSON object as 
is, and a NamedList's flat `[key, value, …]` array as the same pairs, with a 
repeated key keeping every value as a list. A `metadata` value that is neither 
(or is empty) is left out. For field types, `metadata` is excluded from the 
scalar `parameters` bag.
   
   **Open point:** the Schema API's JSON key is not settled in SOLR-18678 (the 
XML element is `<metadata>` in the description and `<meta>` in the example). 
This PR uses `metadata`; it lives in one constant (`CollectionSchema.METADATA`) 
and can follow whatever Solr picks.
   
   **Spec:** the matching `schema-management` requirement and task 4.6 are on 
#306 (commit 7ad65ff).
   
   **Tests:** 7 new `SchemaServiceTest` cases cover the JSON-object form on 
fields, dynamic fields and field types (key order and value types kept), the 
flat NamedList form with a repeated key, absence (none, empty, malformed), 
`add-fields` and `add-field-types` request bodies, and a `get-schema` → 
`add-fields` round trip. `./gradlew spotlessCheck test`: 531 tests, 0 failures 
(Docker-backed integration tests were skipped in this environment). Native 
tests not run.
   
   
   🤖 Generated with [Claude Code](https://claude.com/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]

  • [PR] feat(schema): keep field ... adityamparikh (via GitHub) via issues

Reply via email to