forked from SAP/cloud-sdk-java
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: [OpenAPI] Generator refactoring and extensions #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
newtork
wants to merge
34
commits into
main
Choose a base branch
from
openapi/generator-extensions
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…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
Co-authored-by: Roshin Rajan Panackal <[email protected]>
…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
This reverts commit 2cb2e39.
…ensions # 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
commented
May 14, 2025
| /** | ||
| * Optional feature toggles, may be used internally only. | ||
| */ | ||
| public interface GeneratorCustomization |
Owner
Author
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(Comment)
This interface is a little complex. A good chunk of this API is static and serves API contracts, the rest is dynamic - it will grow over time depending on new customizations requiring new overrides.
The interfaces serves the following features:
(Static) Represent a generic generator customization.
- A customization has logic to control whether it's active or not:
getConfigKey()(default:null) to identify a feature toggle from the configuration properties.getConfigValueDefault()(default:null) to indicate default setting for active or not.getConfigValue( config )can be overloaded.isConfigEnabled( config )can be overloaded.
- Static helper methods to load instances from runtime to a List
getCustomizations()returns a list of all available customization instances.getCustomizations( config )returns a filtered list of active customization.
(Static) Contains API to chain customizations.
ChainElementhasget()to access current value andconfig()to access generator configuration.ChainElementVoid extends ChainElementoffers invocation chaining without returned objectsChainElementReturn extends ChainElementoffers invocation chaining with returned objects.ChainableVoidandChainableReturnare marker interfaces to indicate chaining capabilities.
(Dynamic) Contains API to override specific generator methods.
UpdatePropertyForArray- used by
UseFloatArrays
- used by
ToDefaultValue- used by
UseFloatArrays
- used by
ToBooleanGetter- used by
FixRedundantIsBooleanPrefix
- used by
UpdateModelForComposedSchema- used by
UseOneOfCreators
- used by
PostProcessOperationsWithModels- used by
FixReturnNullable
- used by
UpdateModelForObject- used by
FixAdditionalProperties
- used by
PreProcessOpenAPI- used by
UseExcludePaths - used by
UseExcludeProperties - used by
FixRedundantComponents
- used by
8 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Original PR SAP#748
Context
https://github.com/SAP/ai-sdk-java-backlog/issues/171
Improve maintenance
Demo for external plugin extensions:
Feature scope:
Example for generator customization that could even be provided by user by implementing their own class and register it via
ServiceLoader.Constraints:
A customization may implement one or more generator override methods, e.g.
UseFloatArrays -> GeneratorCustomization.ToDefaultValue, GeneratorCustomization.UpdatePropertyForArrayA generator override method may be implemented by one or more customization, e.g.
GeneratorCustomization.PreProcessOpenAPI <- UseExcludePaths, UseExcludeProperties, FixRedundantComponents(This solution is inspired by Servlet FilterChain API)
Definition of Done
Tests cover the scope aboveError handling created / updated & covered by the tests aboveDocumentation updatedRelease notes updated