This repository was archived by the owner on Dec 25, 2024. It is now read-only.
Commit f557d28
authored
Java, adds enums and uses them in Schema validate methods (#344)
* Generates one enum for each schema enum data type
* Regenerates petstore
* Eum validator added to schema interfaces
* Fixes enum class names
* Adds missing import for nullenumvalidator
* Simplifies enum declarations, removes EnumValueMethod interface
* Removes unused import
* Adds LinkedHashMap import back in for anytype schemas
* Minimizes ArrayList usage
* Removes unused ArrayList import
* Removes unused map import
* Removes unused FrozenList/Map imports
* Removes unneeded line
* Adds enum classes bullet in schema docs
* Refactors getSchemas into generator
* Schema docs updated
* Adds schema doc lines mentioning generated enums
* Adds enum summary text
* Adds enum class sections to schema docs
* Ads link from nested classes section to enum section
* Includes enum constant summary in schema docs
* Writes anyType null enum validate if enum exists
* Adds schema validate with null enum input to schema docs
* Adds boolean enum validate method in schema code
* Adds boolean enum validate to schema docs
* Removes static from validate methods
* Creates and imports StringEnumValidator
* Adds StringEnumValidator to implements line in schema classes
* Adds StringEnum validate method in schemas
* Adds stirngenum validate method to schema docs
* Changes numeric enum input to bigdecimal
* Fixes bug where enum validate methods collided, fixed boolean enum validate type error
* Fixes enum validator now that values are bigdecimals
* Updates templates to stop casting Integer integer into Long in EnumValue, produces 4 types of number in enumInfo typeToValues
* Updates enum code and doc generation to inlcude 4 number types
* Adds IntegerEnumValidator + IntegerValueMethod
* Adds integer enum to schema classes
* Adds missing IntegerValueMethod to integer enums
* Adds and import LongEnumValidator + LongValueMethod
* Converts boolean/int/long enums to return non null values
* Fixes boolean return type in boolean enums
* Generates long enums and uses them in validate methods
* Adds and generates FloatEnumValidator + FloatValueMethod
* Adds FloatEnumValidator to class signature
* Implements float enums
* Generates files DoubleEnumValidator + DoubleValueMethod and imports those files
* implements DoubleValueMethod in double enums
* Adds double enum validator to signature of schema classes
* Adds Double enum validate methods
* Fixes java tests and python templates
* Updates java enum templates to use the correct value
* Updates java template enum name references
* Samples updated
* Adsjusts enum generation
* Adds missing enum BigDecimal imports
* Samples updated, BigDecimals handled in enums1 parent 82a62d9 commit f557d28
File tree
792 files changed
+6884
-5449
lines changed- samples/client
- 3_0_3_unit_test/java
- .openapi-generator
- docs/components/schemas
- src
- main/java/org/openapijsonschematools/client
- components/schemas
- schemas
- validation
- test/java/org/openapijsonschematools/client/schemas/validation
- petstore/java
- .openapi-generator
- docs
- components
- headers
- int32jsoncontenttypeheader/content/applicationjson
- numberheader
- refcontentschemaheader/content/applicationjson
- refschemaheader
- stringheader
- parameters
- componentrefschemastringwithvalidation/content/applicationjson
- pathusername
- refschemastringwithvalidation
- requestbodies
- client/content/applicationjson
- pet/content
- applicationjson
- applicationxml
- userarray/content/applicationjson
- responses
- headerswithnobody/headers/location
- successfulxmlandjsonarrayofpet/content
- applicationjson
- applicationxml
- successinlinecontentandheader
- content/applicationjson
- headers/someheader
- successwithjsonapiresponse/content/applicationjson
- schemas
- paths
- anotherfakedummy/patch/responses/response200/content/applicationjson
- commonparamsubdir
- delete/parameters
- parameter0
- parameter1
- get/parameters/parameter0
- parameters/parameter0
- post/parameters/parameter0
- fakeadditionalpropertieswitharrayofenums/get
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakebodywithfileschema/put/requestbody/content/applicationjson
- fakebodywithqueryparams/put
- parameters/parameter0
- requestbody/content/applicationjson
- fakecasesensitiveparams/put/parameters
- parameter0
- parameter1
- parameter2
- fakeclassnametest/patch/responses/response200/content/applicationjson
- fakedeletecoffeeid/delete/parameters/parameter0
- fakehealth/get/responses/response200/content/applicationjson
- fakeinlineadditionalproperties/post/requestbody/content/applicationjson
- fakeinlinecomposition/post
- parameters
- parameter0
- parameter1
- requestbody/content
- applicationjson
- multipartformdata
- responses/response200/content
- applicationjson
- multipartformdata
- fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded
- fakejsonpatch/patch/requestbody/content/applicationjsonpatchjson
- fakejsonwithcharset/post
- requestbody/content/applicationjsoncharsetutf8
- responses/response200/content/applicationjsoncharsetutf8
- fakemultiplerequestbodycontenttypes/post
- requestbody/content
- applicationjson
- multipartformdata
- responses/response200/content/applicationjson
- fakemultipleresponsebodies/get/responses
- response200/content/applicationjson
- response202/content/applicationjson
- fakemultiplesecurities/get/responses/response200/content/applicationjson
- fakeobjinquery/get/parameters/parameter0
- fakeparametercollisions1ababselfab/post
- parameters
- parameter0
- parameter10
- parameter11
- parameter12
- parameter13
- parameter14
- parameter15
- parameter16
- parameter17
- parameter18
- parameter1
- parameter2
- parameter3
- parameter4
- parameter5
- parameter6
- parameter7
- parameter8
- parameter9
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakepetiduploadimagewithrequiredfile/post
- parameters/parameter0
- requestbody/content/multipartformdata
- responses/response200/content/applicationjson
- fakequeryparamwithjsoncontenttype/get
- parameters/parameter0/content/applicationjson
- responses/response200/content/applicationjson
- fakerefobjinquery/get/parameters/parameter0
- fakerefsarraymodel/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefsarrayofenums/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefsboolean/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefscomposedoneofnumberwithvalidations/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefsenum/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefsmammal/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefsnumber/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefsobjectmodelwithrefprops/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- fakerefsstring/post
- requestbody/content/applicationjson
- responses/response200/content/applicationjson
- faketestqueryparamters/put/parameters
- parameter0
- parameter1
- parameter2
- parameter3
- parameter4
- parameter5
- fakeuploaddownloadfile/post
- requestbody/content/applicationoctetstream
- responses/response200/content/applicationoctetstream
- fakeuploadfiles/post
- requestbody/content/multipartformdata
- responses/response200/content/applicationjson
- fakeuploadfile/post
- requestbody/content/multipartformdata
- responses/response200/content/applicationjson
- fakewildcardresponses/get/responses
- response1xx/content/applicationjson
- response200/content/applicationjson
- response2xx/content/applicationjson
- response3xx/content/applicationjson
- response4xx/content/applicationjson
- response5xx/content/applicationjson
- fake
- delete/parameters
- parameter0
- parameter1
- parameter2
- parameter3
- parameter4
- parameter5
- get
- parameters
- parameter0
- parameter1
- parameter2
- parameter3
- parameter4
- parameter5
- requestbody/content/applicationxwwwformurlencoded
- responses/response404/content/applicationjson
- patch/responses/response200/content/applicationjson
- post/requestbody/content/applicationxwwwformurlencoded
- foo/get/responses/responsedefault/content/applicationjson
- petfindbystatus/get/parameters/parameter0
- petfindbytags/get/parameters/parameter0
- petpetiduploadimage/post
- parameters/parameter0
- requestbody/content/multipartformdata
- petpetid
- delete/parameters
- parameter0
- parameter1
- get
- parameters/parameter0
- responses/response200/content
- applicationjson
- applicationxml
- post
- parameters/parameter0
- requestbody/content/applicationxwwwformurlencoded
- storeorderorderid
- delete/parameters/parameter0
- get
- parameters/parameter0
- responses/response200/content
- applicationjson
- applicationxml
- storeorder/post
- requestbody/content/applicationjson
- responses/response200/content
- applicationjson
- applicationxml
- userlogin/get
- parameters
- parameter0
- parameter1
- responses/response200
- content
- applicationjson
- applicationxml
- headers
- xexpiresafter
- xratelimit/content/applicationjson
- userusername
- get/responses/response200/content
- applicationjson
- applicationxml
- put/requestbody/content/applicationjson
- user/post/requestbody/content/applicationjson
- src
- main/java/org/openapijsonschematools/client
- components
- requestbodies/userarray/content/applicationjson
- responses
- headerswithnobody
- successfulxmlandjsonarrayofpet/content
- applicationjson
- applicationxml
- successinlinecontentandheader
- content/applicationjson
- successwithjsonapiresponse
- schemas
- paths
- commonparamsubdir
- delete
- parameters/parameter1
- get
- parameters/parameter0
- post
- fakebodywithqueryparams/put
- fakecasesensitiveparams/put
- fakedeletecoffeeid/delete
- fakeinlineadditionalproperties/post/requestbody/content/applicationjson
- fakeinlinecomposition/post
- parameters
- parameter0
- parameter1
- requestbody/content
- applicationjson
- multipartformdata
- responses/response200/content
- applicationjson
- multipartformdata
- fakejsonformdata/get/requestbody/content/applicationxwwwformurlencoded
- fakemultiplerequestbodycontenttypes/post/requestbody/content
- applicationjson
- multipartformdata
- fakeobjinquery/get
- parameters/parameter0
- fakeparametercollisions1ababselfab/post
- fakepetiduploadimagewithrequiredfile/post
- requestbody/content/multipartformdata
- fakequeryparamwithjsoncontenttype/get
- fakerefobjinquery/get
- faketestqueryparamters/put
- parameters
- parameter0
- parameter1
- parameter2
- parameter3
- parameter4
- fakeuploadfiles/post/requestbody/content/multipartformdata
- fakeuploadfile/post/requestbody/content/multipartformdata
- fake
- delete
- parameters
- parameter1
- parameter4
- get
- parameters
- parameter0
- parameter1
- parameter2
- parameter3
- parameter4
- parameter5
- requestbody/content/applicationxwwwformurlencoded
- post/requestbody/content/applicationxwwwformurlencoded
- foo/get/responses/responsedefault/content/applicationjson
- petfindbystatus/get
- parameters/parameter0
- petfindbytags/get
- parameters/parameter0
- petpetiduploadimage/post
- requestbody/content/multipartformdata
- petpetid
- delete
- get
- post
- requestbody/content/applicationxwwwformurlencoded
- storeorderorderid
- delete
- get
- parameters/parameter0
- userlogin/get
- responses/response200
- userusername
- delete
- get
- put
- schemas
- validation
- test/java/org/openapijsonschematools/client/schemas/validation
- src/main
- java/org/openapijsonschematools/codegen/generators
- openapimodels
- resources
- java/src
- main/java/packagename
- components/schemas
- SchemaClass
- schemas
- validation
- test/java/packagename/schemas/validation
- python/components/schemas
- schema_cls/validate
- types
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
792 files changed
+6884
-5449
lines changedLines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
203 | 203 | | |
204 | 204 | | |
205 | 205 | | |
| 206 | + | |
| 207 | + | |
206 | 208 | | |
| 209 | + | |
207 | 210 | | |
| 211 | + | |
| 212 | + | |
208 | 213 | | |
209 | 214 | | |
210 | 215 | | |
211 | 216 | | |
| 217 | + | |
| 218 | + | |
212 | 219 | | |
213 | 220 | | |
214 | 221 | | |
| 222 | + | |
| 223 | + | |
215 | 224 | | |
216 | 225 | | |
217 | 226 | | |
| |||
220 | 229 | | |
221 | 230 | | |
222 | 231 | | |
| 232 | + | |
| 233 | + | |
223 | 234 | | |
224 | 235 | | |
225 | 236 | | |
| |||
231 | 242 | | |
232 | 243 | | |
233 | 244 | | |
| 245 | + | |
234 | 246 | | |
| 247 | + | |
235 | 248 | | |
236 | 249 | | |
237 | 250 | | |
238 | 251 | | |
239 | 252 | | |
240 | 253 | | |
241 | 254 | | |
| 255 | + | |
242 | 256 | | |
| 257 | + | |
243 | 258 | | |
244 | 259 | | |
245 | 260 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
59 | 57 | | |
60 | 58 | | |
61 | 59 | | |
62 | | - | |
63 | | - | |
| 60 | + | |
| 61 | + | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
| |||
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
32 | 30 | | |
33 | 31 | | |
34 | 32 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
43 | 41 | | |
44 | | - | |
| 42 | + | |
45 | 43 | | |
46 | 44 | | |
47 | 45 | | |
| |||
Lines changed: 2 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
56 | 54 | | |
57 | 55 | | |
58 | 56 | | |
59 | | - | |
60 | | - | |
| 57 | + | |
| 58 | + | |
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
| |||
Lines changed: 18 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
47 | 45 | | |
48 | | - | |
| 46 | + | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
83 | 81 | | |
84 | 82 | | |
85 | 83 | | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
94 | 92 | | |
95 | | - | |
| 93 | + | |
96 | 94 | | |
97 | 95 | | |
98 | 96 | | |
| |||
Lines changed: 27 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | 7 | | |
9 | | - | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
| |||
36 | 34 | | |
37 | 35 | | |
38 | 36 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
47 | 45 | | |
48 | | - | |
| 46 | + | |
49 | 47 | | |
50 | 48 | | |
51 | 49 | | |
| |||
61 | 59 | | |
62 | 60 | | |
63 | 61 | | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
72 | 70 | | |
73 | | - | |
| 71 | + | |
74 | 72 | | |
75 | 73 | | |
76 | 74 | | |
| |||
121 | 119 | | |
122 | 120 | | |
123 | 121 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
132 | 130 | | |
133 | | - | |
| 131 | + | |
134 | 132 | | |
135 | 133 | | |
136 | 134 | | |
| |||
0 commit comments