Skip to content

Commit

Permalink
Set extension as experimental and handle possible number format error
Browse files Browse the repository at this point in the history
  • Loading branch information
mcruzdev committed Feb 22, 2024
1 parent 74b8606 commit 57f8fc9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ private static String generateResponseBody(final Schema<?> schema) {

/**
* This method attempts to retrieve the first status code defined in the {@link Operation} object.
* If the OpenAPI response contains only the "default" status code, this method will return
* Whether the OpenAPI response contains only the "default" status code, this method will return
* {@link OpenApi2WiremockMapper#DEFAULT_STATUS_CODE}.
* If the OpenAPI response contains more than one status code, the method returns the first one.
* Whether the OpenAPI response contains more than one status code, the method returns the first one.
* For example, if the status codes are "200" and after "400", this method will return the status "200".
*
* @param operation The {@link Operation} instance from which to extract the status code.
Expand All @@ -145,10 +145,15 @@ private static int getStatusCode(final Operation operation) {
.getKey();

if (statusCode.contentEquals(defaultStatus)) {
return OpenApi2WiremockMapper.DEFAULT_STATUS_CODE;
return DEFAULT_STATUS_CODE;
}

return Integer.parseInt(statusCode);
try {
return Integer.parseInt(statusCode);
} catch (NumberFormatException e) {
throw new IllegalArgumentException(
String.format("Was not possible to parse the status code '%s' from OpenAPI Operation", statusCode));
}
}

public String getComponentName(final String $ref) {
Expand Down
2 changes: 1 addition & 1 deletion wiremock/docs/modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Quarkus - Openapi Generator - Wiremock
:extension-status: preview
:extension-status: experimental


WARNING: This is the instructions for the latest SNAPSHOT version (main branch). Please, see the https://docs.quarkiverse.io/quarkus-openapi-generator/dev/index.html[latest **released** documentation] if you are looking for instructions.
Expand Down
3 changes: 2 additions & 1 deletion wiremock/runtime/src/main/resources/quarkus-extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ metadata:
- "wiremock"
categories:
- "web"
status: "preview"
status: "experimental"
guide: "https://docs.quarkiverse.io/quarkus-openapi-generator/dev"

0 comments on commit 57f8fc9

Please sign in to comment.