Closed KangoV closed 3 months ago
This makes it impossible to include two generated clients in the same application.
In fact, the clientId
value is not found anywhere in the generated code.
@altro3 can you take a look at this one? I didn't check but could be a bug in micronaut-openapi
instead.
On weekend
@KangoV fixed. Use latest version of micronaut-openapi 6.6.3
Awesome. That worked.
Question though, I have two clients, but they both have path = "${openapi-micronaut-client-base-path}"
, how are they supposed to work? How do I set a different base path for each?
Should the base path be added to the openapi configuration alongside the clientId?
Ahh, if I set micronaut.http.services.myclient.url=https://api.myserver.com
, will that be used instead of the path on the @Client(id="myclient")
annotation?
@KangoV I don't know the answer to this question, because I didn't make the original template. I do not exclude that this is a flaw.
The problem is, I don't quite understand why it was done this way, and because of this, I can't just take the current template and redo it. I want to say, perhaps this was done for some reason and it’s not a bug at all, but “it’s the way it should be.”
Therefore, guys, please help me correctly interpret the current template and, if necessary, then formulate how best to fix it.
@melix @timyates @graemerocher @andriy-dmytruk
@KangoV So I studied this code, I think I made the generation more convenient. PR here: https://github.com/micronaut-projects/micronaut-openapi/pull/1467
.
symbolIn your case it will be:
@Client("myclient")
But you could set clientPath = true
and you will see this:
@Client(id = "myclient", path = "${myclient.base-path}")
Without client id it will be
@Client("${openapi-micronaut-client.base-path}")
That sounds exactly what I need. Thanks for this 👍 .
Expected Behavior
given
I would expect the API class to have:
Actual Behaviour
The API class has:
Steps To Reproduce
Create or use an exiting opanapi file. Configure gradle:
Run
./gradlew generateClientOpenApiApis
Environment Information
MacOS java 21-tem Micronaut 4.3.1 Micronaut Gradle Plugin 4.3.3
Example Application
No response
Version
4.3.1