Skip to content

Conversation

newtork
Copy link
Contributor

@newtork newtork commented Mar 4, 2025

Context

https://github.com/SAP/ai-sdk-java-backlog/issues/171

  • Enable Exclusion of Paths and Properties.

Demo for new feature toggles:

Feature scope:

Usage:

<plugin>
  <groupId>com.sap.cloud.sdk.datamodel</groupId>
  <artifactId>openapi-generator-maven-plugin</artifactId>
  <configuration>
    <additionalProperties>
    
      <!-- new: exclude paths -->
      <excludePaths>
          /deployments/{deployment-id}/completions
          /deployments/{deployment-id}/audio/transcriptions
          /deployments/{deployment-id}/audio/translations
          /deployments/{deployment-id}/images/generations
      </excludePaths>
    
      <!-- new: exclude properties -->
      <excludeProperties>
          chatCompletionResponseMessage.context
          createChatCompletionRequest.data_sources
      </excludeProperties>
    
      <!-- new: remove unassigned components -->
      <removeUnusedComponents>true</removeUnusedComponents>
    </additionalProperties>
  </configuration>
</plugin>
  • New generator customizations to exclude paths, to exclude parameters and to remove unused schema components

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

a-d and others added 23 commits February 25, 2025 17:07
…elGeneratorIntegrationTest/openai-2024-10-21/output/com/sap/cloud/sdk/services/openai/api/DefaultApi.java
…d/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java
…f-bigdecimal-list

# Conflicts:
#	datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java
#	datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GeneratorCustomProperties.java
#	datamodel/openapi/openapi-generator/src/test/java/com/sap/cloud/sdk/datamodel/openapi/generator/DataModelGeneratorIntegrationTest.java
#	datamodel/openapi/openapi-generator/src/test/resources/DataModelGeneratorIntegrationTest/api-class-for-ai-sdk/output/com/sap/cloud/sdk/services/builder/model/Soda.java
…l-list' into float-array-instead-of-bigdecimal-list
…ation

# Conflicts:
#	datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/CustomJavaClientCodegen.java
#	datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GeneratorCustomProperties.java
@newtork newtork changed the title feat: [OpenAPI] Exclusion of paths and properties feat: [OpenAPI] Refactor customizations and add Exclusion of paths and properties Mar 4, 2025
@newtork newtork added please merge Request to merge a pull request please review Request to review a pull request labels Mar 10, 2025
@newtork newtork changed the title feat: [OpenAPI] Refactor customizations and add Exclusion of paths and properties feat: [OpenAPI] Exclusion of paths and properties Mar 10, 2025
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP left a comment

Choose a reason for hiding this comment

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

Can I see this code in action in a unit test?

Copy link
Member

@Jonas-Isr Jonas-Isr left a comment

Choose a reason for hiding this comment

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

Only very minor comment

@newtork newtork dismissed CharlesDuboisSAP’s stale review March 11, 2025 14:41

Please find the additional test for the three new feature toggles

dc7f90c

removed |= remove.test(s);

// check for allOf, anyOf, oneOf
for( final List<Schema> list : Arrays.asList(s.getAllOf(), s.getAnyOf(), s.getOneOf()) ) {
Copy link
Contributor

@CharlesDuboisSAP CharlesDuboisSAP Mar 12, 2025

Choose a reason for hiding this comment

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

How could you pass an opportunity for recursion? (the while)
Also the allOf case is not tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

How could you pass an opportunity for recursion? (the while)

Recursion is a poisoned fruit. Looks nice on the outside, but makes you sick when problems appear.

Also the allOf case is not tested.

I added a test case: 2bf64ff -> f7da471

@newtork newtork merged commit ce30d56 into main Mar 12, 2025
14 checks passed
@newtork newtork deleted the openapi/partial-generation branch March 12, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please merge Request to merge a pull request please review Request to review a pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants