Skip to content

Commit 3caee26

Browse files
Fix path generate (#884) (#894)
* fix path generate * integration tests * Update application.properties Co-authored-by: yuhaibohotmail <[email protected]>
1 parent bae9599 commit 3caee26

File tree

7 files changed

+416
-1
lines changed

7 files changed

+416
-1
lines changed

client/deployment/src/main/resources/templates/libraries/microprofile/api.qute

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public interface {classname} {
4343
@io.quarkiverse.openapi.generator.markers.OperationMarker(name="{defaultSecurityScheme}", openApiSpecId="{quarkus-generator.openApiSpecId}", operationId="{op.operationId}", method="{op.httpMethod}", path="{contextPath}{commonPath}{op.path.orEmpty}")
4444
{/if}
4545
@jakarta.ws.rs.{op.httpMethod}
46-
{#if op.subresourceOperation}
46+
{#if op.subresourceOperation || op.path eq '/'}
4747
@jakarta.ws.rs.Path("{op.path}")
4848
{/if}
4949
{#if op.hasConsumes}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>io.quarkiverse.openapi.generator</groupId>
6+
<artifactId>quarkus-openapi-generator-integration-tests</artifactId>
7+
<version>3.0.0-SNAPSHOT</version>
8+
</parent>
9+
10+
<artifactId>quarkus-openapi-generator-it-path</artifactId>
11+
<name>Quarkus - Openapi Generator - Integration Tests - Client - path</name>
12+
<description>Test from path</description>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>io.quarkiverse.openapi.generator</groupId>
17+
<artifactId>quarkus-openapi-generator</artifactId>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.assertj</groupId>
21+
<artifactId>assertj-core</artifactId>
22+
<scope>test</scope>
23+
</dependency>
24+
<dependency>
25+
<groupId>io.quarkus</groupId>
26+
<artifactId>quarkus-junit5</artifactId>
27+
<scope>test</scope>
28+
</dependency>
29+
</dependencies>
30+
31+
<build>
32+
<plugins>
33+
<plugin>
34+
<groupId>io.quarkus</groupId>
35+
<artifactId>quarkus-maven-plugin</artifactId>
36+
<extensions>true</extensions>
37+
<executions>
38+
<execution>
39+
<goals>
40+
<goal>build</goal>
41+
<goal>generate-code</goal>
42+
<goal>generate-code-tests</goal>
43+
</goals>
44+
</execution>
45+
</executions>
46+
</plugin>
47+
</plugins>
48+
</build>
49+
<profiles>
50+
<profile>
51+
<id>native-image</id>
52+
<activation>
53+
<property>
54+
<name>native</name>
55+
</property>
56+
</activation>
57+
<build>
58+
<plugins>
59+
<plugin>
60+
<artifactId>maven-surefire-plugin</artifactId>
61+
<configuration>
62+
<skipTests>${native.surefire.skip}</skipTests>
63+
</configuration>
64+
</plugin>
65+
<plugin>
66+
<artifactId>maven-failsafe-plugin</artifactId>
67+
<executions>
68+
<execution>
69+
<goals>
70+
<goal>integration-test</goal>
71+
<goal>verify</goal>
72+
</goals>
73+
<configuration>
74+
<systemPropertyVariables>
75+
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
76+
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
77+
<maven.home>${maven.home}</maven.home>
78+
</systemPropertyVariables>
79+
</configuration>
80+
</execution>
81+
</executions>
82+
</plugin>
83+
</plugins>
84+
</build>
85+
<properties>
86+
<quarkus.package.type>native</quarkus.package.type>
87+
</properties>
88+
</profile>
89+
</profiles>
90+
91+
</project>
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
openapi: 3.0.3
3+
info:
4+
title: code-with-quarkus API
5+
version: 1.0.0-SNAPSHOT
6+
servers:
7+
- url: http://localhost:8080
8+
description: Auto generated value
9+
- url: http://0.0.0.0:8080
10+
description: Auto generated value
11+
paths:
12+
/users/:
13+
get:
14+
tags:
15+
- User Resource
16+
description: Find All
17+
operationId: UserResource_findAll
18+
responses:
19+
"200":
20+
description: OK
21+
content:
22+
application/json:
23+
schema:
24+
type: array
25+
items:
26+
$ref: "#/components/schemas/User"
27+
post:
28+
tags:
29+
- User Resource
30+
description: Add
31+
operationId: UserResource_add
32+
requestBody:
33+
content:
34+
application/json:
35+
schema:
36+
$ref: "#/components/schemas/User"
37+
responses:
38+
"200":
39+
description: OK
40+
content:
41+
application/json:
42+
schema:
43+
$ref: "#/components/schemas/User"
44+
/users/{id}:
45+
get:
46+
tags:
47+
- User Resource
48+
description: Find
49+
operationId: UserResource_find
50+
parameters:
51+
- name: id
52+
in: path
53+
required: true
54+
schema:
55+
format: int32
56+
type: integer
57+
responses:
58+
"200":
59+
description: OK
60+
content:
61+
application/json:
62+
schema:
63+
$ref: "#/components/schemas/User"
64+
put:
65+
tags:
66+
- User Resource
67+
description: Update
68+
operationId: UserResource_update
69+
parameters:
70+
- name: id
71+
in: path
72+
required: true
73+
schema:
74+
format: int32
75+
type: integer
76+
requestBody:
77+
content:
78+
application/json:
79+
schema:
80+
$ref: "#/components/schemas/User"
81+
responses:
82+
"204":
83+
description: No Content
84+
delete:
85+
tags:
86+
- User Resource
87+
description: Delete
88+
operationId: UserResource_delete
89+
parameters:
90+
- name: id
91+
in: path
92+
required: true
93+
schema:
94+
format: int32
95+
type: integer
96+
responses:
97+
"204":
98+
description: No Content
99+
components:
100+
schemas:
101+
User:
102+
type: object
103+
properties:
104+
id:
105+
format: int32
106+
type: integer
107+
name:
108+
type: string
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
---
2+
openapi: 3.0.3
3+
info:
4+
title: code-with-quarkus API
5+
version: 1.0.0-SNAPSHOT
6+
servers:
7+
- url: http://localhost:8080
8+
description: Auto generated value
9+
- url: http://0.0.0.0:8080
10+
description: Auto generated value
11+
paths:
12+
/users:
13+
get:
14+
tags:
15+
- User Resource
16+
description: Find All
17+
operationId: UserResource_findAll
18+
responses:
19+
"200":
20+
description: OK
21+
content:
22+
application/json:
23+
schema:
24+
type: array
25+
items:
26+
$ref: "#/components/schemas/User"
27+
post:
28+
tags:
29+
- User Resource
30+
description: Add
31+
operationId: UserResource_add
32+
requestBody:
33+
content:
34+
application/json:
35+
schema:
36+
$ref: "#/components/schemas/User"
37+
responses:
38+
"200":
39+
description: OK
40+
content:
41+
application/json:
42+
schema:
43+
$ref: "#/components/schemas/User"
44+
/users/{id}:
45+
get:
46+
tags:
47+
- User Resource
48+
description: Find
49+
operationId: UserResource_find
50+
parameters:
51+
- name: id
52+
in: path
53+
required: true
54+
schema:
55+
format: int32
56+
type: integer
57+
responses:
58+
"200":
59+
description: OK
60+
content:
61+
application/json:
62+
schema:
63+
$ref: "#/components/schemas/User"
64+
put:
65+
tags:
66+
- User Resource
67+
description: Update
68+
operationId: UserResource_update
69+
parameters:
70+
- name: id
71+
in: path
72+
required: true
73+
schema:
74+
format: int32
75+
type: integer
76+
requestBody:
77+
content:
78+
application/json:
79+
schema:
80+
$ref: "#/components/schemas/User"
81+
responses:
82+
"204":
83+
description: No Content
84+
delete:
85+
tags:
86+
- User Resource
87+
description: Delete
88+
operationId: UserResource_delete
89+
parameters:
90+
- name: id
91+
in: path
92+
required: true
93+
schema:
94+
format: int32
95+
type: integer
96+
responses:
97+
"204":
98+
description: No Content
99+
components:
100+
schemas:
101+
User:
102+
type: object
103+
properties:
104+
id:
105+
format: int32
106+
type: integer
107+
name:
108+
type: string
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
quarkus.rest-client.quarkus_simple_openapi_yaml.url=http://localhost:8080

0 commit comments

Comments
 (0)