From 74b860640276d4093b54c970891de8cf2633bbd5 Mon Sep 17 00:00:00 2001 From: Matheus Cruz Date: Wed, 21 Feb 2024 21:37:11 -0300 Subject: [PATCH] Update documentation --- .../ROOT/pages/includes/getting-started.adoc | 80 ++++++------------- 1 file changed, 25 insertions(+), 55 deletions(-) diff --git a/wiremock/docs/modules/ROOT/pages/includes/getting-started.adoc b/wiremock/docs/modules/ROOT/pages/includes/getting-started.adoc index ad38e537..95f4dd6d 100644 --- a/wiremock/docs/modules/ROOT/pages/includes/getting-started.adoc +++ b/wiremock/docs/modules/ROOT/pages/includes/getting-started.adoc @@ -1,66 +1,36 @@ The OpenAPI Generator Wiremock extensions maps OpenAPI specification and transform it into a https://wiremock.org/docs/stubbing/#bulk-importing-stubs[Bulk Importing Stubs] JSON file. -[[request-matching-section]] -== Request Matching +Add the following dependency to your project's `pom.xml` file: -To build the Wiremock https://wiremock.org/docs/request-matching/[Request Matching], this extension looks just to https://swagger.io/docs/specification/paths-and-operations/[Paths and Operations] OpenAPI fields. - -The OpenAPI path is converted to https://swagger.io/docs/specification/paths-and-operations/[path template] following the https://www.rfc-editor.org/rfc/rfc6570[RFC 6570] standard: -[source,yaml] ----- -paths: - /users/{userId}/cars/{carId}: +[source,xml] ---- - -Will be converted to: - -[source,json] + + io.quarkiverse.openapi.generator + quarkus-openapi-generator-wiremock + 3.0.0-SNAPSHOT + ---- -{ - "mappings": [ - { - "request": { - "urlPathTemplate": "/users/{userId}/cars/{cardId}" - } - } - ] -} ----- - -[[responses]] -== Responses - -This extension will get the first Response status code Operation. For example, if you have the following OpenAPI Response: -[source,yaml] ----- -responses: - "500": - description: "Internal Server Error" - "200": - description: "Ok" ----- +You will also need to add or update the `quarkus-maven-plugin` configuration with the following: -The extension will generate the following Wiremock Response templating: +WARNING: You probably already have this configuration if you created your application with https://code.quarkus.io/[Code Quarkus]. That said, double-check your configuration not to add another `plugin` entry. -[source,json] +[source,xml] ---- -{ - "response": { - "status": 200 - } -} + + io.quarkus + quarkus-maven-plugin + true + + + + build + generate-code + generate-code-tests + + + + ---- -NOTE: If your Response entry does not contain `content` the Wiremock Stub `$.response.body` will be ignored. - -[[media-type]] -== Media type - -IMPORTANT: This extension only supports `"application/json"` media type. - -[[schema-type]] - -For the first release, we chose to looks for the https://swagger.io/docs/specification/data-models/[Schema] `type` and supports only https://swagger.io/docs/specification/data-models/data-types/[Data Types] `object`, `string` and `integer` types. - -IMPORTANT: The root schema must have the type `object`. \ No newline at end of file +Now, create the directory `openapi` under your `src/main` path and add the OpenAPI spec files there. We support JSON, YAML and YML extensions.