Skip to content
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

Rest-client extension is not compatible with YAML extension #13506

Closed
oscarfh opened this issue Nov 26, 2020 · 7 comments
Closed

Rest-client extension is not compatible with YAML extension #13506

oscarfh opened this issue Nov 26, 2020 · 7 comments
Labels
area/rest-client kind/question Further information is requested

Comments

@oscarfh
Copy link
Contributor

oscarfh commented Nov 26, 2020

The rest-client extension is not compatible with the yaml extension.

Steps to reproduce:

The previous definition

org.acme.rest.client.CountriesService/mp-rest/url=https://restcountries.eu/rest 
org.acme.rest.client.CountriesService/mp-rest/scope=javax.inject.Singleton 

Will become

org.acme.rest.client.CountriesService:
  mp-rest:
    url: https://restcountries.eu/rest
    scope=javax.inject.Singleton

Your application will not start anymore with the given error:

Unable to determine the proper baseUrl/baseUri. Consider registering using @RegisterRestClient(baseUri="someuri"), @RegisterRestClient(configKey="orkey"), or by adding 'org.acme.config.DefaultApi2/mp-rest/url' or 'org.acme.config.DefaultApi2/mp-rest/uri' to your Quarkus configuration

The reason is that the YAML extension will generate config entries similar to
"org.acme.rest.client.CountriesService".mp-rest.url (double quotes included in the name), while the rest-client extension will look for the following entry: org.acme.rest.client.CountriesService/mp-rest/url.

I do not know which extension is misbehaving in this case.

@oscarfh oscarfh added the kind/bug Something isn't working label Nov 26, 2020
@ghost ghost added the area/rest-client label Nov 26, 2020
@ghost
Copy link

ghost commented Nov 26, 2020

/cc @phillip-kruger

@phillip-kruger
Copy link
Member

@radcortez I think this is more a config issue than a rest client issue ?

@jtama
Copy link
Contributor

jtama commented Nov 27, 2020

You should try :

org.acme.rest.client:
    CountriesService/mp-rest/url: https://restcountries.eu/rest
    CountriesService.scope: javax.inject.Singleton

@oscarfh
Copy link
Contributor Author

oscarfh commented Nov 27, 2020

@jtama-op Unfortunately the issue still persists.

@radcortez
Copy link
Member

I'll have a look.

@radcortez
Copy link
Member

This is related with #11744.

One way to have it working is to just add each path to the yaml file like this:

org:
  acme:
    rest:
      client:
        CountriesService/mp-rest/url: https://restcountries.eu/rest

Alternative, I recommend to set the configKey in @RegisterRestClient with a simple key like countries-services-api. Then you can just use:

countries-services-api/mp-rest/url: https://restcountries.eu/rest

@oscarfh
Copy link
Contributor Author

oscarfh commented Nov 27, 2020

@radcortez thanks for the reply. I cannot use the configKey parameter because the rest client is being generated by the open api code generator for microprofile.
The approach you mentioned separating the keys works like a charm. thanks!

@oscarfh oscarfh closed this as completed Nov 27, 2020
@gsmet gsmet added kind/question Further information is requested and removed kind/bug Something isn't working labels Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/rest-client kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

5 participants