Skip to content

Commit 8f92b85

Browse files
committed
WFLY-21302 QS: microprofile-openapi quickstart needs to be updated with changes in WF
Signed-off-by: Radoslav Husar <radosoft@gmail.com>
1 parent bbab2a0 commit 8f92b85

2 files changed

Lines changed: 44 additions & 37 deletions

File tree

microprofile-openapi/README-source.adoc

Lines changed: 42 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,77 +42,84 @@ Run following command in your terminal:
4242
$ curl http://localhost:8080/openapi
4343
----
4444

45-
It should return a YAML document conforming to the http://spec.openapis.org/oas/v3.0.3[OpenAPI specification]:
45+
It should return a YAML document conforming to the https://spec.openapis.org/oas/v3.1.0[OpenAPI specification]:
4646

4747
[source, yaml]
4848
----
49-
openapi: 3.0.1
49+
components:
50+
schemas:
51+
Fruit:
52+
type: object
53+
properties:
54+
name:
55+
type: string
56+
description:
57+
type: string
58+
externalDocs: {}
5059
info:
51-
title: Store inventory
60+
contact: {}
5261
description: Application for tracking store inventory
62+
license: {}
63+
title: Store inventory
5364
version: "1.0"
54-
servers:
55-
- url: /microprofile-openapi
65+
openapi: 3.1.0
5666
paths:
57-
/:
67+
/microprofile-openapi/:
5868
get:
5969
responses:
6070
"200":
61-
description: OK
6271
content:
6372
text/plain:
6473
schema:
6574
type: string
66-
/fruit:
67-
get:
68-
responses:
69-
"200":
7075
description: OK
71-
content:
72-
application/json:
73-
schema:
74-
type: array
75-
items:
76-
$ref: '#/components/schemas/Fruit'
77-
post:
76+
/microprofile-openapi/fruit:
77+
delete:
7878
requestBody:
7979
content:
8080
application/json:
8181
schema:
82-
$ref: '#/components/schemas/Fruit'
82+
$ref: "#/components/schemas/Fruit"
83+
required: true
8384
responses:
8485
"200":
85-
description: OK
8686
content:
8787
application/json:
8888
schema:
89+
items:
90+
$ref: "#/components/schemas/Fruit"
8991
type: array
92+
uniqueItems: true
93+
description: OK
94+
get:
95+
responses:
96+
"200":
97+
content:
98+
application/json:
99+
schema:
90100
items:
91-
$ref: '#/components/schemas/Fruit'
92-
delete:
101+
$ref: "#/components/schemas/Fruit"
102+
type: array
103+
uniqueItems: true
104+
description: OK
105+
post:
93106
requestBody:
94107
content:
95108
application/json:
96109
schema:
97-
$ref: '#/components/schemas/Fruit'
110+
$ref: "#/components/schemas/Fruit"
111+
required: true
98112
responses:
99113
"200":
100-
description: OK
101114
content:
102115
application/json:
103116
schema:
104-
type: array
105117
items:
106-
$ref: '#/components/schemas/Fruit'
107-
components:
108-
schemas:
109-
Fruit:
110-
type: object
111-
properties:
112-
description:
113-
type: string
114-
name:
115-
type: string
118+
$ref: "#/components/schemas/Fruit"
119+
type: array
120+
uniqueItems: true
121+
description: OK
122+
servers: []
116123
----
117124

118125
=== Enhance OpenAPI documentation with annotations

microprofile-openapi/src/test/java/org/wildfly/quickstart/microprofile/openapi/OpenAPIContextIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.net.http.HttpRequest;
1515
import java.net.http.HttpResponse;
1616
import java.time.Duration;
17+
import java.util.Arrays;
1718

1819
import org.junit.Test;
1920

@@ -47,9 +48,8 @@ public void testOpenAPIContextIsAvailable() throws IOException, InterruptedExcep
4748
final HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
4849
assertEquals("/openapi context is not available", 200, response.statusCode());
4950

50-
// First line are just dashes, so lets check the second line with OpenAPI version key for the prefix
5151
String[] bodyLines = response.body().split("\n");
52-
assertTrue(bodyLines[1].startsWith("openapi:"));
52+
assertTrue("Document does not contain \"openapi:\" field", Arrays.stream(bodyLines).anyMatch(line -> line.startsWith("openapi:")));
5353
}
5454

5555
}

0 commit comments

Comments
 (0)