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

   https://issues.apache.org/jira/browse/SOLR-18701 — an alternative to #5421; 
only one of the two should be merged.
   
   OpenAPI requires operationIds to be unique across the spec. swagger uses the 
Java method name as the operationId and renames a duplicate to `name_1`, which 
leaks into the generated clients (`QueryingApi.Query1`). #5421 fixes this by 
renaming methods so names are unique across all v2 interfaces (`select`, 
`listCoreSnapshots`, ...). This PR keeps the natural method names instead.
   
   ### Approach
   - A method whose name another API already uses sets `operationId = 
"<tag>_<methodName>"` on its `@Operation`, e.g. `coreSnapshots_listSnapshots`. 
The spec stays unique.
   - The SolrJ, JS and Python generators run with openapi-generator's standard 
`removeOperationIdPrefix` option, which drops everything up to the first `_`. 
Clients are grouped into one class per tag, so the same name in two tags 
doesn't clash.
   
   | Interface method (unchanged) | operationId | SolrJ class: before → after |
   |---|---|---|
   | `SelectApi.query` | `querying_query` | `QueryingApi.Query1` → 
`QueryingApi.Query` |
   | `CoreSnapshotApi.listSnapshots` | `coreSnapshots_listSnapshots` | 
`CoreSnapshotsApi.ListSnapshots1` → `ListSnapshots` |
   | `ReplicationApis.fetchFile` | `replication_fetchFile` | 
`ReplicationApi.FetchFile1` → `FetchFile` |
   | `ReplicationBackupApis.createBackup` | `replicationBackups_createBackup` | 
`ReplicationBackupsApi.CreateBackup1` → `CreateBackup` |
   
   The same goes for JS (`query1()` → `query()`) and Python. Every other 
generated name is unchanged, and no server code changes.
   
   ### Compared with #5421
   - **Pro:** natural method and client names. `QueryingApi.Query` goes back to 
its Solr 10.0 name.
   - **Con:** `removeOperationIdPrefix` strips at the first `_` of *every* 
operationId, so ids must not otherwise contain `_`. None do today.
   - **Con:** a collision that nobody notices still produces `name_1`, which 
the generators would then strip to `1`. I haven't tested what they do with that.
   
   ### Docs
   - `dev-docs/apis-v2-conventions.adoc`: "Operation Names" section describing 
the `<tag>_<methodName>` rule.
   - Upgrade notes: Solr 11 (class names lose the `1`), and Solr 10.2 
(`QueryingApi.Query` became `Query1` in 10.1).
   
   ### Testing
   `gradlew check -x test`, all Admin UI browser tests 
(`-Ptests.selenium=true`), and `CoreSnapshotAPITest`, `SnapshotBackupAPITest`, 
`CoreReplicationAPITest`, `ReplicationHandlerRecoveryAuthIntegrationTest`, 
`TestHealthCheckHandlerLegacyMode`, `TestSchemaDesignerSolrJ` pass.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_018RwsEmM9zRWihYjszWDGK9
   


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