Skip to content

Commit f03458d

Browse files
pburlsPatrick.Burls
andauthored
Add new Plantuml generator for creating a schema diagram (#6255)
* add scaffolded new documentation generator files * add openapi3 plantuml bin scripts * change plantuml codegen to only generate a schemas.plantuml file * initial plantuml schema diagram * add item type to Lists * add inheritance relationships * add list one-to-many relationships * add newline between model definitions and relationships * add composition data type relationship * remove allOf models and interface references * add new entities data to SupportingFileData * add List dataType support to entity fields * remove composed types and remove allOf suffix from inline types * add inheritances to supporting files data object * add aggregation relationships to supporting file data * add isList to compisition relationships * refactor PlantumlDocumentationCodegenTest * add property name to relationships * remove old code form PlantumlDocumentationCodegen * add plantuml generator sample output * remove use of javafx.util.Pair * fix casing of complex data type for fields * add plantuml generator docs * fix bug caused by assumption that inline _allOf types will always be unique but apparently they can be shared if they have identical properties! * fix bug with missing relationships caused by shared identical _allOf schemas Co-authored-by: Patrick.Burls <[email protected]>
1 parent 9f95f0c commit f03458d

File tree

13 files changed

+837
-0
lines changed

13 files changed

+837
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=$(ls -ld "$SCRIPT")
7+
link=$(expr "$ls" : '.*-> \(.*\)$')
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=$(dirname "$SCRIPT")/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=$(dirname "$SCRIPT")/..
17+
APP_DIR=$(cd "${APP_DIR}"; pwd)
18+
fi
19+
20+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g plantuml -o samples/documentation/petstore/plantuml"
30+
31+
java ${JAVA_OPTS} -jar ${executable} ${ags}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "plantuml-petstore-documentation" -i modules\openapi-generator\src\test\resources\3_0\petstore.yaml -g plantuml -o samples\documentation\petstore\plantuml
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/sh
2+
3+
SCRIPT="$0"
4+
5+
while [ -h "$SCRIPT" ] ; do
6+
ls=$(ls -ld "$SCRIPT")
7+
link=$(expr "$ls" : '.*-> \(.*\)$')
8+
if expr "$link" : '/.*' > /dev/null; then
9+
SCRIPT="$link"
10+
else
11+
SCRIPT=$(dirname "$SCRIPT")/"$link"
12+
fi
13+
done
14+
15+
if [ ! -d "${APP_DIR}" ]; then
16+
APP_DIR=$(dirname "$SCRIPT")/..
17+
APP_DIR=$(cd "${APP_DIR}"; pwd)
18+
fi
19+
20+
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
21+
22+
if [ ! -f "$executable" ]
23+
then
24+
mvn clean package
25+
fi
26+
27+
# if you've executed sbt assembly previously it will use that instead.
28+
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
29+
ags="$@ generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g plantuml -o samples/documentation/petstore/plantuml"
30+
31+
java ${JAVA_OPTS} -jar ${executable} ${ags}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set executable=.\modules\openapi-generator-cli\target\openapi-generator-cli.jar
2+
3+
If Not Exist %executable% (
4+
mvn clean package
5+
)
6+
7+
REM set JAVA_OPTS=%JAVA_OPTS% -Xmx1024M -DloggerPath=conf/log4j.properties
8+
set ags=generate --artifact-id "plantuml-petstore-documentation" -i modules\openapi-generator\src\test\resources\2_0\petstore.yaml -g plantuml -o samples\documentation\petstore\plantuml
9+
10+
java %JAVA_OPTS% -jar %executable% %ags%

docs/generators.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ The following generators are available:
136136
* [markdown (beta)](generators/markdown.md)
137137
* [openapi](generators/openapi.md)
138138
* [openapi-yaml](generators/openapi-yaml.md)
139+
* [plantuml](generators/plantuml.md)
139140

140141

141142
## SCHEMA generators

docs/generators/plantuml.md

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
---
2+
title: Config Options for plantuml
3+
sidebar_label: plantuml
4+
---
5+
6+
| Option | Description | Values | Default |
7+
| ------ | ----------- | ------ | ------- |
8+
|allowUnicodeIdentifiers|boolean, toggles whether unicode identifiers are allowed in names or not, default is false| |false|
9+
|ensureUniqueParams|Whether to ensure parameter names are unique in an operation (rename parameters that are not).| |true|
10+
|legacyDiscriminatorBehavior|This flag is used by OpenAPITools codegen to influence the processing of the discriminator attribute in OpenAPI documents. This flag has no impact if the OAS document does not use the discriminator attribute. The default value of this flag is set in each language-specific code generator (e.g. Python, Java, go...)using the method toModelName. Note to developers supporting a language generator in OpenAPITools; to fully support the discriminator attribute as defined in the OAS specification 3.x, language generators should set this flag to true by default; however this requires updating the mustache templates to generate a language-specific discriminator lookup function that iterates over {{#mappedModels}} and does not iterate over {{children}}, {{#anyOf}}, or {{#oneOf}}.|<dl><dt>**true**</dt><dd>The mapping in the discriminator includes descendent schemas that allOf inherit from self and the discriminator mapping schemas in the OAS document.</dd><dt>**false**</dt><dd>The mapping in the discriminator includes any descendent schemas that allOf inherit from self, any oneOf schemas, any anyOf schemas, any x-discriminator-values, and the discriminator mapping schemas in the OAS document AND Codegen validates that oneOf and anyOf schemas contain the required discriminator and throws an error if the discriminator is missing.</dd></dl>|true|
11+
|prependFormOrBodyParameters|Add form or body parameters to the beginning of the parameter list.| |false|
12+
|sortModelPropertiesByRequiredFlag|Sort model properties to place required parameters before optional parameters.| |true|
13+
|sortParamsByRequiredFlag|Sort method arguments to place required parameters before optional parameters.| |true|
14+
15+
## IMPORT MAPPING
16+
17+
| Type/Alias | Imports |
18+
| ---------- | ------- |
19+
|Array|java.util.List|
20+
|ArrayList|java.util.ArrayList|
21+
|BigDecimal|java.math.BigDecimal|
22+
|Date|java.util.Date|
23+
|DateTime|org.joda.time.*|
24+
|File|java.io.File|
25+
|HashMap|java.util.HashMap|
26+
|List|java.util.*|
27+
|LocalDate|org.joda.time.*|
28+
|LocalDateTime|org.joda.time.*|
29+
|LocalTime|org.joda.time.*|
30+
|Map|java.util.Map|
31+
|Set|java.util.*|
32+
|Timestamp|java.sql.Timestamp|
33+
|URI|java.net.URI|
34+
|UUID|java.util.UUID|
35+
36+
37+
## INSTANTIATION TYPES
38+
39+
| Type/Alias | Instantiated By |
40+
| ---------- | --------------- |
41+
42+
43+
## LANGUAGE PRIMITIVES
44+
45+
<ul class="column-ul">
46+
</ul>
47+
48+
## RESERVED WORDS
49+
50+
<ul class="column-ul">
51+
</ul>
52+
53+
## FEATURE SET
54+
55+
56+
### Client Modification Feature
57+
| Name | Supported | Defined By |
58+
| ---- | --------- | ---------- |
59+
|BasePath|✗|ToolingExtension
60+
|Authorizations|✗|ToolingExtension
61+
|UserAgent|✗|ToolingExtension
62+
63+
### Data Type Feature
64+
| Name | Supported | Defined By |
65+
| ---- | --------- | ---------- |
66+
|Custom|✗|OAS2,OAS3
67+
|Int32|✓|OAS2,OAS3
68+
|Int64|✓|OAS2,OAS3
69+
|Float|✓|OAS2,OAS3
70+
|Double|✓|OAS2,OAS3
71+
|Decimal|✓|ToolingExtension
72+
|String|✓|OAS2,OAS3
73+
|Byte|✓|OAS2,OAS3
74+
|Binary|✓|OAS2,OAS3
75+
|Boolean|✓|OAS2,OAS3
76+
|Date|✓|OAS2,OAS3
77+
|DateTime|✓|OAS2,OAS3
78+
|Password|✓|OAS2,OAS3
79+
|File|✓|OAS2
80+
|Array|✓|OAS2,OAS3
81+
|Maps|✓|ToolingExtension
82+
|CollectionFormat|✓|OAS2
83+
|CollectionFormatMulti|✓|OAS2
84+
|Enum|✓|OAS2,OAS3
85+
|ArrayOfEnum|✓|ToolingExtension
86+
|ArrayOfModel|✓|ToolingExtension
87+
|ArrayOfCollectionOfPrimitives|✓|ToolingExtension
88+
|ArrayOfCollectionOfModel|✓|ToolingExtension
89+
|ArrayOfCollectionOfEnum|✓|ToolingExtension
90+
|MapOfEnum|✓|ToolingExtension
91+
|MapOfModel|✓|ToolingExtension
92+
|MapOfCollectionOfPrimitives|✓|ToolingExtension
93+
|MapOfCollectionOfModel|✓|ToolingExtension
94+
|MapOfCollectionOfEnum|✓|ToolingExtension
95+
96+
### Documentation Feature
97+
| Name | Supported | Defined By |
98+
| ---- | --------- | ---------- |
99+
|Readme|✗|ToolingExtension
100+
|Model|✓|ToolingExtension
101+
|Api|✓|ToolingExtension
102+
103+
### Global Feature
104+
| Name | Supported | Defined By |
105+
| ---- | --------- | ---------- |
106+
|Host|✓|OAS2,OAS3
107+
|BasePath|✓|OAS2,OAS3
108+
|Info|✓|OAS2,OAS3
109+
|Schemes|✗|OAS2,OAS3
110+
|PartialSchemes|✓|OAS2,OAS3
111+
|Consumes|✓|OAS2
112+
|Produces|✓|OAS2
113+
|ExternalDocumentation|✓|OAS2,OAS3
114+
|Examples|✓|OAS2,OAS3
115+
|XMLStructureDefinitions|✗|OAS2,OAS3
116+
|MultiServer|✗|OAS3
117+
|ParameterizedServer|✗|OAS3
118+
|ParameterStyling|✗|OAS3
119+
|Callbacks|✓|OAS3
120+
|LinkObjects|✗|OAS3
121+
122+
### Parameter Feature
123+
| Name | Supported | Defined By |
124+
| ---- | --------- | ---------- |
125+
|Path|✓|OAS2,OAS3
126+
|Query|✓|OAS2,OAS3
127+
|Header|✓|OAS2,OAS3
128+
|Body|✓|OAS2
129+
|FormUnencoded|✓|OAS2
130+
|FormMultipart|✓|OAS2
131+
|Cookie|✓|OAS3
132+
133+
### Schema Support Feature
134+
| Name | Supported | Defined By |
135+
| ---- | --------- | ---------- |
136+
|Simple|✓|OAS2,OAS3
137+
|Composite|✓|OAS2,OAS3
138+
|Polymorphism|✓|OAS2,OAS3
139+
|Union|✗|OAS3
140+
141+
### Security Feature
142+
| Name | Supported | Defined By |
143+
| ---- | --------- | ---------- |
144+
|BasicAuth|✓|OAS2,OAS3
145+
|ApiKey|✓|OAS2,OAS3
146+
|OpenIDConnect|✗|OAS3
147+
|BearerToken|✓|OAS3
148+
|OAuth2_Implicit|✓|OAS2,OAS3
149+
|OAuth2_Password|✓|OAS2,OAS3
150+
|OAuth2_ClientCredentials|✓|OAS2,OAS3
151+
|OAuth2_AuthorizationCode|✓|OAS2,OAS3
152+
153+
### Wire Format Feature
154+
| Name | Supported | Defined By |
155+
| ---- | --------- | ---------- |
156+
|JSON|✓|OAS2,OAS3
157+
|XML|✓|OAS2,OAS3
158+
|PROTOBUF|✗|ToolingExtension
159+
|Custom|✗|OAS2,OAS3

0 commit comments

Comments
 (0)