[
https://issues.apache.org/jira/browse/SOLR-18701?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18155424#comment-18155424
]
ASF subversion and git services commented on SOLR-18701:
--------------------------------------------------------
Commit 5711d62d8421ac606788b4298b9ac09e9b44fb8f in solr's branch
refs/heads/main from Eric Pugh
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=5711d62d842 ]
SOLR-18701 (alternative): Prefixed operationIds instead of renaming v2 methods
(#5422)
> 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: 1h 40m
> 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]