-
Notifications
You must be signed in to change notification settings - Fork 14
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
[OpenAPI Generator] Enable allow-list for API and Model classes #530
base: main
Are you sure you want to change the base?
Conversation
Moved stale PR to personal fork. |
…s-and-models # Conflicts: # datamodel/openapi/openapi-generator/src/main/java/com/sap/cloud/sdk/datamodel/openapi/generator/GenerationConfigurationConverter.java
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.
generally lgtm. However, allow-list is not ideal for our purposes. E.g. for orchestration we already have 47 files, and typically we would want to only exclude a few files from generation.
Did you check the options for block-list? Maybe using .openapi-generator-ignore
can be made to work?
@@ -115,6 +115,15 @@ private static void setGlobalSettings( @Nonnull final GenerationConfiguration co | |||
GlobalSettings.setProperty(CodegenConstants.HIDE_GENERATION_TIMESTAMP, Boolean.TRUE.toString()); | |||
} | |||
|
|||
private static String getAllowedIds( @Nonnull final GenerationConfiguration config, @Nonnull final String property ) |
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.
(minor) a unit test for this would be nice, that would also clarify that both whitespaces and newlines are supported as separators
true, | ||
true, | ||
3, | ||
ofEntries(entry("apisToGenerate", "Default, NotExist"), entry("modelsToGenerate", "Cola,Fanta ,NotExist"))); |
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.
(question) is this intentional, or should it be:
ofEntries(entry("apisToGenerate", "Default, NotExist"), entry("modelsToGenerate", "Cola,Fanta ,NotExist"))); | |
ofEntries(entry("apisToGenerate", "Default, NotExist"), entry("modelsToGenerate", "Cola, Fanta, NotExist"))); |
version: 1.0.0 | ||
description: API for managing sodas in a soda store | ||
paths: | ||
/sodas: |
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.
(minor) since there is only one API, this only tests that NotExist
doesn't cause the generation to fail..
$ref: '#/components/schemas/OneOf' | ||
components: | ||
schemas: | ||
OneOfWithDiscriminatorAndMapping: |
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.
(minor) the following would prevent finding unrelated tests when searching our code base for oneOf
:
OneOfWithDiscriminatorAndMapping: | |
ShouldNotBeGenerated: |
Please find similar setting names in the original OpenAPI generator.
Usage:
additionalProperties
definemodelsToGenerate
andapisToGenerate
. Use<space>
or,
as delimiter.Note:
SodasApi.java
, theapisToGenerate
field should containSodas
(without suffix),apisToGenerate
is not defined, all APIs are allowed. Same withmodelsToGenerate
.Definition of Done
Error handling created / updated & covered by the tests aboveDocumentation updatedRelease notes updated