|
| 1 | +:author: Martin Hauner |
| 2 | +:page-title: openapi-processor-json |
| 3 | +:page-layout: default |
| 4 | +:page-aliases: current@json:ROOT:index.adoc, latest@json:ROOT:index.adoc |
| 5 | +:badge-license: https://img.shields.io/badge/License-Apache%202.0-blue.svg?labelColor=313A42 |
| 6 | +:badge-ci: https://github.com/hauner/openapi-processor-json/workflows/ci/badge.svg |
| 7 | +:oapj-ci: https://github.com/hauner/openapi-processor-json/actions?query=workflow%3Aci |
| 8 | +:oapj-license: https://github.com/hauner/openapi-processor-json/blob/master/LICENSE |
| 9 | +:oap-gradle: https://github.com/hauner/openapi-processor-gradle |
| 10 | +:swagger-ui: https://swagger.io/tools/swagger-ui/ |
| 11 | +:openapi: https://www.openapis.org/ |
| 12 | + |
| 13 | +// |
| 14 | +// content |
| 15 | +// |
| 16 | +image:openapi-processor-json$$@$$1280x200.png[openapi-processor-json] |
| 17 | + |
| 18 | +// badges |
| 19 | +link:{oapj-ci}[image:{badge-ci}[]] |
| 20 | +link:{oapj-license}[image:{badge-license}[]] |
| 21 | + |
| 22 | + |
| 23 | +a simple link:{openapi}[OpenAPI] yaml to json converter. May be useful to feed the OpenAPI to an api viewer like |
| 24 | +link:{swagger-ui}[Swagger UI]. |
| 25 | + |
| 26 | + |
| 27 | +== Getting Started |
| 28 | + |
| 29 | +The link:{oap-gradle}[openapi-processor-gradle] gradle is the easiest way to use the yaml to json processor. |
| 30 | + |
| 31 | +== configuring gradle |
| 32 | + |
| 33 | +The gradle plugin will add an `openapiProcessor` configuration block that is used to configure the openapi processors. |
| 34 | +Configuration for a specific processor is going inside it with the processor name (in this case `json`) as the |
| 35 | +configuration block name. |
| 36 | + |
| 37 | +[source,groovy] |
| 38 | +---- |
| 39 | +openapiProcessor { |
| 40 | +
|
| 41 | + json { |
| 42 | + processor 'com.github.hauner.openapi:openapi-processor-json:1.0.0.M3' |
| 43 | +
|
| 44 | + apiPath = "$projectDir/src/api/openapi.yaml" |
| 45 | + targetDir = "$projectDir/build/openapi" |
| 46 | + } |
| 47 | +
|
| 48 | +} |
| 49 | +---- |
| 50 | + |
| 51 | +- `apiPath`: (**required**) the path to the `openapi.yaml` file and the main input for the processor. |
| 52 | + |
| 53 | +- `targetDir`: (**required**) the output folder for generating the `openapi.json` file. |
| 54 | + |
| 55 | +== Samples |
| 56 | + |
| 57 | +See xref:spring-mvc-sample:ROOT:index.adoc[spring mvc sample] or |
| 58 | +xref:spring-webflux-sample:ROOT:index.adoc[spring webflux sample] for a complete working spring boot sample with a |
| 59 | +minimal openapi.yaml. |
0 commit comments