[ 
https://issues.apache.org/jira/browse/SOLR-18701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18154122#comment-18154122
 ] 

Eric Pugh commented on SOLR-18701:
----------------------------------

Item 3 (the build check that fails on {{_<n>}} operation ids) has been dropped. 
The "Operation Names" section added to {{dev-docs/apis-v2-conventions.adoc}} 
covers the rule, and we'd rather not add more custom build tooling. PR: 
https://github.com/apache/solr/pull/5421 covers items 1 and 2.

> Prevent duplicate v2 operation ids, which the OpenAPI generator suffixes with 
> _1
> --------------------------------------------------------------------------------
>
>                 Key: SOLR-18701
>                 URL: https://issues.apache.org/jira/browse/SOLR-18701
>             Project: Solr
>          Issue Type: Improvement
>          Components: Build, SolrJ, v2 API
>            Reporter: Eric Pugh
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Each v2 API interface method name becomes its OpenAPI {{operationId}}, which 
> names the generated SolrJ request class and JS client method. When two 
> interfaces share a method name, the generator quietly appends {{_1}} to 
> whichever it sees second. As a result:
> * Names like {{QueryingApi.Query1}}, {{ListSnapshots1}}, {{FetchFile1}} and 
> {{CreateBackup1}} (and {{query1()}}, {{listSnapshots1()}} in the JS client) 
> are part of the public client API.
> * Adding an unrelated endpoint can rename an existing operation. In PR #5420 
> (SOLR-18700), new Schema Designer 
> {{deleteField}}/{{deleteDynamicField}}/{{deleteFieldType}} methods renamed 
> the Schema API's to {{deleteField_1}} etc., which broke the Admin UI Schema 
> screen ({{AdminUiSchemaScreenTest.testAddAndDeleteFieldViaUi}}) and would 
> have renamed SolrJ classes. Fixed there by renaming the designer methods.
> Current collisions on main:
> ||operationId||endpoint||collides with||
> |query_1|GET /\{indexType\}/\{indexName\}/select|Schema Designer query|
> |listSnapshots_1|GET /cores/\{coreName\}/snapshots|collection listSnapshots|
> |fetchFile_1|GET /cores/\{coreName\}/replication/files/\{filePath\}|file 
> store fetchFile|
> |createBackup_1|POST /cores/\{coreName\}/replication/backups|core 
> createBackup|
> Proposal:
> # Add an "Operation Names" section to {{dev-docs/apis-v2-conventions.adoc}}: 
> method names must be unique across all v2 interfaces, and should include the 
> resource (e.g. {{deleteDesignerField}}, {{listCoreSnapshots}}).
> # Rename the four colliding methods. This changes SolrJ class and JS client 
> method names, so it needs upgrade notes and is probably main-only.
> # Add a build check that fails when any operationId in the generated spec 
> ends in {{_<n>}}.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

  • [jira] [Commented] (SOLR... Eric Pugh (Jira) via issues

Reply via email to