Skip to content

Conversation

@rpanackal
Copy link
Member

@rpanackal rpanackal commented Jan 7, 2026

Context

SAP/cloud-sdk-java-backlog#464.
Helpful Links:

In the previous PR, we introduced OpenAPI generator support for apache-httpclient template library, effectively making Spring options.

In this PR, there exists the test coverage for the new components equivalent to Spring.

Feature scope:

  • Unit testing in openapi-core
  • Test serialization, deserialization and oneOf support in openapi-api-apache-sample module
  • Integration testing in openapi-generator
  • Pin <supportUrlQuery>false</supportUrlQuery> by hard coding it into the generator

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Documentation updated
  • Release notes updated

- Hide response body from exception message
- regenerate with formatting adjustments
- Non-null response when return type is OpenApiResponse.
- invokeAPI is nullable
- Make getter for basePath
@rpanackal rpanackal changed the base branch from main to feat/openapi/refactor-apache-templates January 7, 2026 14:05
…templates' into feat/openapi/test-apache-client-templates

# Conflicts:
#	datamodel/openapi/openapi-core/src/test/java/com/sap/cloud/sdk/services/openapi/genericreturntype/GenericReturnTypeTest.java
* @throws OpenApiRequestException
* if an error occurs while attempting to invoke the API
*/
@Nonnull
Copy link
Member Author

@rpanackal rpanackal Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This @Nonull annotaion is a lie. The same exists in Spring equivalent.

I am assuming this was intentional to not force handling possible null value at the caller. Still, would like some confirmation.

To add some details, invokeAPI() calls will return null when response body is empty or status is. 204

@rpanackal rpanackal self-assigned this Jan 8, 2026
@rpanackal rpanackal added the please review Request to review a pull request label Jan 8, 2026
{
return Stream
.of(
Arguments.of((Function<HttpDestination, Object>) ( des ) -> new TestSpringApi(des).testMethod()),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Comment)

Cool solution!

});

// Always disable supportUrlQuery as it's not compatible with interface generation
result.put(SUPPORT_URL_QUERY, "false");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Question)

This looks surprising. Will this not result in a breaking change? What is this flag doing?

//TODO: support byte[] for files? Do via review
// final byte[] result = sut.sodasDownloadIdGet(1L);
// assertThat(result).isNotNull();
// assertThat(result).isEqualTo(binaryData);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Minor)

We may need an additional unit test for that(?)

@Test
void testPutPayload()
{
// TODO: discuss whether to ignore null on serialization? Do via review
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Minor)

I feel like this is a risky behavior change. While personally I would like that, I'm afraid that users may be affected unwillingly by that. Maybe we can instead come up with a convenience toggle/method somehow.

For comparison, the payload from legacy RestTemplate-based ("Spring") ApiClient:

        expected = """
            {
              "name": "Cola",
              "brand": "Coca-Cola",
              "quantity": 100,
              "packaging" : null,
              "price": 1.5,
              "id": 0
            }
            """;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

please review Request to review a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants