Skip to content

Commit 5d8beb2

Browse files
committed
improve grammar & text
1 parent e2281b2 commit 5d8beb2

29 files changed

+236
-327
lines changed

docs/modules/ROOT/pages/gradle.adoc

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
= Gradle Plugin
22
include::partial$links.adoc[]
33

4-
The xref:gradle::index.adoc[openapi-processor-gradle] is currently the only tool to run any of the
5-
**openapi-processor**'s.
4+
The xref:gradle::index.adoc[openapi-processor-gradle] gradle plugin can run any of the **openapi-processor**'s.
65
7-
To use it in a gradle project the gradle file of the project requires a few additional instructions.
8-
The following sections describe how to activate & configure **openapi-processor-spring** in a
9-
`build.gradle` file.
6+
To use it in a Gradle project, the Gradle file of the project requires a few additional instructions. The following sections describe how to activate & configure **openapi-processor-spring** in a `build.gradle` file.
107
118
129
== adding the plugin
@@ -41,33 +38,24 @@ openapiProcessor {
4138
}
4239
----
4340

44-
* `processor`: (**required**) the processor dependency. This works in the same way as adding a
45-
dependency to a configuration in the gradle `dependencies` block. It is given here to avoid
46-
un-wanted side effects on the build dependencies of the project.
41+
* `processor`: (**required**) the processor dependency. This works in the same way as adding a dependency to a configuration in the gradle `dependencies` block. It is given here to avoid unwanted side effects on the build dependencies of the project.
4742

48-
* `apiPath`: (**required**) the path to the `openapi.yaml` file and the main input for the
49-
processor. If set in the top-level block it will be used for all configured processors.
43+
* `apiPath`: (**required**) the path to the `openapi.yaml` file and the main input for the processor. If set in the top-level block, it will be used for all configured processors.
5044

51-
* `targetDir`: (**required**) the output folder for generating interfaces & models. This is the
52-
parent of the `packageName` folder tree. It is recommended to set this to a subfolder of gradle's
53-
standard `build` directory, so it is cleared by the `clean` task and does not pollute the `sources`
45+
* `targetDir`: (**required**) the output folder for generating interfaces and models. This is the parent of the `packageName` folder tree. It is recommended to set this to a subfolder of gradle's standard `build` directory, so it is cleared by the `clean` task and does not pollute the `sources`
5446
directory.
5547
+
56-
See <<running processor-spring>> how to include the `targetDir` in compilation & packing.
48+
See <<running processor-spring>> how to include the `targetDir` in compilation and packing.
5749

58-
* `mapping`: (**required**) provides the processor mapping options. This is a path
59-
to yaml file. See xref:processor/configuration.adoc[Configuration] for a description of the mapping
60-
yaml. This replaces the `typeMappings` option.
50+
* `mapping`: (**required**) provides the processor mapping options. This is a path to the YAML file. See xref:processor/configuration.adoc[Configuration] for a description of the mapping YAML. This replaces the `typeMappings` option.
6151

62-
* `showWarnings`: (**optional**) `true` to show warnings from the open api parser or `false`
63-
(default) to show no warnings (this option has currently no effect).
52+
* `showWarnings`: (**optional**) `true` to show warnings from the open api parser or `false` (default) to show no warnings (this option has currently no effect).
6453

65-
* `parser`: (**optional**), sets the openapi parser used to read the OpenAPI description. Available values are `SWAGGER` (default), `OPENAPI4J` or `INTERNAL`.
66-
** `SWAGGER`: link:{swagger-parser}[Swagger OpenAPI parser, window="_blank"], supports *OpenAPI 3.0.x*
67-
** `OPENAPI4J`: link:{openapi4j}[openapi4j OpenAPI parser, window="_blank"], supports *OpenAPI 3.0.x*. It provides better validation than `SWAGGER`, unfortunately it is no longer maintained.
54+
* `parser`: (**optional**), sets the openapi parser used to read the OpenAPI description. Available values are `SWAGGER`, `OPENAPI4J` or `INTERNAL` (default).
6855
** `INTERNAL`: link:{openapi-parser}[internal OpenAPI parser, window="_blank"], supports *OpenAPI 3.0.x* & *OpenAPI 3.1.0*.
69-
*** the 3.0.x parser provides JSON schema validation.
70-
*** the 3.1.0 parser is *experimental* and has no validation at the moment.
56+
** `SWAGGER`: link:{swagger-parser}[Swagger OpenAPI parser, window="_blank"], supports *OpenAPI 3.0.x*
57+
** `OPENAPI4J`: link:{openapi4j}[openapi4j OpenAPI parser, window="_blank"], supports *OpenAPI 3.0.x*. It provides better validation than `SWAGGER`, unfortunately it is no longer maintained and is deprecated.
58+
*** the parser provides JSON schema validation.
7159

7260
== running processor-spring
7361

@@ -89,14 +77,12 @@ sourceSets {
8977
}
9078
----
9179

92-
* and the `compileJava` task gets a dependency on `processSpring`, so it runs before compilation
93-
(again, assuming a java project):
80+
* and the `compileJava` task gets a dependency on `processSpring`, so it runs before compilation (again, assuming a java project):
9481
+
9582
[source,groovy]
9683
----
9784
// generate api before compiling
9885
compileJava.dependsOn ('processSpring')
9986
----
10087

101-
Adding automatic compilation in this way will also automatically include the generated files into the
102-
`jar` build artifact.
88+
Adding automatic compilation in this way will also automatically include the generated files into the `jar` build artifact.

docs/modules/ROOT/pages/index.adoc

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,38 @@ link:{oaps-license}[image:{badge-license}[]]
1414
link:{oap-central}[image:{badge-central}[]]
1515

1616

17-
*openapi-processor-spring* is an link:{openapi}[OpenAPI] interface & dto java code generator
18-
for link:{springboot}[Spring Boot].
17+
*openapi-processor-spring* is an link:{openapi}[OpenAPI] interface & dto java code generator for link:{springboot}[Spring Boot].
1918

20-
It supports an approach where you explicitly define and document your Service API (using OpenAPI)
21-
with the Interface to the outside and its usage in mind before you implement it. You do not derive
22-
the API later from the implementation and its implicit design. (of course, adapt as you go...)
19+
It supports an approach where you explicitly define and document your Service API (using OpenAPI)with the Interface to the outside and its usage in mind before you implement it. You do not derive the API later from the implementation and its implicit design. (of course, adapt as you go...)
2320

2421
The advantages are:
2522

26-
* you have a single place to maintain the api which makes it easier to create a consistent api
27-
and keep the overview.
28-
* it is easy to document in plain text. You can use markdown in the OpenAPI `description`
29-
properties.
23+
* you have a single place to maintain the api which makes it easier to create a consistent api and keep the overview.
24+
* it is easy to document in plain text. You can use Markdown in the OpenAPI `description` properties.
3025
31-
The processor generates java interfaces based on the endpoint description of the API and simple POJO classes or records for parameter or response schemas defined in the API. The processor adds all the required spring & jackson annotations to the interface and all that is left to *you* is the implementation of the generated interfaces in any way you like.
26+
The processor generates java interfaces based on the endpoint description of the API and simple POJO classes or records for parameter or response schemas defined in the API. The processor adds all the required spring & jackson annotations to the interface, and all that is left to *you* is the implementation of the generated interfaces in any way you like.
3227

33-
The interfaces will help to keep the implementation in sync with the API. If anything relevant
34-
changes in the API the interface changes and the compiler will warn that the interface is not
35-
implemented correctly.
28+
The interfaces will help to keep the implementation in sync with the API. If anything relevant changes in the API, the interface changes and the compiler will warn that the interface is not implemented correctly.
3629

37-
The target programming language is Java so the generated code is usable from most JVM languages.
30+
The target programming language is Java. Therefore, the generated code is usable from most JVM languages.
3831

3932
See the xref:processor/index.adoc[processor intro] for a short example.
4033

4134
== Playground
4235

43-
openapi-processor has a link:{oap-playground}[playground, window="_blank"] application. You can try
44-
out some samples, or your own yaml and view the code that the processor generates.
36+
openapi-processor has a link:{oap-playground}[playground, window="_blank"] application. You can try out some samples or your own YAML and view the code that the processor generates.
4537

4638
== Features
4739

4840
- generates **only java interfaces and java dto classes** (get/set POJOs or records) for all defined endpoints and schemas to allow full control of the endpoint implementation. It does not generate any other file. See xref:processor/index.adoc[processor].
4941

5042
- **powerful type mappings with generic support** to map schemas defined in the openapi.yaml to existing java types.
5143
+
52-
For example to map the openapi `array` type to a different java collections or to map paging parameters and results to th Spring types like `Page<>` & `Pageable`.
44+
For example, to map the openapi `array` type to a different java collection or to map paging parameters and results to th Spring types like `Page<>` & `Pageable`.
5345
+
5446
mappings can be defined globally, for a specific response, parameter or endpoint and or http method (of an endpoint). See xref:mapping/index.adoc[type mapping].
5547

56-
- Annotation based **WebFlux support**. Actually there is *no* explicit WebFlux support, but the mapping allows defining a *single*, and a *multi* wrapper class. *single* wraps non-array like result types(e.g. `Mono<>`). *multi* replaces array like result types or parameters with the given multi mapping. For example, it will replace `List<String>` with `Flux<String>` if the multi mapping contains the fully qualified `Flux` type. +
48+
- Annotation-based **WebFlux support**. Actually, there is *no* explicit WebFlux support, but the mapping allows defining a *single*, and a *multi* wrapper class. *single* wraps non-array like result types(e.g. `Mono<>`). *multi* replaces array like result types or parameters with the given multi mapping. For example, it will replace `List<String>` with `Flux<String>` if the multi mapping contains the fully qualified `Flux` type. +
5749
//[.badge .badge-since]+since 1.0.0.M13+
5850

5951
- generates **human-readable code**.
@@ -73,7 +65,7 @@ correct code for an endpoint. That way the processor can still be used for all t
7365
//[.badge .badge-since]+since 1.0.0.M11+
7466

7567
- the generated code does not use swagger annotations. There is no need to generate the
76-
documentation from the code when the code originates from the documentation (i.e. an openapi.yaml).
68+
documentation from the code when the code originates from the documentation (i.e., an openapi.yaml).
7769

7870
- *maven & gradle support* The plugin docs show how to run a processor and how to add the generated sources to the build.
7971

@@ -92,11 +84,9 @@ artifact name is:
9284

9385
== Feedback
9486

95-
In case some feature is missing, or the generated code is not 100% what you would expect create an
96-
link:{oaps-issues}[issue]. Preferably with a test case. Providing a test case will help
97-
significantly :-)
87+
In case some feature is missing, or the generated code is not 100% what you would expect, create an link:{oaps-issues}[issue]. Preferably with a test case. Providing a test case will help significantly. :-)
9888

99-
A _perfect_ test case is a single folder with two sub folders containing the source files, and the expected output files:
89+
A _perfect_ test case is a single folder with two subfolders containing the source files and the expected output files:
10090

10191
my-test-case
10292
+--- inputs.yaml

docs/modules/ROOT/pages/mapping/basic.adoc

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
= Basic (primitive) mappings
22
include::partial$links.adoc[]
33

4-
The OpenAPI specification defines a couple of basic link:{openapi-spec-types}[data types]. The
5-
basic data types are built-in into the processor. That means it will map the basic types
6-
automatically to a corresponding java type. There is no explicit type mapping required.
4+
The OpenAPI specification defines a couple of basic link:{openapi-spec-types}[data types]. The basic data types are built-in into the processor. That means it will map the basic types automatically to a corresponding java type. There is no explicit type mapping required.
75

86
The types with no default mapping can be mapped to a java type using the mapping configuration.
97

docs/modules/ROOT/pages/mapping/endpoint.adoc

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
include::partial$links.adoc[]
33
include::partial$vars.adoc[]
44

5-
The global mapping variations are also available as explicit endpoint mappings. Instead of adding
6-
the mapping in the global sections `map/types`, `map/parameters` and `map/responses` they can
7-
be placed in the `map/paths` section as properties to an endpoint given by its path.
5+
The global mapping variations are also available as explicit endpoint mappings. Instead of adding the mapping in the global sections `map/types`, `map/parameters` and `map/responses` they can be placed in the `map/paths` section as properties to an endpoint given by its path.
86

97
[source,yaml]
108
----
@@ -16,20 +14,20 @@ map:
1614
# a path
1715
/foo:
1816
19-
# path specific result wrapper
17+
# path-specific result wrapper
2018
result: {target type}
2119
22-
# path specific single wrapper
20+
# path-specific single wrapper
2321
single: {target type}
2422
25-
# path specific multi wrapper
23+
# path-specific multi wrapper
2624
multi: {target type}
2725
28-
# list of path specific mappings
26+
# list of path-specific mappings
2927
types:
3028
- from: {source type} => {target type}
3129
32-
# list of path specific parameter mappings, mapped by parameter name
30+
# list of path-specific parameter mappings, mapped by parameter name
3331
parameters:
3432
- name: {parameter name} => {target type}
3533
@@ -39,7 +37,7 @@ map:
3937
# add an extra annotation to parameters of type source type
4038
- type: {source type} @ {annotation type}
4139
42-
# list of path specific content mappings, mapped by content type
40+
# list of path-specific content mappings, mapped by content type
4341
responses:
4442
- content: {content type} => {target type}
4543
@@ -48,30 +46,30 @@ map:
4846
# excluding an endpoint
4947
exclude: true
5048
51-
# path specific result wrapper
49+
# path-specific result wrapper
5250
result: {target type}
5351
54-
# path specific single wrapper
52+
# path-specific single wrapper
5553
single: {target type}
5654
57-
# path specific multi wrapper
55+
# path-specific multi wrapper
5856
multi: {target type}
5957
60-
# list of path specific mappings
58+
# list of path-specific mappings
6159
types:
6260
- from: {source type} => {target type}
6361
64-
# list of path specific parameter mappings, mapped by parameter name
62+
# list of path-specific parameter mappings, mapped by parameter name
6563
parameters:
6664
- name: {parameter name} => {target type}
6765
68-
# add a (usually technical) parameter that is not described in the OpenAPI
66+
# add a (usually technical) parameter not described in the OpenAPI
6967
- add: {parameter name} => {target type}
7068
7169
# add an extra annotation to parameters of type source type
7270
- type: {source type} @ {annotation type}
7371
74-
# list of path specific content mappings, mapped by content type
72+
# list of path-specific content mappings, mapped by content type
7573
responses:
7674
- content: {content type} => {target type}
7775
----
@@ -81,7 +79,7 @@ have any effect on other endpoints.
8179

8280
== Endpoint mappings by http method
8381

84-
It is possible to add mappings that apply only to a specific http method. Motivation for this is limiting the mapping only to the place where it is needed. Http method mappings have priority over other mappings. In general, the most specific mapping is used.
82+
It is possible to add mappings that apply only to a specific http method. The motivation for this is limiting the mapping only to the place where it is necessary. Http method mappings have priority over other mappings. In general, the most specific mapping is used.
8583

8684
Here are a few examples of possible http endpoint mappings:
8785

docs/modules/ROOT/pages/mapping/extension.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ map:
4343
- listB @ io.oap.FooC
4444
----
4545

46-
NOTE: openapi-processor will only recognize *strings* values of an extension. It will ignore any other type.
46+
NOTE: openapi-processor will only recognize *string* values of an extension. It will ignore any other type.
4747

4848
The mapping allows two variations:
4949

0 commit comments

Comments
 (0)