Skip to content

Commit eb80f47

Browse files
authored
Merge branch 'main' into Generate-builder-methods-on-beans
2 parents 924eb4a + b6a4a55 commit eb80f47

File tree

71 files changed

+1845
-201
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1845
-201
lines changed

.all-contributorsrc

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@
434434
"avatar_url": "https://avatars.githubusercontent.com/u/80655200?v=4",
435435
"profile": "https://dev.to/dellamas",
436436
"contributions": [
437-
"doc"
437+
"doc",
438+
"test"
438439
]
439440
},
440441
{
@@ -445,6 +446,15 @@
445446
"contributions": [
446447
"doc"
447448
]
449+
},
450+
{
451+
"login": "omatheusmesmo",
452+
"name": "Matheus Oliveira da Silva",
453+
"avatar_url": "https://avatars.githubusercontent.com/u/99829531?v=4",
454+
"profile": "https://github.com/omatheusmesmo",
455+
"contributions": [
456+
"code"
457+
]
448458
}
449459
],
450460
"contributorsPerLine": 7,

.github/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
release:
2-
current-version: 2.10.0
2+
current-version: 2.11.0
33
next-version: 3.0.0-SNAPSHOT

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
matrix:
3131
os: [
3232
ubuntu-latest,
33-
# windows-latest - Disabled due to https://github.com/quarkiverse/quarkus-openapi-generator/pull/836#issuecomment-2457329495
33+
windows-latest
3434
]
3535
java: [
3636
{ 'version': '17' },
@@ -59,7 +59,7 @@ jobs:
5959
matrix:
6060
os: [
6161
ubuntu-latest,
62-
# windows-latest - Disabled due to https://github.com/quarkiverse/quarkus-openapi-generator/pull/836#issuecomment-2457329495
62+
windows-latest
6363
]
6464
java: [
6565
{ 'version': '17' },

.github/workflows/preview.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
if: github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success'
1313
steps:
1414
- name: Download PR Artifact
15-
uses: dawidd6/action-download-artifact@v9
15+
uses: dawidd6/action-download-artifact@v11
1616
with:
1717
workflow: ${{ github.event.workflow_run.workflow_id }}
1818
workflow_conclusion: success

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
<br>
99

1010
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
11-
[![All Contributors](https://img.shields.io/badge/all_contributors-47-orange.svg?style=flat-square)](#contributors-)
11+
[![All Contributors](https://img.shields.io/badge/all_contributors-48-orange.svg?style=flat-square)](#contributors-)
1212
<!-- ALL-CONTRIBUTORS-BADGE:END -->
1313
[![Build](<https://img.shields.io/github/actions/workflow/status/quarkiverse/quarkus-openapi-generator/build.yml?branch=main&logo=GitHub&style=flat-square>)](https://github.com/quarkiverse/quarkus-openapi-generator/actions?query=workflow%3ABuild)
1414
[![Maven Central](https://img.shields.io/maven-central/v/io.quarkiverse.openapi.generator/quarkus-openapi-generator.svg?label=Maven%20Central&style=flat-square)](https://search.maven.org/artifact/io.quarkiverse.openapi.generator/quarkus-openapi-generator)
1515
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg?style=flat-square)](https://opensource.org/licenses/Apache-2.0)
16+
[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/quarkiverse/quarkus-openapi-generator)
1617

1718
Quarkus' extensions for generation of [Rest Clients](https://quarkus.io/guides/rest-client) and server stubs generation based on the [Apicurio Codegen](https://github.com/Apicurio/apicurio-codegen) capabilities based on OpenAPI specification files.
1819

@@ -103,8 +104,9 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
103104
<td align="center" valign="top" width="14.28%"><a href="https://github.com/yuhaibohotmail"><img src="https://avatars.githubusercontent.com/u/48646226?v=4?s=100" width="100px;" alt="yuhaibohotmail"/><br /><sub><b>yuhaibohotmail</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=yuhaibohotmail" title="Code">💻</a> <a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=yuhaibohotmail" title="Tests">⚠️</a></td>
104105
<td align="center" valign="top" width="14.28%"><a href="https://jpsantistebanq.github.io/portfolio"><img src="https://avatars.githubusercontent.com/u/49204973?v=4?s=100" width="100px;" alt="Juan Piero Santisteban Quiroz"/><br /><sub><b>Juan Piero Santisteban Quiroz</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=JPSantistebanQ" title="Code">💻</a> <a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=JPSantistebanQ" title="Tests">⚠️</a></td>
105106
<td align="center" valign="top" width="14.28%"><a href="https://github.com/joschi"><img src="https://avatars.githubusercontent.com/u/43951?v=4?s=100" width="100px;" alt="Jochen Schalanda"/><br /><sub><b>Jochen Schalanda</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=joschi" title="Code">💻</a></td>
106-
<td align="center" valign="top" width="14.28%"><a href="https://dev.to/dellamas"><img src="https://avatars.githubusercontent.com/u/80655200?v=4?s=100" width="100px;" alt="Luis Fabrício De Llamas"/><br /><sub><b>Luis Fabrício De Llamas</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=dellamas" title="Documentation">📖</a></td>
107+
<td align="center" valign="top" width="14.28%"><a href="https://dev.to/dellamas"><img src="https://avatars.githubusercontent.com/u/80655200?v=4?s=100" width="100px;" alt="Luis Fabrício De Llamas"/><br /><sub><b>Luis Fabrício De Llamas</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=dellamas" title="Documentation">📖</a> <a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=dellamas" title="Tests">⚠️</a></td>
107108
<td align="center" valign="top" width="14.28%"><a href="https://github.com/jghagemann"><img src="https://avatars.githubusercontent.com/u/42047435?v=4?s=100" width="100px;" alt="João Guilherme Hagemann"/><br /><sub><b>João Guilherme Hagemann</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=jghagemann" title="Documentation">📖</a></td>
109+
<td align="center" valign="top" width="14.28%"><a href="https://github.com/omatheusmesmo"><img src="https://avatars.githubusercontent.com/u/99829531?v=4?s=100" width="100px;" alt="Matheus Oliveira da Silva"/><br /><sub><b>Matheus Oliveira da Silva</b></sub></a><br /><a href="https://github.com/quarkiverse/quarkus-openapi-generator/commits?author=omatheusmesmo" title="Code">💻</a></td>
108110
</tr>
109111
</tbody>
110112
</table>

client/deployment/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<name>Quarkus - OpenAPI Generator - Client - Deployment</name>
1212

1313
<properties>
14-
<version.org.openapitools>7.13.0</version.org.openapitools>
14+
<version.org.openapitools>7.14.0</version.org.openapitools>
1515
<version.org.slf4j>2.0.17</version.org.slf4j>
1616
<version.com.github.jknack>4.3.1</version.com.github.jknack>
1717
</properties>

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/GeneratorProcessor.java

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,7 @@ FeatureBuildItem feature() {
8484
}
8585

8686
@BuildStep
87-
void additionalBean(Capabilities capabilities, BuildProducer<AdditionalBeanBuildItem> producer) {
88-
87+
void registerOidcClientBean(Capabilities capabilities, BuildProducer<AdditionalBeanBuildItem> producer) {
8988
if (!isClassPresentAtRuntime(ABSTRACT_TOKEN_PRODUCER)) {
9089
LOGGER.debug("{} class not found in runtime, skipping OidcClientRequestFilterDelegate bean generation",
9190
ABSTRACT_TOKEN_PRODUCER);
@@ -101,7 +100,6 @@ void additionalBean(Capabilities capabilities, BuildProducer<AdditionalBeanBuild
101100
producer.produce(AdditionalBeanBuildItem.builder().addBeanClass(ClassicOidcClientRequestFilterDelegate.class)
102101
.setDefaultScope(DotName.createSimple(Dependent.class)).setUnremovable().build());
103102
}
104-
105103
}
106104

107105
@BuildStep
@@ -126,7 +124,7 @@ void produceCompositeProviders(AuthenticationRecorder recorder, List<AuthProvide
126124
}
127125

128126
@BuildStep
129-
@Record(ExecutionTime.STATIC_INIT)
127+
@Record(ExecutionTime.RUNTIME_INIT)
130128
void produceOauthAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
131129
BuildProducer<AuthProviderBuildItem> authenticationProviders,
132130
BuildProducer<SyntheticBeanBuildItem> beanProducer,
@@ -176,16 +174,19 @@ void produceOauthAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
176174
.annotation(OpenApiSpec.class)
177175
.addValue("openApiSpecId", openApiSpecId)
178176
.done()
177+
.addInjectionPoint(ClassType.create(DotName.createSimple(CredentialsProvider.class)))
179178
.addInjectionPoint(ClassType.create(OAuth2AuthenticationProvider.OidcClientRequestFilterDelegate.class),
180179
AnnotationInstance.builder(OidcClient.class).add("name", sanitizeAuthName(name)).build())
180+
.addInjectionPoint(ClassType.create(DotName.createSimple(CredentialsProvider.class)))
181181
.createWith(oidcRecorder.recordOauthAuthProvider(sanitizeAuthName(name), openApiSpecId, operations))
182+
.setRuntimeInit()
182183
.unremovable()
183184
.done());
184185
}
185186
}
186187

187188
@BuildStep
188-
@Record(ExecutionTime.STATIC_INIT)
189+
@Record(ExecutionTime.RUNTIME_INIT)
189190
void produceBasicAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
190191
BuildProducer<AuthProviderBuildItem> authenticationProviders, BuildProducer<SyntheticBeanBuildItem> beanProducer,
191192
AuthenticationRecorder recorder) {
@@ -218,13 +219,14 @@ void produceBasicAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
218219
.done()
219220
.addInjectionPoint(ClassType.create(DotName.createSimple(CredentialsProvider.class)))
220221
.createWith(recorder.recordBasicAuthProvider(sanitizeAuthName(name), openApiSpecId, operations))
222+
.setRuntimeInit()
221223
.unremovable()
222224
.done());
223225
}
224226
}
225227

226228
@BuildStep
227-
@Record(ExecutionTime.STATIC_INIT)
229+
@Record(ExecutionTime.RUNTIME_INIT)
228230
void produceBearerAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
229231
BuildProducer<AuthProviderBuildItem> authenticationProviders, BuildProducer<SyntheticBeanBuildItem> beanProducer,
230232
AuthenticationRecorder recorder) {
@@ -258,14 +260,15 @@ void produceBearerAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
258260
.done()
259261
.addInjectionPoint(ClassType.create(DotName.createSimple(CredentialsProvider.class)))
260262
.createWith(recorder.recordBearerAuthProvider(sanitizeAuthName(name), scheme, openApiSpecId, operations))
263+
.setRuntimeInit()
261264
.unremovable()
262265
.done());
263266

264267
}
265268
}
266269

267270
@BuildStep
268-
@Record(ExecutionTime.STATIC_INIT)
271+
@Record(ExecutionTime.RUNTIME_INIT)
269272
void produceApiKeyAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
270273
BuildProducer<AuthProviderBuildItem> authenticationProviders, BuildProducer<SyntheticBeanBuildItem> beanProducer,
271274
AuthenticationRecorder recorder) {
@@ -302,6 +305,7 @@ void produceApiKeyAuthentication(CombinedIndexBuildItem beanArchiveBuildItem,
302305
.addInjectionPoint(ClassType.create(DotName.createSimple(CredentialsProvider.class)))
303306
.createWith(recorder.recordApiKeyAuthProvider(sanitizeAuthName(name), openApiSpecId, apiKeyIn, apiKeyName,
304307
operations))
308+
.setRuntimeInit()
305309
.unremovable()
306310
.done());
307311
}

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorCodeGenBase.java

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -473,23 +473,18 @@ private <T> Optional<T> getConfigKeyValues(final Config config, final Path openA
473473
Class<T> propertyType) {
474474

475475
Optional<String> possibleConfigKey = getConfigKeyValue(config, openApiFilePath);
476-
if (possibleConfigKey.isPresent()) {
477-
return getValuesByConfigKey(config, CodegenConfig.getSpecConfigNameByConfigKey(possibleConfigKey.get(), configName),
478-
propertyType, configName);
479-
}
476+
return possibleConfigKey
477+
.flatMap(s -> getValuesByConfigKey(config, CodegenConfig.getSpecConfigNameByConfigKey(s, configName),
478+
propertyType, configName));
480479

481-
return Optional.empty();
482480
}
483481

484482
private <K, V> Optional<Map<K, V>> getConfigKeyValues(final SmallRyeConfig config, final Path openApiFilePath,
485483
CodegenConfig.ConfigName configName,
486484
Class<K> kClass, Class<V> vClass) {
487485

488486
Optional<String> possibleConfigKey = getConfigKeyValue(config, openApiFilePath);
489-
if (possibleConfigKey.isPresent()) {
490-
return getValuesByConfigKey(config, configName, kClass, vClass, possibleConfigKey.get());
491-
}
487+
return possibleConfigKey.flatMap(s -> getValuesByConfigKey(config, configName, kClass, vClass, s));
492488

493-
return Optional.empty();
494489
}
495490
}

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/codegen/OpenApiGeneratorOutputPaths.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import java.nio.file.Path;
44
import java.util.ArrayList;
5-
import java.util.Arrays;
65
import java.util.Collection;
76
import java.util.Iterator;
87
import java.util.List;
@@ -12,7 +11,7 @@ public class OpenApiGeneratorOutputPaths {
1211
public static final String OPENAPI_PATH = "open-api";
1312
public static final String STREAM_PATH = "open-api-stream";
1413

15-
private static final Collection<String> rootPaths = Arrays.asList(STREAM_PATH);
14+
private static final Collection<String> rootPaths = List.of(STREAM_PATH);
1615

1716
public static Path getRelativePath(Path path) {
1817
List<String> paths = new ArrayList<>();

client/deployment/src/main/java/io/quarkiverse/openapi/generator/deployment/template/OpenApiNamespaceResolver.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package io.quarkiverse.openapi.generator.deployment.template;
22

3-
import java.io.File;
43
import java.lang.reflect.Method;
4+
import java.net.URI;
55
import java.nio.file.Path;
66
import java.util.ArrayList;
77
import java.util.Collections;
@@ -61,7 +61,7 @@ public boolean genDeprecatedApiAttr(final String pkg, final String classname,
6161

6262
@SuppressWarnings("unused")
6363
public String parseUri(String uri) {
64-
return OpenApiGeneratorOutputPaths.getRelativePath(Path.of(uri)).toString().replace(File.separatorChar, '/');
64+
return OpenApiGeneratorOutputPaths.getRelativePath(Path.of(URI.create(uri))).toString();
6565
}
6666

6767
@SuppressWarnings("unused")

0 commit comments

Comments
 (0)