[
https://issues.apache.org/jira/browse/SOLR-17326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17854111#comment-17854111
]
ASF subversion and git services commented on SOLR-17326:
--------------------------------------------------------
Commit 461955f00118c69d06f50e72addeff12c8dd8169 in solr's branch
refs/heads/main from Christos Malliaridis
[ https://gitbox.apache.org/repos/asf?p=solr.git;h=461955f0011 ]
SOLR-17326: Fix references in generated SolrRequest impls (#2510)
A handful of the v2 SolrRequest implementations generated
by our OAS spec relied on response model classes whose names
conflicted with other (unrelated) classes in solrj. This caused
errors at request time as JacksonParsingResponse would try to
deserialize the JSON, XML, etc. response body into these
unintended classes.
This commit fixes this by modifying the 'api.mustache' template
so that generated SolrRequest classes now reference their
response model using the fully-qualified classname (i.e. including
the package). This resolves the ambiguity.
---------
Co-authored-by: Jason Gerlowski <[email protected]>
> Wrong class resolution in generated API response classes
> --------------------------------------------------------
>
> Key: SOLR-17326
> URL: https://issues.apache.org/jira/browse/SOLR-17326
> Project: Solr
> Issue Type: Bug
> Security Level: Public(Default Security Level. Issues are Public)
> Components: SolrJ
> Affects Versions: 8.11.3, 9.6.1
> Reporter: Christos Malliaridis
> Assignee: Jason Gerlowski
> Priority: Major
> Labels: V2, mustache, solrj
> Time Spent: 40m
> Remaining Estimate: 0h
>
> When a naming conflict occurs between the response class and the return type
> (API model) included in the response of the v2 API, the
> {{java-template/api.mustache}} template will use the response class as return
> type and ignore the API model. This results in missing fields and parsing
> errors when calling {{JacksonParsingResponse.getParsed()}}.
> The affected response classes are:
> * {{CoreSnapshotsApi.DeleteSnapshotResponse}}
> * {{CollectionSnapshotsApi.CreateCollectionSnapshotResponse}}
> * {{CollectionSnapshotsApi.DeleteCollectionSnapshotResponse}}
> * {{CollectionsApi.ListCollectionsResponse}}
> * {{AliasPropertiesApi.GetAllAliasPropertiesResponse}}
> * {{AliasPropertiesApi.GetAliasPropertyResponse}}
> * {{AliasesApi.GetAliasByNameResponse}}
> All above classes have the same name as their corresponding return type and
> differ only in the package name. The generated classes therefore references
> the response classes and not the API models from
> {{org.apache.solr.client.api.model}} in the generic type.
> In order to use the information from the responses custom code that bypasses
> {{JacksonParsingresponse.getParsed()}} is required, otherwise parsing errors
> may occur.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]