Skip to content

Commit

Permalink
Add configuration for tags, operationId etc.
Browse files Browse the repository at this point in the history
  • Loading branch information
pe-st committed Nov 26, 2023
1 parent b8aee96 commit 44fbcb4
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Smallrye-specific options
mp.openapi.extensions.smallrye.operationIdStrategy=METHOD

# keep /openapi instead /q/openapi for the time being
# see https://quarkus.io/blog/path-resolution-in-quarkus/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ info:
paths:
/api/txproc/pincheck:
post:
operationId: pinCheck
requestBody:
content:
application/json:
Expand All @@ -25,6 +26,7 @@ paths:
- Tx Proc
/api/txproc/purchase:
post:
operationId: purchase
requestBody:
content:
application/json:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"post" : {
"tags" : [ "Tx Proc" ],
"summary" : "Check the pin",
"operationId" : "pinCheck",
"requestBody" : {
"description" : "PIN Check Request Body",
"content" : {
Expand Down Expand Up @@ -38,6 +39,7 @@
"post" : {
"tags" : [ "Tx Proc" ],
"summary" : "Authorize a Purchase",
"operationId" : "purchase",
"requestBody" : {
"description" : "Purchase Request Body",
"content" : {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ paths:
tags:
- Tx Proc
summary: Check the pin
operationId: pinCheck
requestBody:
description: PIN Check Request Body
content:
Expand All @@ -28,6 +29,7 @@ paths:
tags:
- Tx Proc
summary: Authorize a Purchase
operationId: purchase
requestBody:
description: Purchase Request Body
content:
Expand Down
1 change: 1 addition & 0 deletions code-first-swagger/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
<package>ch.schlau.pesche.apidocs.swagger.codefirst</package>
</resourcePackages>
<prettyPrint>true</prettyPrint>
<alwaysResolveAppPath>true</alwaysResolveAppPath>
</configuration>
<executions>
<execution>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class TxProc {

@Path("/pincheck")
@POST
@Operation(summary = "Check the pin")
@Operation(summary = "Check the pin",
tags = {"Tx Proc"})
@ApiResponse(description = "PIN Check Response",
content = @Content(schema = @Schema(implementation = PinCheckResponse.class)))
public PinCheckResponse pinCheck(
Expand All @@ -48,7 +49,8 @@ public PinCheckResponse pinCheck(

@Path("/purchase")
@POST
@Operation(summary = "Authorize a Purchase")
@Operation(summary = "Authorize a Purchase",
tags = {"Tx Proc"})
@ApiResponse(description = "Purchase Response",
content = @Content(schema = @Schema(implementation = PurchaseAuthResponse.class)))
public PurchaseAuthResponse purchase(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ void openapi_yaml() throws IOException {
String yamlSorted = sortYaml(document);

assertAll("openapi yaml"
// the unsorted document generated by Swagger has no deterministic order
// , () -> assertThat("unsorted", document, is(expected))
, () -> assertThat("unsorted", document, is(expected))
, () -> assertThat("sorted", yamlSorted, is(expectedSorted))
);
}
Expand Down
8 changes: 6 additions & 2 deletions code-first-swagger/src/test/resources/openapi-sorted.yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ info:
title: txproc-code-first-swagger
version: 0.9
paths:
/txproc/pincheck:
/api/txproc/pincheck:
post:
operationId: pinCheck
requestBody:
Expand All @@ -22,7 +22,9 @@ paths:
$ref: '#/components/schemas/PinCheckResponse'
description: PIN Check Response
summary: Check the pin
/txproc/purchase:
tags:
- Tx Proc
/api/txproc/purchase:
post:
operationId: purchase
requestBody:
Expand All @@ -40,6 +42,8 @@ paths:
$ref: '#/components/schemas/PurchaseAuthResponse'
description: Purchase Response
summary: Authorize a Purchase
tags:
- Tx Proc
components:
schemas:
EmvTags:
Expand Down
6 changes: 4 additions & 2 deletions code-first-swagger/src/test/resources/openapi.json.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
"version" : "0.9"
},
"paths" : {
"/txproc/pincheck" : {
"/api/txproc/pincheck" : {
"post" : {
"tags" : [ "Tx Proc" ],
"summary" : "Check the pin",
"operationId" : "pinCheck",
"requestBody" : {
Expand Down Expand Up @@ -34,8 +35,9 @@
}
}
},
"/txproc/purchase" : {
"/api/txproc/purchase" : {
"post" : {
"tags" : [ "Tx Proc" ],
"summary" : "Authorize a Purchase",
"operationId" : "purchase",
"requestBody" : {
Expand Down
12 changes: 8 additions & 4 deletions code-first-swagger/src/test/resources/openapi.yaml.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ info:
title: txproc-code-first-swagger
version: "0.9"
paths:
/txproc/pincheck:
/api/txproc/pincheck:
post:
tags:
- Tx Proc
summary: Check the pin
operationId: pinCheck
requestBody:
Expand All @@ -22,8 +24,10 @@ paths:
application/json:
schema:
$ref: '#/components/schemas/PinCheckResponse'
/txproc/purchase:
/api/txproc/purchase:
post:
tags:
- Tx Proc
summary: Authorize a Purchase
operationId: purchase
requestBody:
Expand Down Expand Up @@ -65,8 +69,8 @@ components:
type: object
properties:
uuid:
description: Unique ID of the request
format: uuid
description: Unique ID of the request
type: string
pan:
title: PAN (Primary Account Number)
Expand Down Expand Up @@ -111,8 +115,8 @@ components:
type: object
properties:
uuid:
description: Unique ID of the request
format: uuid
description: Unique ID of the request
type: string
pan:
title: PAN (Primary Account Number)
Expand Down

0 comments on commit 44fbcb4

Please sign in to comment.