Skip to content

Commit

Permalink
Add base-package available for custom config key (#800)
Browse files Browse the repository at this point in the history
* Add base-package available for custom config key

* Add full package name
  • Loading branch information
mcruzdev authored Sep 21, 2024
1 parent 8a1db04 commit fd06d31
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ private static OpenApiClientGeneratorWrapper createGeneratorWrapper(Path openApi
}

private String getBasePackage(final Config config, final Path openApiFilePath) {
return config
.getOptionalValue(getSpecConfigName(BASE_PACKAGE, openApiFilePath), String.class)
return getValues(config, openApiFilePath, BASE_PACKAGE, String.class)
.orElse(String.format("%s.%s", DEFAULT_PACKAGE, getSanitizedFileName(openApiFilePath)));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
quarkus.rest-client.custom_config_key.url=http://localhost:8080
quarkus.openapi-generator.codegen.spec.config_key_openapi_yaml.config-key=custom_config_key
quarkus.openapi-generator.codegen.spec.custom_config_key.mutiny=true
quarkus.openapi-generator.codegen.spec.custom_config_key.base-package=com.oapi.pkg

# use the @AnotherCustomAnnotation with `config_key_openapi_yaml`
quarkus.openapi-generator.codegen.spec.config_key_openapi_yaml.additional-api-type-annotations=@io.quarkiverse.openapi.generator.configkey.AnotherCustomAnnotation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import org.eclipse.microprofile.rest.client.inject.RestClient;
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.openapi.quarkus.config_key_openapi_yaml.api.ReactiveGreetingResourceApi;
import org.openapi.quarkus.empty_config_key_yaml.api.DefaultApi;

import com.oapi.pkg.api.ReactiveGreetingResourceApi;

import io.quarkus.test.junit.QuarkusTest;
import io.smallrye.mutiny.Uni;

Expand Down Expand Up @@ -40,6 +41,7 @@ void config_key_apiIsBeingGenerated() throws NoSuchMethodException {
@Test
void config_key_customAnnotation() {
assertThat(ReactiveGreetingResourceApi.class.getAnnotation(CustomAnnotation.class)).isNotNull();
assertThat(ReactiveGreetingResourceApi.class.getPackageName()).isEqualTo("com.oapi.pkg.api");
}

@Test
Expand Down

0 comments on commit fd06d31

Please sign in to comment.