Skip to content

Commit

Permalink
issue-496 make the code consistent with documentation and improve test (
Browse files Browse the repository at this point in the history
#497)

Co-authored-by: Alessandro Chacón <alessandro.chacon@cryptobroker.ch>
  • Loading branch information
aecc and Alessandro Chacón authored Sep 28, 2023
1 parent 5097e3a commit f69ae91
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ public OpenApiClientGeneratorWrapper withAdditionalModelTypeAnnotationsConfig(fi
*/
public OpenApiClientGeneratorWrapper withAdditionalApiTypeAnnotationsConfig(final String additionalApiTypeAnnotations) {
if (additionalApiTypeAnnotations != null) {
this.configurator.addAdditionalProperty("additionalApiTypeAnnotations", additionalApiTypeAnnotations.split(","));
this.configurator.addAdditionalProperty("additionalApiTypeAnnotations", additionalApiTypeAnnotations.split(";"));
}
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -514,8 +514,7 @@ private void verifyModelAdditionalAnnotations(File file) {
void verifyAdditionalApiTypeAnnotations() throws URISyntaxException {
List<File> generatedFiles = createGeneratorWrapper("petstore-openapi.json")
.withEnabledSecurityGeneration(false)
.withAdditionalApiTypeAnnotationsConfig(
"@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders")
.withAdditionalApiTypeAnnotationsConfig("@org.test.Foo;@org.test.Bar")
.generate("org.additionalapitypeannotations");
assertFalse(generatedFiles.isEmpty());

Expand All @@ -529,9 +528,8 @@ private void verifyApiAdditionalAnnotations(File file) {
CompilationUnit compilationUnit = StaticJavaParser.parse(file);
compilationUnit.findAll(ClassOrInterfaceDeclaration.class)
.forEach(c -> {
assertThat(
c.getAnnotationByName("RegisterClientHeaders"))
.isPresent();
assertThat(c.getAnnotationByName("Foo")).isPresent();
assertThat(c.getAnnotationByName("Bar")).isPresent();
});
} catch (FileNotFoundException e) {
throw new RuntimeException(e.getMessage());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Authentication properties
org.acme.openapi.security.auth.basic_auth/username=john
org.acme.openapi.security.auth.basic_auth/password=test
customAuth.additionalApiTypeAnnotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders,@org.eclipse.microprofile.rest.client.annotation.RegisterProvider(io.quarkiverse.openapi.generator.it.security.auth.DummyApiKeyAuthenticationProvider.class)
customAuth.additionalApiTypeAnnotations=@org.eclipse.microprofile.rest.client.annotation.RegisterClientHeaders;@org.eclipse.microprofile.rest.client.annotation.RegisterProvider(io.quarkiverse.openapi.generator.it.security.auth.DummyApiKeyAuthenticationProvider.class)

# since the file name has a space, we use the URI representation of this space here to not break the properties file
# see the RFC3986 for more info https://datatracker.ietf.org/doc/html/rfc3986
Expand Down

0 comments on commit f69ae91

Please sign in to comment.