VladimirYushkevich opened a new pull request, #11806:
URL: https://github.com/apache/iceberg/pull/11806
**Description**
This PR addresses a compilation issue in the generated java classes from
`rest-catalog-open-api.yaml` specification.
**Problem**
The generated Java classes fail to compile due to incorrect return types for
the `getAction()` and `getContent()` methods. While the parent classes expect
these methods to return a `String`, the child classes return specific
`ActionEnum` and `ContentEnum` types defined within each child class.
**Solution**
To resolve this, `ActionEnum` and `ContentEnum `types are now defined
globally in the OpenAPI specification. Both the parent and child classes
reference these global types, ensuring compatibility and eliminating the
compile-time errors.
**Steps to Reproduce the Issue**
Create a `.openapi-generator-ignore` file with the following content:
```
src/main/java/org/openapitools/client/ProgressResponseBody.java
```
Generate Java classes using the OpenAPI generator Docker image:
```
docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli
generate \
-i /local/rest-catalog-open-api.yaml \
-g java \
-o /local/build/openapi \
--library jersey3
```
Navigate to the generated stub:
```
cd open-api/build/openapi
```
Add the missing `Swagger` dependency to `build.gradle`:
```
implementation 'io.swagger.core.v3:swagger-annotations:2.1.11'
```
Run the Gradle build:
```
chmod -R 755 gradlew
./gradlew build
```
Observe the compilation errors, such as:
```
iceberg/open-api/build/openapi/src/main/java/org/openapitools/client/model/SetDefaultSortOrderUpdate.java:105:
error: getAction() in SetDefaultSortOrderUpdate cannot override getAction() in
BaseUpdate
public ActionEnum getAction() {
^
return type ActionEnum is not compatible with String
...
iceberg/open-api/build/openapi/src/main/java/org/openapitools/client/model/EqualityDeleteFile.java:109:
error: getContent() in EqualityDeleteFile cannot override getContent() in
ContentFile
public ContentEnum getContent() {
^
return type ContentEnum is not compatible with String
...
```
--
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]