forked from loafle/openapi-generator-original
Compare commits
523 Commits
test-run-d
...
test-pytho
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e511d9c99 | ||
|
|
7a98580f45 | ||
|
|
b72d5ca81e | ||
|
|
ec815ca33a | ||
|
|
2c59f1dc8c | ||
|
|
a5ee2e0454 | ||
|
|
cb4b03fcf3 | ||
|
|
f608803a40 | ||
|
|
9ace82ae14 | ||
|
|
5472943134 | ||
|
|
d6bfecf2ef | ||
|
|
9ba943318a | ||
|
|
f3fbc7d782 | ||
|
|
5f3d974a08 | ||
|
|
9778d970ac | ||
|
|
5dffbabc74 | ||
|
|
7b1563326a | ||
|
|
49760f7a34 | ||
|
|
596bbb9c58 | ||
|
|
29ca272a95 | ||
|
|
5ebf26e0d2 | ||
|
|
bc799b2488 | ||
|
|
7dd4fd1d98 | ||
|
|
bdc964a6c1 | ||
|
|
6612c16624 | ||
|
|
874c2a19d8 | ||
|
|
94ed8187f9 | ||
|
|
56c9f0dc1e | ||
|
|
6e937ba9f9 | ||
|
|
1716ee3154 | ||
|
|
d2aabc5f80 | ||
|
|
8c78f13a41 | ||
|
|
04b39cc86b | ||
|
|
2157d526e1 | ||
|
|
a5fcb17416 | ||
|
|
96bba3769b | ||
|
|
f8c20c22e1 | ||
|
|
27680214fd | ||
|
|
7fa02ee5f0 | ||
|
|
be151fca64 | ||
|
|
985c4b36a7 | ||
|
|
a29d9a9ff4 | ||
|
|
4f27939879 | ||
|
|
8cd503f194 | ||
|
|
c7d5275b62 | ||
|
|
3ca6bc2518 | ||
|
|
35d42728d9 | ||
|
|
77f24a4234 | ||
|
|
5675d5fe61 | ||
|
|
80bef2f79a | ||
|
|
ea559b5e20 | ||
|
|
92f7a306a1 | ||
|
|
3f7a3f2b59 | ||
|
|
29ed2342e5 | ||
|
|
874daad7e7 | ||
|
|
ef42977097 | ||
|
|
7424489607 | ||
|
|
9754748321 | ||
|
|
bfe4a7ff87 | ||
|
|
ca5d384081 | ||
|
|
620f8db3d6 | ||
|
|
6a4aed91ca | ||
|
|
6909c888d2 | ||
|
|
bb00d88283 | ||
|
|
32c591d9a7 | ||
|
|
be40dbe540 | ||
|
|
c04d9cd59a | ||
|
|
c44865279a | ||
|
|
0b6229607f | ||
|
|
8dd3e561fa | ||
|
|
4e05912ae7 | ||
|
|
8556cb8d71 | ||
|
|
0173acd1d3 | ||
|
|
bf0bd29ef1 | ||
|
|
1a709a731b | ||
|
|
8fad36c898 | ||
|
|
634e3eb838 | ||
|
|
09200eb04e | ||
|
|
684b77166b | ||
|
|
0a2ef5a725 | ||
|
|
00e20ffb2c | ||
|
|
df441fe2ee | ||
|
|
f396da4c7e | ||
|
|
1eb8c2991d | ||
|
|
4d8ac0e055 | ||
|
|
37de486c43 | ||
|
|
7b6cc2032a | ||
|
|
e7f83595e5 | ||
|
|
67ba67ef96 | ||
|
|
c39aef2a79 | ||
|
|
f9514705a1 | ||
|
|
7ac7974ef5 | ||
|
|
089e1f7271 | ||
|
|
9a6e3fa74a | ||
|
|
06434fcfce | ||
|
|
681e821b71 | ||
|
|
2d5b2726d0 | ||
|
|
b38968456a | ||
|
|
dd42e0e428 | ||
|
|
0e2e031ece | ||
|
|
5e512e8aa4 | ||
|
|
662c77a283 | ||
|
|
2fd23f505e | ||
|
|
212b4f7847 | ||
|
|
14d41310b9 | ||
|
|
1f50207bda | ||
|
|
e0ec332e38 | ||
|
|
151752aa9d | ||
|
|
a6d30cac9d | ||
|
|
91ea6a17d9 | ||
|
|
966b87e66c | ||
|
|
d50d31cd5e | ||
|
|
20eb4d0b91 | ||
|
|
26bb348354 | ||
|
|
972120c35a | ||
|
|
ab5b0fa8d4 | ||
|
|
9fd66fbbcb | ||
|
|
19c5ed783a | ||
|
|
14a500c6fe | ||
|
|
b9662dc25d | ||
|
|
7032c401ea | ||
|
|
15de43f7e4 | ||
|
|
8eea149e14 | ||
|
|
30074833cd | ||
|
|
d5a680e85f | ||
|
|
da9f2f7c9b | ||
|
|
2c65605289 | ||
|
|
f681016ffd | ||
|
|
1f95199f82 | ||
|
|
08fe44c764 | ||
|
|
26c17c5774 | ||
|
|
892836f772 | ||
|
|
b4edfe477a | ||
|
|
8c1f6fcdc1 | ||
|
|
f11b2e6772 | ||
|
|
11a674f248 | ||
|
|
98582d5780 | ||
|
|
6913b0520c | ||
|
|
e6d3201623 | ||
|
|
bc4994e82c | ||
|
|
2e243abf25 | ||
|
|
546bc37935 | ||
|
|
1852f61f3a | ||
|
|
d868fd6dc8 | ||
|
|
a97feaf533 | ||
|
|
54a6c791f7 | ||
|
|
1dc65f0033 | ||
|
|
8bd2dd4c9d | ||
|
|
19140dc00d | ||
|
|
3e734a0b54 | ||
|
|
c893b92775 | ||
|
|
029fd669e5 | ||
|
|
5e79aaaf0a | ||
|
|
c1de6c2651 | ||
|
|
f70d48ea73 | ||
|
|
0747694636 | ||
|
|
7bb8a8d9ff | ||
|
|
fff5bfe8cb | ||
|
|
f371f7ff07 | ||
|
|
2e61a37833 | ||
|
|
027f752613 | ||
|
|
0e9c6dd9a8 | ||
|
|
da84d8e3bf | ||
|
|
a78a72b3d7 | ||
|
|
301cd4093d | ||
|
|
cbdedff0ad | ||
|
|
e8e6229d1b | ||
|
|
f0fd2cbb22 | ||
|
|
06ab5b5c0f | ||
|
|
d3017ffba8 | ||
|
|
71321bd049 | ||
|
|
866df36c94 | ||
|
|
c19350b179 | ||
|
|
81d0f72bd5 | ||
|
|
cf0385676b | ||
|
|
ed1e30e75e | ||
|
|
98c606c32d | ||
|
|
bee03685f0 | ||
|
|
1ff16d0db7 | ||
|
|
86240f476b | ||
|
|
5bb27c22ec | ||
|
|
528c2f6bd4 | ||
|
|
b7b009082a | ||
|
|
e26a4222c7 | ||
|
|
9a03850828 | ||
|
|
31d5652c3d | ||
|
|
f0e2e372db | ||
|
|
14c14bf9a2 | ||
|
|
554747d59c | ||
|
|
b3b4526bf7 | ||
|
|
2b0c5819c0 | ||
|
|
208106d179 | ||
|
|
85e1fa1b68 | ||
|
|
b6f1f0172e | ||
|
|
dc90adb539 | ||
|
|
ae6abfc5f3 | ||
|
|
c9939a2754 | ||
|
|
9ba34b2805 | ||
|
|
a1484dac77 | ||
|
|
6653cedcc7 | ||
|
|
f609120236 | ||
|
|
b48112d941 | ||
|
|
13c94eeea0 | ||
|
|
c89a5c416d | ||
|
|
d37216a411 | ||
|
|
1ee57ea853 | ||
|
|
780b55a518 | ||
|
|
256d498d0e | ||
|
|
69a410550a | ||
|
|
e4c858cd25 | ||
|
|
6f0bef61ba | ||
|
|
5bbcf30c9c | ||
|
|
930c622d11 | ||
|
|
f1989cc70f | ||
|
|
d78e91517e | ||
|
|
2a17625e1f | ||
|
|
03a0dc7713 | ||
|
|
5abf8b8378 | ||
|
|
4811785c43 | ||
|
|
57ee092abd | ||
|
|
159936d85a | ||
|
|
227fb50b2b | ||
|
|
5ad2c8315e | ||
|
|
5a68bcf532 | ||
|
|
742b8bd650 | ||
|
|
4a7c4ac81d | ||
|
|
201ac77d0c | ||
|
|
be02a33c72 | ||
|
|
f752f29af2 | ||
|
|
f5775f483a | ||
|
|
51c45eb28b | ||
|
|
c1b8c294aa | ||
|
|
aa698633b3 | ||
|
|
9f1d012d14 | ||
|
|
c1b53df345 | ||
|
|
cbcb7ff848 | ||
|
|
66cd0f6511 | ||
|
|
0cb4c43c42 | ||
|
|
b8e87bb6fc | ||
|
|
ba8a50137a | ||
|
|
ca3fa4b9cb | ||
|
|
34f0d02f38 | ||
|
|
7a846a193a | ||
|
|
6a08ec59c0 | ||
|
|
1be98b4920 | ||
|
|
1ffe2a780a | ||
|
|
a9576a1e2b | ||
|
|
93159de77d | ||
|
|
761364eec9 | ||
|
|
43471bacbc | ||
|
|
647d253ac8 | ||
|
|
800d9453a4 | ||
|
|
44726ef471 | ||
|
|
828bdebdac | ||
|
|
5b22d08d41 | ||
|
|
62e5950799 | ||
|
|
d143f8db5c | ||
|
|
a7ccc4addd | ||
|
|
f49ab2a7ed | ||
|
|
b838e1885f | ||
|
|
0f3edb13f5 | ||
|
|
c93fcd7514 | ||
|
|
b2293cc363 | ||
|
|
e12009907e | ||
|
|
6621f46d70 | ||
|
|
0494d27f73 | ||
|
|
472ff9c657 | ||
|
|
720f864b64 | ||
|
|
8a3994e000 | ||
|
|
4e59122264 | ||
|
|
f64a4d1a4f | ||
|
|
789b158cd4 | ||
|
|
0c173fb519 | ||
|
|
fdc0b5b0e2 | ||
|
|
adc3fef247 | ||
|
|
798ad2f87d | ||
|
|
fa75469828 | ||
|
|
86eb1b9112 | ||
|
|
1cb34be8fe | ||
|
|
321ad3c820 | ||
|
|
ee0686e13f | ||
|
|
2743242ef4 | ||
|
|
39c4a123b3 | ||
|
|
312082c168 | ||
|
|
08612d8e52 | ||
|
|
8d63f75966 | ||
|
|
9bfd9545cc | ||
|
|
dba14f5ac6 | ||
|
|
9592754e57 | ||
|
|
468d80be4b | ||
|
|
a00521f260 | ||
|
|
04c41d47a2 | ||
|
|
9139f91b48 | ||
|
|
5f8e28a39d | ||
|
|
276a983fe8 | ||
|
|
1897f6f96c | ||
|
|
83f64dbc15 | ||
|
|
8e150ab94e | ||
|
|
03e8aee8ea | ||
|
|
3199ddc615 | ||
|
|
d1fe2e17f1 | ||
|
|
1bfd86a350 | ||
|
|
90d8c32906 | ||
|
|
d6549f78b4 | ||
|
|
9899315aab | ||
|
|
6e21ca5930 | ||
|
|
763b8fbe3e | ||
|
|
e9c231b50a | ||
|
|
df2c927dcb | ||
|
|
454ceb45fa | ||
|
|
a59e506c9e | ||
|
|
3784f459e9 | ||
|
|
5e2306446f | ||
|
|
b1dcf65c5b | ||
|
|
2ab35e0386 | ||
|
|
6053f7b17b | ||
|
|
3305ac962a | ||
|
|
0a394bc883 | ||
|
|
95bd845f79 | ||
|
|
383b1e9db8 | ||
|
|
1cfa8141a8 | ||
|
|
0e0f8eb74c | ||
|
|
ed84280108 | ||
|
|
44d3f717f8 | ||
|
|
968f32b55e | ||
|
|
8a774f636b | ||
|
|
dd6e8ccc3d | ||
|
|
0707b4bb20 | ||
|
|
49f088ec8e | ||
|
|
da50523f3b | ||
|
|
d2161c8ad1 | ||
|
|
ffdd7000a4 | ||
|
|
8cd52033e4 | ||
|
|
9318833fa5 | ||
|
|
7cb8766a5c | ||
|
|
fce74884f8 | ||
|
|
a348f5a170 | ||
|
|
02a8207b91 | ||
|
|
cef1bec466 | ||
|
|
38368c9bda | ||
|
|
9d76ca291e | ||
|
|
b86a51ae17 | ||
|
|
5980c420e3 | ||
|
|
dad931a25a | ||
|
|
29183e0280 | ||
|
|
1044c30293 | ||
|
|
a7446983e8 | ||
|
|
53950f8aff | ||
|
|
6a49c4ec02 | ||
|
|
57bf9e85a1 | ||
|
|
47b4e16420 | ||
|
|
850c958d83 | ||
|
|
ffac26face | ||
|
|
0be0a06d84 | ||
|
|
ce177a7fb6 | ||
|
|
566b2b7647 | ||
|
|
b3bc69c8f1 | ||
|
|
3e69d73ec9 | ||
|
|
c072291c28 | ||
|
|
f11b0f886e | ||
|
|
47b7a0d243 | ||
|
|
8c5c0597ae | ||
|
|
6c1aecb151 | ||
|
|
61789475ea | ||
|
|
f15acbc700 | ||
|
|
c4cb8e46c5 | ||
|
|
068ad02bc8 | ||
|
|
f0157b8c0f | ||
|
|
aed5be9b9c | ||
|
|
23f57a7290 | ||
|
|
eaa3c730fa | ||
|
|
38ab7383f2 | ||
|
|
c6cb7ebe2a | ||
|
|
520f87abae | ||
|
|
63c1b1350d | ||
|
|
1fe7d703d7 | ||
|
|
fa97333a5c | ||
|
|
8e95298653 | ||
|
|
fa72c63b62 | ||
|
|
6224f5e397 | ||
|
|
d9957ad0a9 | ||
|
|
323cd38b5c | ||
|
|
dae329d8e1 | ||
|
|
d433c2d42f | ||
|
|
978b455f11 | ||
|
|
f05aa8e80d | ||
|
|
cf0920110c | ||
|
|
e7672f32bf | ||
|
|
a77fd443ad | ||
|
|
156c4bfb70 | ||
|
|
d9a6f4d726 | ||
|
|
6a61910df1 | ||
|
|
e3cdb4c328 | ||
|
|
d949c8181d | ||
|
|
16197edac4 | ||
|
|
7aa7c738a9 | ||
|
|
108275affe | ||
|
|
7ea6c35508 | ||
|
|
6dfd029c63 | ||
|
|
6041acd225 | ||
|
|
a69fcddbe2 | ||
|
|
1798fea3e7 | ||
|
|
1f277002a1 | ||
|
|
f1142948c0 | ||
|
|
720ab3d39b | ||
|
|
5cce9dc7d3 | ||
|
|
933b285568 | ||
|
|
919b3b6bef | ||
|
|
8b9c070e5d | ||
|
|
50071aed11 | ||
|
|
36930fe5cc | ||
|
|
13fe079901 | ||
|
|
6b877efe1f | ||
|
|
a2a1ac93a4 | ||
|
|
33328977d1 | ||
|
|
cb87e341d1 | ||
|
|
bcefbe99c1 | ||
|
|
8400d4c6f9 | ||
|
|
1d86d7e3ac | ||
|
|
0cf31704cc | ||
|
|
b47f3fadee | ||
|
|
ec4e44a5f4 | ||
|
|
11f0b3d39f | ||
|
|
e49804fd7f | ||
|
|
313d205f56 | ||
|
|
195b376f48 | ||
|
|
4bb5afdefb | ||
|
|
efafc58170 | ||
|
|
61f0532ec1 | ||
|
|
177bd52957 | ||
|
|
155acae088 | ||
|
|
979dfd131a | ||
|
|
06327da4f0 | ||
|
|
5cdc9e9e35 | ||
|
|
93bd8571d3 | ||
|
|
4e352cb282 | ||
|
|
5811b05cdb | ||
|
|
ca3a23bfa8 | ||
|
|
b2ae0b18fe | ||
|
|
b86f6c8015 | ||
|
|
3ba0e05342 | ||
|
|
951aa7a9d9 | ||
|
|
b729e1d723 | ||
|
|
42784ee1cc | ||
|
|
380b173e50 | ||
|
|
213c38c5cc | ||
|
|
748190a049 | ||
|
|
53eff43184 | ||
|
|
6f2e84db04 | ||
|
|
c094effd90 | ||
|
|
45655c2235 | ||
|
|
3ba787c5aa | ||
|
|
c65363eb71 | ||
|
|
aa201b3d9f | ||
|
|
2460cfccfa | ||
|
|
55d8e759de | ||
|
|
f91064c0f6 | ||
|
|
e658c49f77 | ||
|
|
ff68128c15 | ||
|
|
4deea5a7dc | ||
|
|
6c24239bac | ||
|
|
46f9c27d86 | ||
|
|
1a2097e81d | ||
|
|
171337e5f3 | ||
|
|
6f5ec7deef | ||
|
|
982491e117 | ||
|
|
4f1d7c0f04 | ||
|
|
e282a052bf | ||
|
|
90f904a669 | ||
|
|
c7de5e2268 | ||
|
|
32adeddd8f | ||
|
|
e07f084e2a | ||
|
|
a4e42e1651 | ||
|
|
8fc65d04a5 | ||
|
|
8e2bf99ffb | ||
|
|
eb26fe51db | ||
|
|
690f36d946 | ||
|
|
f36b807091 | ||
|
|
e84ec710d8 | ||
|
|
3626bc4bf4 | ||
|
|
a0f229302d | ||
|
|
e2e83fc7bf | ||
|
|
b049a5d466 | ||
|
|
f092b98a90 | ||
|
|
146bfeb6d6 | ||
|
|
8689625af3 | ||
|
|
defb0bceeb | ||
|
|
046ba7de8e | ||
|
|
0cb080d5f1 | ||
|
|
28387a09bc | ||
|
|
2128f2875e | ||
|
|
3b9cb14025 | ||
|
|
f373f20639 | ||
|
|
933ab0640a | ||
|
|
ebcce67419 | ||
|
|
31d05f3f48 | ||
|
|
9fdcbec64b | ||
|
|
71dc054d82 | ||
|
|
a014915e62 | ||
|
|
104a2a39b8 | ||
|
|
5c893d5664 | ||
|
|
f2a615d693 | ||
|
|
db10bba1e3 | ||
|
|
a4d679f9e5 | ||
|
|
4bbe3cdbc9 | ||
|
|
0b561d6075 | ||
|
|
fd2976b89c | ||
|
|
233087c5aa | ||
|
|
60ceded171 | ||
|
|
765752f952 | ||
|
|
c176bdcb3e | ||
|
|
2c3721720e | ||
|
|
057c4294de | ||
|
|
7baa72eefa | ||
|
|
57d75e75e7 | ||
|
|
835dab4b50 | ||
|
|
c102ced044 | ||
|
|
d5ea62f966 | ||
|
|
2956ae028a | ||
|
|
734d6d9f09 | ||
|
|
8da06b038a | ||
|
|
388218bdf9 | ||
|
|
dc9a898e11 |
14
.github/ISSUE_TEMPLATE/bug_report.md
vendored
14
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -11,10 +11,10 @@ assignees: ''
|
||||
|
||||
- [ ] Have you provided a full/minimal spec to reproduce the issue?
|
||||
- [ ] Have you validated the input using an OpenAPI validator ([example](https://apidevtools.org/swagger-parser/online/))?
|
||||
- [ ] What's the version of OpenAPI Generator used?
|
||||
- [ ] Have you search for related issues/PRs?
|
||||
- [ ] Have you [tested with the latest master](https://github.com/OpenAPITools/openapi-generator/wiki/FAQ#how-to-test-with-the-latest-master-of-openapi-generator) to confirm the issue still exists?
|
||||
- [ ] Have you searched for related issues/PRs?
|
||||
- [ ] What's the actual output vs expected output?
|
||||
- [ ] [Optional] Bounty to sponsor the fix ([example](https://www.bountysource.com/issues/66123212-javascript-client-produces-a-wrong-object-for-a-string-enum-type-that-is-used-with-ref))
|
||||
- [ ] [Optional] Sponsorship to speed up the bug fix or feature request ([example](https://github.com/OpenAPITools/openapi-generator/issues/6178))
|
||||
|
||||
<!--
|
||||
Please follow the issue template below for bug reports.
|
||||
@@ -45,9 +45,13 @@ please create a Gist (https://gist.github.com) or upload it somewhere else and
|
||||
link it here.
|
||||
-->
|
||||
|
||||
##### Command line used for generation
|
||||
##### Generation Details
|
||||
|
||||
<!-- including the language, libraries and various options -->
|
||||
<!--
|
||||
Prefer CLI steps, including the language, libraries and various options.
|
||||
Providing config-based settings allows for simpler testing across CLI and plugins.
|
||||
For examples, see https://github.com/OpenAPITools/openapi-generator/tree/master/bin/configs
|
||||
-->
|
||||
|
||||
##### Steps to reproduce
|
||||
|
||||
|
||||
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
9
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,9 +2,10 @@
|
||||
|
||||
<!-- Please check the completed items below -->
|
||||
### PR checklist
|
||||
|
||||
|
||||
- [ ] Read the [contribution guidelines](https://github.com/openapitools/openapi-generator/blob/master/CONTRIBUTING.md).
|
||||
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) before.
|
||||
- [ ] Run the shell script(s) under `./bin/` (or Windows batch scripts under`.\bin\windows`) to update Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit, and these must match the expectations made by your contribution. You only need to run `./bin/{LANG}-petstore.sh`, `./bin/openapi3/{LANG}-petstore.sh` if updating the code or mustache templates for a language (`{LANG}`) (e.g. php, ruby, python, etc).
|
||||
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`, `4.3.x`, `5.0.x`. Default: `master`.
|
||||
- [ ] Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community.
|
||||
- [ ] If contributing template-only or documentation-only changes which will change sample output, [build the project](https://github.com/OpenAPITools/openapi-generator#14---build-projects) beforehand.
|
||||
- [ ] Run the shell script `./bin/generate-samples.sh`to update all Petstore samples related to your fix. This is important, as CI jobs will verify _all_ generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example `./bin/generate-samples.sh bin/configs/java*`. For Windows users, please run the script in [Git BASH](https://gitforwindows.org/).
|
||||
- [ ] File the PR against the [correct branch](https://github.com/OpenAPITools/openapi-generator/wiki/Git-Branches): `master`
|
||||
- [ ] Copy the [technical committee](https://github.com/openapitools/openapi-generator/#62---openapi-generator-technical-committee) to review the pull request if your PR is targeting a particular programming language.
|
||||
|
||||
87
.github/workflows/check-supported-versions.yaml
vendored
Normal file
87
.github/workflows/check-supported-versions.yaml
vendored
Normal file
@@ -0,0 +1,87 @@
|
||||
name: Check Supported Java Versions
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: Build on JDK ${{ matrix.java }} and ${{ matrix.os }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
java: [8, 11]
|
||||
os: [ubuntu-latest]
|
||||
include:
|
||||
- java: 8
|
||||
os: windows-latest
|
||||
- java: 13
|
||||
os: ubuntu-latest
|
||||
# Need to update to Gradle version with v13 support in modules/openapi-generator-gradle-plugin/pom.xml
|
||||
flags: -am -pl modules/openapi-generator-cli
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Set up JDK ${{ matrix.java }}
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('pom.xml', 'modules/**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('modules/openapi-generator-gradle-plugin/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Build with Maven
|
||||
shell: bash
|
||||
run: mvn -nsu -B --quiet -Djacoco.skip=true -Dorg.slf4j.simpleLogger.defaultLogLevel=error --no-transfer-progress clean install --file pom.xml ${{ matrix.flags }}
|
||||
|
||||
- name: Test gradle
|
||||
shell: bash
|
||||
run: gradle -b modules/openapi-generator-gradle-plugin/samples/local-spec/build.gradle buildGoSdk --stacktrace
|
||||
|
||||
- name: Upload Maven build artifact
|
||||
uses: actions/upload-artifact@v1
|
||||
if: matrix.java == '8' && matrix.os == 'ubuntu-latest'
|
||||
with:
|
||||
name: artifact
|
||||
path: modules/openapi-generator-cli/target/openapi-generator-cli.jar
|
||||
|
||||
verify:
|
||||
name: Verifies integrity of the commit on ${{ matrix.os }}
|
||||
needs: build
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest]
|
||||
# include:
|
||||
# - os: windows-latest
|
||||
# flags: --skip-docs
|
||||
steps:
|
||||
- name: Check out code
|
||||
uses: actions/checkout@v2
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v1
|
||||
with:
|
||||
name: artifact
|
||||
- name: Run Ensures Script
|
||||
shell: bash
|
||||
run: |
|
||||
git config --global core.fileMode false
|
||||
git config --global core.safecrlf false
|
||||
git config --global core.autocrlf true
|
||||
mkdir -p modules/openapi-generator-cli/target/
|
||||
mv artifact/openapi-generator-cli.jar modules/openapi-generator-cli/target/
|
||||
./bin/utils/ensure-up-to-date ${{ matrix.flags }}
|
||||
75
.github/workflows/docker-tag-latest-release.yml
vendored
Normal file
75
.github/workflows/docker-tag-latest-release.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: Docker Tag latest-release
|
||||
|
||||
# Run every couple of days
|
||||
on:
|
||||
schedule:
|
||||
- cron: "30 12 */2 * *"
|
||||
|
||||
jobs:
|
||||
# This pulls all containers for the last known release tag, and tags as latest-release or x-latest-release for shared repo
|
||||
tagLatestRelease:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
|
||||
# Pull the code so we have git metadata
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v2
|
||||
|
||||
# This action will "unshallow" so we have all tag info
|
||||
- name: Get latest tag
|
||||
id: tagger
|
||||
uses: jimschubert/query-tag-action@v1
|
||||
with:
|
||||
include: 'v*'
|
||||
exclude: '*-rc*'
|
||||
commit-ish: 'HEAD~'
|
||||
|
||||
- name: DockerHub Login
|
||||
run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
|
||||
|
||||
# Tags openapitools/openapi-generator-cli
|
||||
- name: "Tag openapi-generator-cli:x"
|
||||
id: tag-openapi-generator-cli
|
||||
if: always()
|
||||
run: |
|
||||
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
|
||||
docker pull openapitools/openapi-generator-cli:${{steps.tagger.outputs.tag}}
|
||||
docker tag openapitools/openapi-generator-cli:${{steps.tagger.outputs.tag}} openapitools/openapi-generator-cli:latest-release
|
||||
docker push openapitools/openapi-generator-cli:latest-release
|
||||
|
||||
# Tags openapitools/openapi-generator-online
|
||||
- name: "Tag openapi-generator-online:x"
|
||||
id: tag-openapi-generator-online
|
||||
if: always()
|
||||
run: |
|
||||
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
|
||||
docker pull openapitools/openapi-generator-online:${{steps.tagger.outputs.tag}}
|
||||
docker tag openapitools/openapi-generator-online:${{steps.tagger.outputs.tag}} openapitools/openapi-generator-online:latest-release
|
||||
docker push openapitools/openapi-generator-online:latest-release
|
||||
|
||||
# Tags openapitools/openapi-generator's CLI image (this repo holds CLI + Online via tag prefix)
|
||||
- name: "Tag openapi-generator:cli-x"
|
||||
id: tag-cli
|
||||
if: always()
|
||||
run: |
|
||||
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
|
||||
docker pull openapitools/openapi-generator:cli-${{steps.tagger.outputs.tag}}
|
||||
docker tag openapitools/openapi-generator:cli-${{steps.tagger.outputs.tag}} openapitools/openapi-generator:cli-latest-release
|
||||
docker push openapitools/openapi-generator:cli-latest-release
|
||||
|
||||
# Tags openapitools/openapi-generator's ONLINE image (this repo holds CLI + Online via tag prefix)
|
||||
- name: "Tag openapi-generator:online-x"
|
||||
id: tag-online
|
||||
if: always()
|
||||
run: |
|
||||
echo 'Tagging as latest-release: ${{steps.tagger.outputs.tag}}'
|
||||
docker pull openapitools/openapi-generator:online-${{steps.tagger.outputs.tag}}
|
||||
docker tag openapitools/openapi-generator:online-${{steps.tagger.outputs.tag}} openapitools/openapi-generator:online-latest-release
|
||||
docker push openapitools/openapi-generator:online-latest-release
|
||||
|
||||
# Clean up docker credentials/configs/etc.
|
||||
- name: Cleanup
|
||||
if: always()
|
||||
run: |
|
||||
rm -f ${HOME}/.docker/config.json
|
||||
9
.github/workflows/sonar.yml
vendored
9
.github/workflows/sonar.yml
vendored
@@ -4,6 +4,7 @@ on:
|
||||
branches:
|
||||
- master
|
||||
- '[4-9]+.[0-9]+.x'
|
||||
- sonar
|
||||
|
||||
jobs:
|
||||
build:
|
||||
@@ -12,13 +13,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up JDK 1.8
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 1.8
|
||||
java-version: 11
|
||||
- name: Compile with Maven
|
||||
run: mvn clean package jacoco:report
|
||||
run: mvn -B -q clean install jacoco:report
|
||||
- name: Jacoco Aggregate
|
||||
run: mvn jacoco:report-aggregate
|
||||
- name: Publish to Sonar
|
||||
run: mvn -B -q sonar:sonar -Dsonar.projectKey=OpenAPITools_openapi-generator -Dsonar.organization=openapitools -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_LOGIN }} -Dsonar.branch.name=${GITHUB_REF##*/}
|
||||
run: mvn -B -q -nsu sonar:sonar -Dsonar.projectKey=OpenAPITools_openapi-generator -Dsonar.organization=openapitools -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=${{ secrets.SONAR_LOGIN }} -Dsonar.branch.name=${GITHUB_REF##*/}
|
||||
|
||||
14
.gitignore
vendored
14
.gitignore
vendored
@@ -173,10 +173,21 @@ samples/client/petstore/python-asyncio/.venv/
|
||||
samples/client/petstore/python-asyncio/.pytest_cache/
|
||||
samples/client/petstore/python-tornado/.venv/
|
||||
|
||||
# PHP
|
||||
samples/client/petstore/php/OpenAPIClient-php/composer.lock
|
||||
samples/openapi3/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
|
||||
samples/openapi3/server/petstore/php-ze-ph/composer.lock
|
||||
samples/server/petstore/php-laravel/lib/composer.lock
|
||||
samples/server/petstore/php-lumen/lib/composer.lock
|
||||
samples/server/petstore/php-slim4/composer.lock
|
||||
samples/server/petstore/php-symfony/SymfonyBundle-php/composer.lock
|
||||
samples/server/petstore/php-ze-ph/composer.lock
|
||||
|
||||
# ts
|
||||
samples/client/petstore/typescript-angular2/npm/npm-debug.log
|
||||
samples/client/petstore/typescript-node/npm/npm-debug.log
|
||||
samples/client/petstore/typescript-angular/tsd-debug.log
|
||||
samples/client/petstore/typescript-axios/tests/**/dist/
|
||||
samples/client/petstore/typescript-fetch/tests/**/dist/
|
||||
|
||||
# aspnetcore
|
||||
@@ -230,7 +241,8 @@ samples/client/petstore/dart/petstore/test/packages
|
||||
**/.dart_tool
|
||||
|
||||
# JS
|
||||
samples/client/petstore/javascript/package-lock.json
|
||||
samples/client/petstore/javascript-es6/package-lock.json
|
||||
samples/client/petstore/javascript-promise-es6/package-lock.json
|
||||
|
||||
# elm
|
||||
samples/client/petstore/elm/index.html
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
##
|
||||
## You can build _just_ this part with:
|
||||
## docker --target builder -t container-name:builder -f .hub.cli.dockerfile .
|
||||
FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
|
||||
|
||||
RUN set -x && \
|
||||
apk add --no-cache bash
|
||||
FROM maven:3.6.3-jdk-11-openj9 as builder
|
||||
|
||||
ENV GEN_DIR /opt/openapi-generator
|
||||
WORKDIR ${GEN_DIR}
|
||||
@@ -18,11 +15,10 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package
|
||||
## The final (release) image
|
||||
## The resulting container here only needs the target jar
|
||||
## and ca-certificates (to be able to query HTTPS hosted specs)
|
||||
FROM openjdk:8-jre-alpine
|
||||
FROM openjdk:11.0.8-jre-slim-buster
|
||||
|
||||
ENV GEN_DIR /opt/openapi-generator
|
||||
|
||||
RUN apk --no-cache add ca-certificates bash
|
||||
RUN mkdir -p ${GEN_DIR}/modules/openapi-generator-cli/target
|
||||
|
||||
WORKDIR ${GEN_DIR}/modules/openapi-generator-cli/target
|
||||
|
||||
@@ -3,10 +3,7 @@
|
||||
##
|
||||
## You can build _just_ this part with:
|
||||
## docker --target builder -t container-name:builder -f .hub.online.dockerfile .
|
||||
FROM jimschubert/8-jdk-alpine-mvn:1.0 as builder
|
||||
|
||||
RUN set -x && \
|
||||
apk add --no-cache bash
|
||||
FROM maven:3.6.3-jdk-11-openj9 as builder
|
||||
|
||||
ENV GEN_DIR /opt/openapi-generator
|
||||
WORKDIR ${GEN_DIR}
|
||||
@@ -17,7 +14,7 @@ RUN mvn -am -pl "modules/openapi-generator-online" package
|
||||
|
||||
## The final (release) image
|
||||
## The resulting container here only needs the target jar
|
||||
FROM openjdk:8-jre-alpine
|
||||
FROM openjdk:11.0.8-jre-slim-buster
|
||||
|
||||
ENV GEN_DIR /opt/openapi-generator
|
||||
ENV TARGET_DIR /generator
|
||||
|
||||
39
.travis.yml
39
.travis.yml
@@ -21,6 +21,10 @@ cache:
|
||||
- $HOME/samples/client/petstore/php/OpenAPIToolsClient-php/vendor
|
||||
- $HOME/samples/client/petstore/ruby/vendor/bundle
|
||||
- $HOME/samples/client/petstore/python/.venv/
|
||||
- $HOME/samples/openapi3/client/petstore/typescript/tests/default/node_modules
|
||||
- $HOME/samples/openapi3/client/petstore/typescript/tests/jquery/node_modules
|
||||
- $HOME/samples/openapi3/client/petstore/typescript/tests/object_params/node_modules
|
||||
- $HOME/samples/openapi3/client/petstore/typescript/tests/inversify/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-node/npm/node_modules
|
||||
- $HOME/samples/client/petstore/typescript-node/npm/typings/
|
||||
- $HOME/samples/client/petstore/typescript-fetch/tests/default/node_modules
|
||||
@@ -41,6 +45,7 @@ cache:
|
||||
- $HOME/.npm
|
||||
- $HOME/.rvm/gems/ruby-2.4.1
|
||||
- $HOME/website/node_modules/
|
||||
- $HOME/.cache/deno
|
||||
|
||||
services:
|
||||
- docker
|
||||
@@ -72,11 +77,13 @@ before_install:
|
||||
- docker pull swaggerapi/petstore
|
||||
- docker run -d -e SWAGGER_HOST=http://petstore.swagger.io -e SWAGGER_BASE_PATH=/v2 -p 80:8080 swaggerapi/petstore
|
||||
- docker ps -a
|
||||
# -- skip bash test to shorten build time
|
||||
# Add bats test framework and cURL for Bash script integration tests
|
||||
- sudo add-apt-repository ppa:duggan/bats --yes
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq bats
|
||||
- sudo apt-get install -qq curl
|
||||
#- sudo add-apt-repository ppa:duggan/bats --yes
|
||||
#- sudo apt-get update -qq
|
||||
#- sudo apt-get install -qq bats
|
||||
#- sudo apt-get install -qq curl
|
||||
# -- skip bash test end
|
||||
# install dart
|
||||
#- sudo apt-get update
|
||||
#- sudo apt-get install apt-transport-https
|
||||
@@ -85,11 +92,9 @@ before_install:
|
||||
#- sudo apt-get update
|
||||
#- sudo apt-get install dart
|
||||
# switch to php7
|
||||
- phpenv global 7.1
|
||||
- phpenv versions
|
||||
- phpenv global 7.2.15
|
||||
- php -v
|
||||
# install perl module
|
||||
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
|
||||
#- cpanm Test::Exception Test::More Log::Any LWP::UserAgent JSON URI:Query Module::Runtime DateTime Module::Find Moose::Role
|
||||
# comment out below as installation failed in travis
|
||||
# Add rebar3 build tool and recent Erlang/OTP for Erlang petstore server tests.
|
||||
# - Travis CI does not support rebar3 [yet](https://github.com/travis-ci/travis-ci/issues/6506#issuecomment-275189490).
|
||||
@@ -101,9 +106,11 @@ before_install:
|
||||
# install Qt5
|
||||
- sudo apt install -y --no-install-recommends qt5-default
|
||||
- cmake --version
|
||||
# -- skip perl test to shorten build time
|
||||
# perl dep
|
||||
- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
|
||||
- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Igorned failure from cpanm"
|
||||
#- cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
|
||||
#- cpanm --quiet --no-interactive Test::Exception Test::More Log::Any LWP::UserAgent URI::Query Module::Runtime DateTime Module::Find Moose::Role JSON || echo "Igorned failure from cpanm"
|
||||
# -- skip perl test end
|
||||
# show host table to confirm petstore.swagger.io is mapped to localhost
|
||||
- cat /etc/hosts
|
||||
# show java version
|
||||
@@ -114,6 +121,9 @@ before_install:
|
||||
gpg --check-trustdb ;
|
||||
fi;
|
||||
- pushd .; cd website; yarn install; popd
|
||||
# install Deno
|
||||
- curl -fsSL https://deno.land/x/install/install.sh | sh -s v1.1.2
|
||||
- export PATH="$HOME/.deno/bin:$PATH"
|
||||
|
||||
install:
|
||||
# Add Godeps dependencies to GOPATH and PATH
|
||||
@@ -130,7 +140,6 @@ install:
|
||||
script:
|
||||
# fail fast
|
||||
- set -e
|
||||
- ./run-in-docker.sh mvn clean package
|
||||
# fail if templates/generators contain carriage return '\r'
|
||||
- /bin/bash ./bin/utils/detect_carriage_return.sh
|
||||
# fail if generators contain merge conflicts
|
||||
@@ -141,14 +150,6 @@ script:
|
||||
# WARN: Travis will timeout after 10 minutes of no stdout/stderr activity, which is problematic with mvn --quiet.
|
||||
- mvn --no-snapshot-updates --quiet --batch-mode --show-version clean install -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- mvn --no-snapshot-updates --quiet --batch-mode --show-version verify -Psamples -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
# test maven plugin
|
||||
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/java-client.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/multi-module/pom.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/kotlin.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
- mvn --no-snapshot-updates --quiet clean compile -f modules/openapi-generator-maven-plugin/examples/spring.xml -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
# test gradle plugin
|
||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew buildGoSdk)
|
||||
- (cd modules/openapi-generator-gradle-plugin/samples/local-spec && ./gradlew openApiGenerate)
|
||||
after_success:
|
||||
# push to maven repo
|
||||
- if [ $SONATYPE_USERNAME ] && [ "$TRAVIS_PULL_REQUEST" == "false" ]; then
|
||||
|
||||
@@ -38,6 +38,6 @@ steps:
|
||||
# generate test scripts
|
||||
- /bin/bash bin/tests/run-all-test
|
||||
# generate all petstore samples (client, servers, doc)
|
||||
- /bin/bash bin/run-all-petstore
|
||||
- /bin/bash bin/generate-samples.sh
|
||||
# generate all petstore samples (openapi3)
|
||||
- /bin/bash bin/openapi3/run-all-petstore
|
||||
- /bin/bash bin/generate-samples.sh bin/configs/other/*.yaml
|
||||
|
||||
@@ -14,14 +14,14 @@ workflows:
|
||||
- brew-install@0.10.2:
|
||||
inputs:
|
||||
- packages: maven
|
||||
- script@1.1.5:
|
||||
- script@1.1.6:
|
||||
title: Install Cocoapods
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
|
||||
sudo gem install cocoapods
|
||||
- script@1.1.5:
|
||||
- script@1.1.6:
|
||||
inputs:
|
||||
- content: |
|
||||
#!/usr/bin/env bash
|
||||
@@ -30,7 +30,7 @@ workflows:
|
||||
|
||||
mvn --no-snapshot-updates package -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
title: Build openapi-generator
|
||||
- script@1.1.5:
|
||||
- script@1.1.6:
|
||||
title: Update Swift samples
|
||||
inputs:
|
||||
- content: |
|
||||
@@ -38,8 +38,8 @@ workflows:
|
||||
|
||||
set -e
|
||||
|
||||
sh bin/swift5-all.sh
|
||||
- script@1.1.5:
|
||||
bin/generate-samples.sh ./bin/configs/other/swift5-*
|
||||
- script@1.1.6:
|
||||
title: Run Swift5 tests
|
||||
inputs:
|
||||
- content: |
|
||||
@@ -48,14 +48,4 @@ workflows:
|
||||
set -e
|
||||
|
||||
./samples/client/test/swift5/swift5_test_all.sh
|
||||
# comment out the following as it's causing timeout
|
||||
# - script@1.1.5:
|
||||
# title: Run all bin scripts
|
||||
# inputs:
|
||||
# - content: |-
|
||||
# #!/usr/bin/env bash
|
||||
#
|
||||
# set -e
|
||||
#
|
||||
# ./bin/run-all-petstore
|
||||
|
||||
|
||||
@@ -17,15 +17,11 @@ trap cleanup EXIT
|
||||
if [ "$NODE_INDEX" = "1" ]; then
|
||||
echo "Running node $NODE_INDEX to test 'samples.circleci' defined in pom.xml ..."
|
||||
java -version
|
||||
# Install golang version 1.14
|
||||
go version
|
||||
sudo mkdir /usr/local/go1.14
|
||||
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
|
||||
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
||||
go version
|
||||
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
|
||||
echo "show ivy2 cache"
|
||||
ls -l /home/circleci/.ivy2/cache
|
||||
|
||||
elif [ "$NODE_INDEX" = "2" ]; then
|
||||
# run ensure-up-to-date sample script on SNAPSHOT version only
|
||||
@@ -40,7 +36,6 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
# look for outdated samples
|
||||
./bin/utils/ensure-up-to-date
|
||||
fi
|
||||
#elif [ "$NODE_INDEX" = "3" ]; then
|
||||
echo "Running node $NODE_INDEX to test haskell"
|
||||
# install haskell
|
||||
curl -sSL https://get.haskellstack.org/ | sh
|
||||
@@ -60,10 +55,17 @@ elif [ "$NODE_INDEX" = "2" ]; then
|
||||
# run integration tests
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.misc -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
else
|
||||
echo "Running node $NODE_INDEX to test 'samples.circleci.jdk7' defined in pom.xml ..."
|
||||
sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
|
||||
echo "Running node $NODE_INDEX to test 'samples.circleci.others' defined in pom.xml ..."
|
||||
#sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
|
||||
java -version
|
||||
|
||||
# Install golang version 1.14
|
||||
go version
|
||||
sudo mkdir /usr/local/go1.14
|
||||
wget -c https://dl.google.com/go/go1.14.linux-amd64.tar.gz -O - | sudo tar -xz -C /usr/local/go1.14
|
||||
export PATH="/usr/local/go1.14/go/bin:$PATH"
|
||||
go version
|
||||
|
||||
# install dart2
|
||||
sudo apt-get update
|
||||
sudo apt-get install apt-transport-https
|
||||
@@ -73,7 +75,8 @@ else
|
||||
sudo apt-get install dart
|
||||
export PATH="$PATH:/usr/lib/dart/bin"
|
||||
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.jdk7 -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
mvn --no-snapshot-updates --quiet verify -Psamples.circleci.others -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
mvn --no-snapshot-updates --quiet javadoc:javadoc -Psamples.circleci -Dorg.slf4j.simpleLogger.defaultLogLevel=error
|
||||
fi
|
||||
|
||||
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
|
||||
-->
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj">
|
||||
<Name>Org.OpenAPITools</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="linux-logo.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,23 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Org.OpenAPITools.Test")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Org.OpenAPITools.Test")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Org.OpenAPITools.Test")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
19e887ae0fddb9fd03c4341951ee9077703a652f
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
OpenAPI spec version: 1.0.0
|
||||
|
||||
-->
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj">
|
||||
<Name>Org.OpenAPITools</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="linux-logo.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -1,23 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Org.OpenAPITools.Test")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Org.OpenAPITools.Test")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Org.OpenAPITools.Test")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
// Generated by the MSBuild WriteCodeFragment class.
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
19e887ae0fddb9fd03c4341951ee9077703a652f
|
||||
@@ -1,92 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
OpenAPI Petstore
|
||||
|
||||
This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
|
||||
The version of the OpenAPI document: 1.0.0
|
||||
|
||||
-->
|
||||
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{19F1DEBC-DE5E-4517-8062-F000CD499087}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Org.OpenAPITools.Test</RootNamespace>
|
||||
<AssemblyName>Org.OpenAPITools.Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Newtonsoft.Json">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="JsonSubTypes">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\JsonSubTypes.1.6.0\lib\net45\JsonSubTypes.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\RestSharp.105.1.0\lib\net45\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework">
|
||||
<HintPath Condition="Exists('$(SolutionDir)\packages')">$(SolutionDir)\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\packages')">..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\packages')">..\..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
<HintPath Condition="Exists('..\..\vendor')">..\..\vendor\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="**\*.cs"
|
||||
Exclude="obj\**"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MsBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Org.OpenAPITools\Org.OpenAPITools.csproj">
|
||||
<Project>{321C8C3F-0156-40C1-AE42-D59761FB9B6C}</Project>
|
||||
<Name>Org.OpenAPITools</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="linux-logo.png" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Binary file not shown.
@@ -1,122 +0,0 @@
|
||||
apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
group = 'org.openapitools'
|
||||
version = '1.0.0'
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
jcenter {
|
||||
url "https://jcenter.bintray.com/"
|
||||
}
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:2.3.+'
|
||||
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
jcenter {
|
||||
url "http://jcenter.bintray.com/"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(hasProperty('target') && target == 'android') {
|
||||
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'com.github.dcendents.android-maven'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
buildToolsVersion '25.0.2'
|
||||
defaultConfig {
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
}
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_6
|
||||
targetCompatibility JavaVersion.VERSION_1_6
|
||||
}
|
||||
|
||||
// Rename the aar correctly
|
||||
libraryVariants.all { variant ->
|
||||
variant.outputs.each { output ->
|
||||
def outputFile = output.outputFile
|
||||
if (outputFile != null && outputFile.name.endsWith('.aar')) {
|
||||
def fileName = "${project.name}-${variant.baseName}-${version}.aar"
|
||||
output.outputFile = new File(outputFile.parent, fileName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
provided 'javax.annotation:jsr250-api:1.0'
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
android.libraryVariants.all { variant ->
|
||||
def task = project.tasks.create "jar${variant.name.capitalize()}", Jar
|
||||
task.description = "Create jar artifact for ${variant.name}"
|
||||
task.dependsOn variant.javaCompile
|
||||
task.from variant.javaCompile.destinationDir
|
||||
task.destinationDir = project.file("${project.buildDir}/outputs/jar")
|
||||
task.archiveName = "${project.name}-${variant.baseName}-${version}.jar"
|
||||
artifacts.add('archives', task);
|
||||
}
|
||||
}
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
from android.sourceSets.main.java.srcDirs
|
||||
classifier = 'sources'
|
||||
}
|
||||
|
||||
artifacts {
|
||||
archives sourcesJar
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'maven'
|
||||
sourceCompatibility = JavaVersion.VERSION_1_6
|
||||
targetCompatibility = JavaVersion.VERSION_1_6
|
||||
|
||||
install {
|
||||
repositories.mavenInstaller {
|
||||
pom.artifactId = 'petstore-jersey2-java6'
|
||||
}
|
||||
}
|
||||
|
||||
task execute(type:JavaExec) {
|
||||
main = System.getProperty('mainClass')
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
}
|
||||
}
|
||||
|
||||
ext {
|
||||
swagger_annotations_version = "1.5.20"
|
||||
jackson_version = "2.9.6"
|
||||
jersey_version = "2.6"
|
||||
commons_io_version=2.5
|
||||
commons_lang3_version=3.6
|
||||
junit_version = "4.13"
|
||||
threetenbp_version = "2.6.4"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile "io.swagger:swagger-annotations:$swagger_annotations_version"
|
||||
compile "org.glassfish.jersey.core:jersey-client:$jersey_version"
|
||||
compile "org.glassfish.jersey.media:jersey-media-multipart:$jersey_version"
|
||||
compile "org.glassfish.jersey.media:jersey-media-json-jackson:$jersey_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-core:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-annotations:$jackson_version"
|
||||
compile "com.fasterxml.jackson.core:jackson-databind:$jackson_version"
|
||||
compile "commons-io:commons-io:$commons_io_version"
|
||||
compile "org.apache.commons:commons-lang3:$commons_lang3_version"
|
||||
compile "com.github.joschi.jackson:jackson-datatype-threetenbp:$threetenbp_version"
|
||||
compile "com.brsanthu:migbase64:2.2"
|
||||
testCompile "junit:junit:$junit_version"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ConfigurationTest {
|
||||
@Test
|
||||
public void testDefaultApiClient() {
|
||||
ApiClient apiClient = Configuration.getDefaultApiClient();
|
||||
assertNotNull(apiClient);
|
||||
assertEquals("http://petstore.swagger.io:80/v2", apiClient.getBasePath());
|
||||
assertFalse(apiClient.isDebugging());
|
||||
}
|
||||
}
|
||||
@@ -1,291 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.openapitools.client.auth.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ApiClientTest {
|
||||
ApiClient apiClient = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
apiClient = new ApiClient();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseAndFormatDate() {
|
||||
// default date format
|
||||
String dateStr = "2015-11-07T03:49:09.356Z";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
|
||||
|
||||
// custom date format: without milli-seconds, custom time zone
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
|
||||
apiClient.setDateFormat(format);
|
||||
dateStr = "2015-11-07T13:49:09+10:00";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsJsonMime() {
|
||||
assertFalse(apiClient.isJsonMime(null));
|
||||
assertFalse(apiClient.isJsonMime(""));
|
||||
assertFalse(apiClient.isJsonMime("text/plain"));
|
||||
assertFalse(apiClient.isJsonMime("application/xml"));
|
||||
assertFalse(apiClient.isJsonMime("application/jsonp"));
|
||||
assertFalse(apiClient.isJsonMime("example/json"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/json"));
|
||||
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/problem+json"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
|
||||
assertTrue(apiClient.isJsonMime("application/json\t"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
|
||||
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderAccept() {
|
||||
String[] accepts = {"application/json", "application/xml"};
|
||||
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
|
||||
assertEquals("APPLICATION/JSON", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{};
|
||||
assertNull(apiClient.selectHeaderAccept(accepts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderContentType() {
|
||||
String[] contentTypes = {"application/json", "application/xml"};
|
||||
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
|
||||
assertEquals("APPLICATION/JSON", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{};
|
||||
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAuthentications() {
|
||||
Map<String, Authentication> auths = apiClient.getAuthentications();
|
||||
|
||||
Authentication auth = auths.get("api_key");
|
||||
assertNotNull(auth);
|
||||
assertTrue(auth instanceof ApiKeyAuth);
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
|
||||
assertEquals("header", apiKeyAuth.getLocation());
|
||||
assertEquals("api_key", apiKeyAuth.getParamName());
|
||||
|
||||
auth = auths.get("petstore_auth");
|
||||
assertTrue(auth instanceof OAuth);
|
||||
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
|
||||
|
||||
assertNull(auths.get("unknown"));
|
||||
|
||||
try {
|
||||
auths.put("my_auth", new HttpBasicAuth());
|
||||
fail("the authentications returned should not be modifiable");
|
||||
} catch (UnsupportedOperationException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetUsernameAndPassword() {
|
||||
HttpBasicAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof HttpBasicAuth) {
|
||||
auth = (HttpBasicAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
|
||||
apiClient.setUsername("my-username");
|
||||
apiClient.setPassword("my-password");
|
||||
assertEquals("my-username", auth.getUsername());
|
||||
assertEquals("my-password", auth.getPassword());
|
||||
|
||||
// reset values
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetApiKeyAndPrefix() {
|
||||
ApiKeyAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof ApiKeyAuth) {
|
||||
auth = (ApiKeyAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
|
||||
apiClient.setApiKey("my-api-key");
|
||||
apiClient.setApiKeyPrefix("Token");
|
||||
assertEquals("my-api-key", auth.getApiKey());
|
||||
assertEquals("Token", auth.getApiKeyPrefix());
|
||||
|
||||
// reset values
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenNameIsInvalid() throws Exception {
|
||||
List<Pair> pairs_a = apiClient.parameterToPair(null, new Integer(1));
|
||||
List<Pair> pairs_b = apiClient.parameterToPair("", new Integer(1));
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsNull() throws Exception {
|
||||
List<Pair> pairs = apiClient.parameterToPair("param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsEmptyString() throws Exception {
|
||||
// single empty string
|
||||
List<Pair> pairs = apiClient.parameterToPair("param-a", " ");
|
||||
assertEquals(1, pairs.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsNotCollection() throws Exception {
|
||||
String name = "param-a";
|
||||
Integer value = 1;
|
||||
|
||||
List<Pair> pairs = apiClient.parameterToPair(name, value);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsCollection() throws Exception {
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
List<Pair> pairs = apiClient.parameterToPair("param-a", values);
|
||||
assertEquals(0, pairs.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
|
||||
List<Integer> objects = new ArrayList<Integer>();
|
||||
objects.add(new Integer(1));
|
||||
|
||||
List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, objects);
|
||||
List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", objects);
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsNull() throws Exception {
|
||||
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
|
||||
// list of empty strings
|
||||
List<String> strs = new ArrayList<String>();
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
|
||||
List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs);
|
||||
|
||||
assertEquals(1, concatStrings.size());
|
||||
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsCollection() throws Exception {
|
||||
Map<String, String> collectionFormatMap = new HashMap<String, String>();
|
||||
collectionFormatMap.put("csv", ",");
|
||||
collectionFormatMap.put("tsv", "\t");
|
||||
collectionFormatMap.put("ssv", " ");
|
||||
collectionFormatMap.put("pipes", "|");
|
||||
collectionFormatMap.put("", ","); // no format, must default to csv
|
||||
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
|
||||
|
||||
String name = "param-a";
|
||||
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
// check for multi separately
|
||||
List<Pair> multiPairs = apiClient.parameterToPairs("multi", name, values);
|
||||
assertEquals(values.size(), multiPairs.size());
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), multiPairs.get(i).getValue());
|
||||
}
|
||||
|
||||
// all other formats
|
||||
for (String collectionFormat : collectionFormatMap.keySet()) {
|
||||
List<Pair> pairs = apiClient.parameterToPairs(collectionFormat, name, values);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
String delimiter = collectionFormatMap.get(collectionFormat);
|
||||
if (!delimiter.equals(",")) {
|
||||
// commas are not escaped because they are reserved characters in URIs
|
||||
delimiter = apiClient.escapeString(delimiter);
|
||||
}
|
||||
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
|
||||
|
||||
// must equal input values
|
||||
assertEquals(values.size(), pairValueSplit.length);
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), pairValueSplit[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,71 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.openapitools.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ApiKeyAuthTest {
|
||||
@Test
|
||||
public void testApplyToParamsInQuery() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
|
||||
auth.setApiKey("my-api-key");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
assertEquals(1, queryParams.size());
|
||||
for (Pair queryParam : queryParams) {
|
||||
assertEquals("my-api-key", queryParam.getValue());
|
||||
}
|
||||
|
||||
// no changes to header or cookie parameters
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInHeaderWithPrefix() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or cookie parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
|
||||
assertEquals(1, headerParams.size());
|
||||
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInCookieWithPrefix() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or header parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
|
||||
assertEquals(1, cookieParams.size());
|
||||
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.openapitools.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class HttpBasicAuthTest {
|
||||
HttpBasicAuth auth = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
auth = new HttpBasicAuth();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParams() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword("my-password");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or cookie parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
|
||||
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
|
||||
// null username should be treated as empty string
|
||||
auth.setUsername(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
|
||||
expected = "Basic Om15LXBhc3N3b3Jk";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
|
||||
// null password should be treated as empty string
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
|
||||
expected = "Basic bXktdXNlcm5hbWU6";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class EnumValueTest {
|
||||
|
||||
@Test
|
||||
public void testEnumClass() {
|
||||
assertEquals(EnumClass._ABC.toString(), "_abc");
|
||||
assertEquals(EnumClass._EFG.toString(), "-efg");
|
||||
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnumTest() {
|
||||
// test enum value
|
||||
EnumTest enumTest = new EnumTest();
|
||||
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
|
||||
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
|
||||
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
|
||||
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
|
||||
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
|
||||
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
|
||||
|
||||
try {
|
||||
// test serialization (object => json)
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
ObjectWriter ow = mapper.writer();
|
||||
String json = ow.writeValueAsString(enumTest);
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_string_required\":null,\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
|
||||
|
||||
// test deserialization (json => object)
|
||||
EnumTest fromString = mapper.readValue(json, EnumTest.class);
|
||||
assertEquals(fromString.getEnumString().toString(), "lower");
|
||||
assertEquals(fromString.getEnumInteger().toString(), "1");
|
||||
assertEquals(fromString.getEnumNumber().toString(), "1.1");
|
||||
|
||||
} catch (Exception e) {
|
||||
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,68 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.openapitools.client.model.Mammal;
|
||||
import org.openapitools.client.model.AppleReq;
|
||||
import org.openapitools.client.model.BananaReq;
|
||||
import org.openapitools.client.model.FruitReq;
|
||||
import org.openapitools.client.model.BasquePig;
|
||||
import org.openapitools.client.model.Pig;
|
||||
import org.openapitools.client.model.Whale;
|
||||
import org.openapitools.client.model.Zebra;
|
||||
import java.lang.Exception;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class JSONComposedSchemaTest {
|
||||
JSON json = null;
|
||||
Mammal mammal = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
json = new JSON();
|
||||
mammal = new Mammal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a oneOf schema can be deserialized into the expected class.
|
||||
* The oneOf schema does not have a discriminator.
|
||||
*/
|
||||
@Test
|
||||
public void testOneOfSchemaWithoutDiscriminator() throws Exception {
|
||||
// BananaReq and AppleReq have explicitly defined properties that are different by name.
|
||||
// There is no discriminator property.
|
||||
String str = "{ \"cultivar\": \"golden delicious\", \"mealy\": false }";
|
||||
FruitReq o = json.getContext(null).readValue(str, FruitReq.class);
|
||||
assertTrue(o.getActualInstance() instanceof AppleReq);
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a oneOf schema can be deserialized into the expected class.
|
||||
* The oneOf schema has a discriminator.
|
||||
*/
|
||||
@Test
|
||||
public void testOneOfSchemaWithDiscriminator() throws Exception {
|
||||
// Mammal can be one of whale, pig and zebra.
|
||||
// pig has sub-classes.
|
||||
String str = "{ \"className\": \"whale\", \"hasBaleen\": true, \"hasTeeth\": false }";
|
||||
/*
|
||||
DISABLING unit test for now until ambiguity of discriminator is resolved.
|
||||
|
||||
// Note that the 'zebra' schema does not have any explicit property defined AND
|
||||
// it has additionalProperties: true. Hence without a discriminator the above
|
||||
// JSON payload would match both 'whale' and 'zebra'. This is because the 'hasBaleen'
|
||||
// and 'hasTeeth' would be considered additional (undeclared) properties for 'zebra'.
|
||||
Mammal o = json.getContext(null).readValue(str, Mammal.class);
|
||||
assertTrue(o.getActualInstance() instanceof Whale);
|
||||
|
||||
str = "{ \"className\": \"zebra\" }";
|
||||
o = json.getContext(null).readValue(str, Mammal.class);
|
||||
assertTrue(o.getActualInstance() instanceof Zebra);
|
||||
|
||||
str = "{ \"className\": \"BasquePig\" }";
|
||||
o = json.getContext(null).readValue(str, Mammal.class);
|
||||
assertTrue(o.getActualInstance() instanceof BasquePig);
|
||||
*/
|
||||
}
|
||||
}
|
||||
@@ -1,45 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.openapitools.client.model.Order;
|
||||
|
||||
import java.lang.Exception;
|
||||
|
||||
import java.time.OffsetDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class JSONTest {
|
||||
JSON json = null;
|
||||
Order order = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
json = new JSON();
|
||||
order = new Order();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultDate() throws Exception {
|
||||
final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
final String dateStr = "2015-11-07T14:11:05.267Z";
|
||||
order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime::from));
|
||||
|
||||
String str = json.getContext(null).writeValueAsString(order);
|
||||
Order o = json.getContext(null).readValue(str, Order.class);
|
||||
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomDate() throws Exception {
|
||||
final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Etc/GMT+2"));
|
||||
final String dateStr = "2015-11-07T14:11:05-02:00";
|
||||
order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime::from));
|
||||
|
||||
String str = json.getContext(null).writeValueAsString(order);
|
||||
Order o = json.getContext(null).readValue(str, Order.class);
|
||||
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
|
||||
}
|
||||
}
|
||||
@@ -1,249 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.openapitools.client.auth.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ApiClientTest {
|
||||
ApiClient apiClient = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
apiClient = new ApiClient();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseAndFormatDate() {
|
||||
// default date format
|
||||
String dateStr = "2015-11-07T03:49:09.356Z";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
|
||||
|
||||
// custom date format: without milli-seconds, custom time zone
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
|
||||
apiClient.setDateFormat(format);
|
||||
dateStr = "2015-11-07T13:49:09+10:00";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsJsonMime() {
|
||||
assertFalse(apiClient.isJsonMime(null));
|
||||
assertFalse(apiClient.isJsonMime(""));
|
||||
assertFalse(apiClient.isJsonMime("text/plain"));
|
||||
assertFalse(apiClient.isJsonMime("application/xml"));
|
||||
assertFalse(apiClient.isJsonMime("application/jsonp"));
|
||||
assertFalse(apiClient.isJsonMime("example/json"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/json"));
|
||||
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/problem+json"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
|
||||
assertTrue(apiClient.isJsonMime("application/json\t"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
|
||||
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderAccept() {
|
||||
String[] accepts = {"application/json", "application/xml"};
|
||||
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
|
||||
assertEquals("APPLICATION/JSON", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{};
|
||||
assertNull(apiClient.selectHeaderAccept(accepts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderContentType() {
|
||||
String[] contentTypes = {"application/json", "application/xml"};
|
||||
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
|
||||
assertEquals("APPLICATION/JSON", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{};
|
||||
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAuthentications() {
|
||||
Map<String, Authentication> auths = apiClient.getAuthentications();
|
||||
|
||||
Authentication auth = auths.get("api_key");
|
||||
assertNotNull(auth);
|
||||
assertTrue(auth instanceof ApiKeyAuth);
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
|
||||
assertEquals("header", apiKeyAuth.getLocation());
|
||||
assertEquals("api_key", apiKeyAuth.getParamName());
|
||||
|
||||
auth = auths.get("petstore_auth");
|
||||
assertTrue(auth instanceof OAuth);
|
||||
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
|
||||
|
||||
assertNull(auths.get("unknown"));
|
||||
|
||||
try {
|
||||
auths.put("my_auth", new HttpBasicAuth());
|
||||
fail("the authentications returned should not be modifiable");
|
||||
} catch (UnsupportedOperationException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetUsernameAndPassword() {
|
||||
HttpBasicAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof HttpBasicAuth) {
|
||||
auth = (HttpBasicAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
|
||||
apiClient.setUsername("my-username");
|
||||
apiClient.setPassword("my-password");
|
||||
assertEquals("my-username", auth.getUsername());
|
||||
assertEquals("my-password", auth.getPassword());
|
||||
|
||||
// reset values
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetApiKeyAndPrefix() {
|
||||
ApiKeyAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof ApiKeyAuth) {
|
||||
auth = (ApiKeyAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
|
||||
apiClient.setApiKey("my-api-key");
|
||||
apiClient.setApiKeyPrefix("Token");
|
||||
assertEquals("my-api-key", auth.getApiKey());
|
||||
assertEquals("Token", auth.getApiKeyPrefix());
|
||||
|
||||
// reset values
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
|
||||
List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, new Integer(1));
|
||||
List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", new Integer(1));
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsNull() throws Exception {
|
||||
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
|
||||
|
||||
// single empty string
|
||||
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", " ");
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
// list of empty strings
|
||||
List<String> strs = new ArrayList<String>();
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
|
||||
List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs);
|
||||
|
||||
assertEquals(1, concatStrings.size());
|
||||
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsNotCollection() throws Exception {
|
||||
String name = "param-a";
|
||||
Integer value = 1;
|
||||
|
||||
List<Pair> pairs = apiClient.parameterToPairs("csv", name, value);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsCollection() throws Exception {
|
||||
Map<String, String> collectionFormatMap = new HashMap<String, String>();
|
||||
collectionFormatMap.put("csv", ",");
|
||||
collectionFormatMap.put("tsv", "\t");
|
||||
collectionFormatMap.put("ssv", " ");
|
||||
collectionFormatMap.put("pipes", "\\|");
|
||||
collectionFormatMap.put("", ","); // no format, must default to csv
|
||||
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
|
||||
|
||||
String name = "param-a";
|
||||
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
// check for multi separately
|
||||
List<Pair> multiPairs = apiClient.parameterToPairs("multi", name, values);
|
||||
assertEquals(values.size(), multiPairs.size());
|
||||
|
||||
// all other formats
|
||||
for (String collectionFormat : collectionFormatMap.keySet()) {
|
||||
List<Pair> pairs = apiClient.parameterToPairs(collectionFormat, name, values);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
String delimiter = collectionFormatMap.get(collectionFormat);
|
||||
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
|
||||
|
||||
// must equal input values
|
||||
assertEquals(values.size(), pairValueSplit.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.openapitools.client.model.Order;
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.threeten.bp.ZoneId;
|
||||
import org.threeten.bp.format.DateTimeFormatter;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class JSONTest {
|
||||
private JSON json = null;
|
||||
private Order order = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
json = new ApiClient().getJSON();
|
||||
order = new Order();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultDate() throws Exception {
|
||||
final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
final String dateStr = "2015-11-07T14:11:05.267Z";
|
||||
order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime.FROM));
|
||||
|
||||
String str = json.getContext(null).writeValueAsString(order);
|
||||
Order o = json.getContext(null).readValue(str, Order.class);
|
||||
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomDate() throws Exception {
|
||||
final DateTimeFormatter dateFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Etc/GMT+2"));
|
||||
final String dateStr = "2015-11-07T14:11:05-02:00";
|
||||
order.setShipDate(dateFormat.parse(dateStr, OffsetDateTime.FROM));
|
||||
|
||||
String str = json.getContext(null).writeValueAsString(order);
|
||||
Order o = json.getContext(null).readValue(str, Order.class);
|
||||
assertEquals(dateStr, dateFormat.format(o.getShipDate()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSqlDateSerialization() throws Exception {
|
||||
String str = json.getContext(null).writeValueAsString(new java.sql.Date(10));
|
||||
assertEquals("\"1970-01-01\"", str);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSqlDateDeserialization() throws Exception {
|
||||
final String str = "1970-01-01";
|
||||
java.sql.Date date = json.getContext(null).readValue("\"" + str + "\"", java.sql.Date.class);
|
||||
assertEquals(date.toString(), str);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ApiKeyAuthTest {
|
||||
@Test
|
||||
public void testApplyToParamsInQuery() throws ApiException {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
|
||||
auth.setApiKey("my-api-key");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
|
||||
|
||||
assertEquals(1, queryParams.size());
|
||||
for (Pair queryParam : queryParams) {
|
||||
assertEquals("my-api-key", queryParam.getValue());
|
||||
}
|
||||
|
||||
// no changes to header or cookie parameters
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInHeaderWithPrefix() throws ApiException {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
|
||||
|
||||
// no changes to query parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInCookieWithPrefix() throws ApiException {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
|
||||
|
||||
// no changes to query or header parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(1, cookieParams.size());
|
||||
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
|
||||
}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class HttpBasicAuthTest {
|
||||
HttpBasicAuth auth = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
auth = new HttpBasicAuth();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParams() throws ApiException {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword("my-password");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
|
||||
|
||||
// no changes to query parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
|
||||
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
|
||||
// null username should be treated as empty string
|
||||
auth.setUsername(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
|
||||
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
|
||||
expected = "Basic Om15LXBhc3N3b3Jk";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
|
||||
// null password should be treated as empty string
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams, null, null, null);
|
||||
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
|
||||
expected = "Basic bXktdXNlcm5hbWU6";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class EnumValueTest {
|
||||
|
||||
@Test
|
||||
public void testEnumClass() {
|
||||
assertEquals(EnumClass._ABC.toString(), "_abc");
|
||||
assertEquals(EnumClass._EFG.toString(), "-efg");
|
||||
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnumTest() {
|
||||
// test enum value
|
||||
EnumTest enumTest = new EnumTest();
|
||||
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
|
||||
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
|
||||
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
|
||||
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
|
||||
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
|
||||
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
|
||||
|
||||
try {
|
||||
// test serialization (object => json)
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
ObjectWriter ow = mapper.writer();
|
||||
String json = ow.writeValueAsString(enumTest);
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_string_required\":null,\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
|
||||
|
||||
// test deserialization (json => object)
|
||||
EnumTest fromString = mapper.readValue(json, EnumTest.class);
|
||||
assertEquals(fromString.getEnumString().toString(), "lower");
|
||||
assertEquals(fromString.getEnumInteger().toString(), "1");
|
||||
assertEquals(fromString.getEnumNumber().toString(), "1.1");
|
||||
|
||||
} catch (Exception e) {
|
||||
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,347 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import okhttp3.OkHttpClient;
|
||||
import org.openapitools.client.auth.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
|
||||
public class ApiClientTest {
|
||||
ApiClient apiClient;
|
||||
JSON json;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
apiClient = new ApiClient();
|
||||
json = apiClient.getJSON();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsJsonMime() {
|
||||
assertFalse(apiClient.isJsonMime(null));
|
||||
assertFalse(apiClient.isJsonMime(""));
|
||||
assertFalse(apiClient.isJsonMime("text/plain"));
|
||||
assertFalse(apiClient.isJsonMime("application/xml"));
|
||||
assertFalse(apiClient.isJsonMime("application/jsonp"));
|
||||
assertFalse(apiClient.isJsonMime("example/json"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/json"));
|
||||
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/problem+json"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
|
||||
assertTrue(apiClient.isJsonMime("application/json\t"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
|
||||
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/json-patch+json"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderAccept() {
|
||||
String[] accepts = {"application/json", "application/xml"};
|
||||
assertEquals("application/json", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
|
||||
assertEquals("APPLICATION/JSON", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals("text/plain,application/xml", apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{};
|
||||
assertNull(apiClient.selectHeaderAccept(accepts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderContentType() {
|
||||
String[] contentTypes = {"application/json", "application/xml"};
|
||||
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
|
||||
assertEquals("APPLICATION/JSON", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals("application/json; charset=UTF8", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals("text/plain", apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{};
|
||||
assertEquals("application/json", apiClient.selectHeaderContentType(contentTypes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAuthentications() {
|
||||
Map<String, Authentication> auths = apiClient.getAuthentications();
|
||||
|
||||
Authentication auth = auths.get("api_key");
|
||||
assertNotNull(auth);
|
||||
assertTrue(auth instanceof ApiKeyAuth);
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
|
||||
assertEquals("header", apiKeyAuth.getLocation());
|
||||
assertEquals("api_key", apiKeyAuth.getParamName());
|
||||
|
||||
auth = auths.get("petstore_auth");
|
||||
assertTrue(auth instanceof OAuth);
|
||||
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
|
||||
|
||||
assertNull(auths.get("unknown"));
|
||||
|
||||
try {
|
||||
auths.put("my_auth", new HttpBasicAuth());
|
||||
fail("the authentications returned should not be modifiable");
|
||||
} catch (UnsupportedOperationException e) {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void testSetUsernameAndPassword() {
|
||||
HttpBasicAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof HttpBasicAuth) {
|
||||
auth = (HttpBasicAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
|
||||
apiClient.setUsername("my-username");
|
||||
apiClient.setPassword("my-password");
|
||||
assertEquals("my-username", auth.getUsername());
|
||||
assertEquals("my-password", auth.getPassword());
|
||||
|
||||
// reset values
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
}
|
||||
*/
|
||||
|
||||
@Test
|
||||
public void testSetApiKeyAndPrefix() {
|
||||
ApiKeyAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof ApiKeyAuth) {
|
||||
auth = (ApiKeyAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
|
||||
apiClient.setApiKey("my-api-key");
|
||||
apiClient.setApiKeyPrefix("Token");
|
||||
assertEquals("my-api-key", auth.getApiKey());
|
||||
assertEquals("Token", auth.getApiKeyPrefix());
|
||||
|
||||
// reset values
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAndSetConnectTimeout() {
|
||||
// connect timeout defaults to 10 seconds
|
||||
assertEquals(10000, apiClient.getConnectTimeout());
|
||||
assertEquals(10000, apiClient.getHttpClient().connectTimeoutMillis());
|
||||
|
||||
apiClient.setConnectTimeout(0);
|
||||
assertEquals(0, apiClient.getConnectTimeout());
|
||||
assertEquals(0, apiClient.getHttpClient().connectTimeoutMillis());
|
||||
|
||||
apiClient.setConnectTimeout(10000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAndSetReadTimeout() {
|
||||
// read timeout defaults to 10 seconds
|
||||
assertEquals(10000, apiClient.getReadTimeout());
|
||||
assertEquals(10000, apiClient.getHttpClient().readTimeoutMillis());
|
||||
|
||||
apiClient.setReadTimeout(0);
|
||||
assertEquals(0, apiClient.getReadTimeout());
|
||||
assertEquals(0, apiClient.getHttpClient().readTimeoutMillis());
|
||||
|
||||
apiClient.setReadTimeout(10000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAndSetWriteTimeout() {
|
||||
// write timeout defaults to 10 seconds
|
||||
assertEquals(10000, apiClient.getWriteTimeout());
|
||||
assertEquals(10000, apiClient.getHttpClient().writeTimeoutMillis());
|
||||
|
||||
apiClient.setWriteTimeout(0);
|
||||
assertEquals(0, apiClient.getWriteTimeout());
|
||||
assertEquals(0, apiClient.getHttpClient().writeTimeoutMillis());
|
||||
|
||||
apiClient.setWriteTimeout(10000);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenNameIsInvalid() throws Exception {
|
||||
List<Pair> pairs_a = apiClient.parameterToPair(null, new Integer(1));
|
||||
List<Pair> pairs_b = apiClient.parameterToPair("", new Integer(1));
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsNull() throws Exception {
|
||||
List<Pair> pairs = apiClient.parameterToPair("param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsEmptyString() throws Exception {
|
||||
// single empty string
|
||||
List<Pair> pairs = apiClient.parameterToPair("param-a", " ");
|
||||
assertEquals(1, pairs.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsNotCollection() throws Exception {
|
||||
String name = "param-a";
|
||||
Integer value = 1;
|
||||
|
||||
List<Pair> pairs = apiClient.parameterToPair(name, value);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
assertEquals(value, Integer.valueOf(pairs.get(0).getValue()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairWhenValueIsCollection() throws Exception {
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
List<Pair> pairs = apiClient.parameterToPair("param-a", values);
|
||||
assertEquals(0, pairs.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenNameIsInvalid() throws Exception {
|
||||
List<Integer> objects = new ArrayList<Integer>();
|
||||
objects.add(new Integer(1));
|
||||
|
||||
List<Pair> pairs_a = apiClient.parameterToPairs("csv", null, objects);
|
||||
List<Pair> pairs_b = apiClient.parameterToPairs("csv", "", objects);
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsNull() throws Exception {
|
||||
List<Pair> pairs = apiClient.parameterToPairs("csv", "param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsEmptyStrings() throws Exception {
|
||||
// list of empty strings
|
||||
List<String> strs = new ArrayList<String>();
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
|
||||
List<Pair> concatStrings = apiClient.parameterToPairs("csv", "param-a", strs);
|
||||
|
||||
assertEquals(1, concatStrings.size());
|
||||
assertFalse(concatStrings.get(0).getValue().isEmpty()); // should contain some delimiters
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToPairsWhenValueIsCollection() throws Exception {
|
||||
Map<String, String> collectionFormatMap = new HashMap<String, String>();
|
||||
collectionFormatMap.put("csv", ",");
|
||||
collectionFormatMap.put("tsv", "\t");
|
||||
collectionFormatMap.put("ssv", " ");
|
||||
collectionFormatMap.put("pipes", "|");
|
||||
collectionFormatMap.put("", ","); // no format, must default to csv
|
||||
collectionFormatMap.put("unknown", ","); // all other formats, must default to csv
|
||||
|
||||
String name = "param-a";
|
||||
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
// check for multi separately
|
||||
List<Pair> multiPairs = apiClient.parameterToPairs("multi", name, values);
|
||||
assertEquals(values.size(), multiPairs.size());
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), multiPairs.get(i).getValue());
|
||||
}
|
||||
|
||||
// all other formats
|
||||
for (String collectionFormat : collectionFormatMap.keySet()) {
|
||||
List<Pair> pairs = apiClient.parameterToPairs(collectionFormat, name, values);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
String delimiter = collectionFormatMap.get(collectionFormat);
|
||||
if (!delimiter.equals(",")) {
|
||||
// commas are not escaped because they are reserved characters in URIs
|
||||
delimiter = apiClient.escapeString(delimiter);
|
||||
}
|
||||
String[] pairValueSplit = pairs.get(0).getValue().split(delimiter);
|
||||
|
||||
// must equal input values
|
||||
assertEquals(values.size(), pairValueSplit.length);
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
assertEquals(apiClient.escapeString(apiClient.parameterToString(values.get(i))), pairValueSplit[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSanitizeFilename() {
|
||||
assertEquals("sun", apiClient.sanitizeFilename("sun"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename("sun.gif"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename("../sun.gif"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename("/var/tmp/sun.gif"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename("./sun.gif"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename("..\\sun.gif"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename("\\var\\tmp\\sun.gif"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename("c:\\var\\tmp\\sun.gif"));
|
||||
assertEquals("sun.gif", apiClient.sanitizeFilename(".\\sun.gif"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNewHttpClient() {
|
||||
OkHttpClient oldClient = apiClient.getHttpClient();
|
||||
apiClient.setHttpClient(oldClient.newBuilder().build());
|
||||
assertThat(apiClient.getHttpClient(), is(not(oldClient)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests the invariant that the HttpClient for the ApiClient must never be null
|
||||
*/
|
||||
@Test(expected = NullPointerException.class)
|
||||
public void testNullHttpClient() {
|
||||
apiClient.setHttpClient(null);
|
||||
}
|
||||
}
|
||||
@@ -1,202 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.openapitools.client.model.Order;
|
||||
|
||||
import java.lang.Exception;
|
||||
import java.lang.reflect.Type;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import okio.ByteString;
|
||||
import org.junit.*;
|
||||
import org.threeten.bp.LocalDate;
|
||||
import org.threeten.bp.OffsetDateTime;
|
||||
import org.threeten.bp.ZoneId;
|
||||
import org.threeten.bp.ZoneOffset;
|
||||
import org.threeten.bp.format.DateTimeFormatter;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class JSONTest {
|
||||
private ApiClient apiClient = null;
|
||||
private JSON json = null;
|
||||
private Order order = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
apiClient = new ApiClient();
|
||||
json = apiClient.getJSON();
|
||||
order = new Order();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSqlDateTypeAdapter() {
|
||||
final String str = "\"2015-11-07\"";
|
||||
final java.sql.Date date = java.sql.Date.valueOf("2015-11-07");
|
||||
|
||||
assertEquals(str, json.serialize(date));
|
||||
assertEquals(json.deserialize(str, java.sql.Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356" + getCurrentTimezoneOffset() + "\"", java.sql.Date.class).toString(), date.toString());
|
||||
|
||||
// custom date format: without day
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM", Locale.ROOT);
|
||||
apiClient.setSqlDateFormat(format);
|
||||
String dateStr = "\"2015-11\"";
|
||||
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T03:49:09Z\"", java.sql.Date.class)));
|
||||
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11\"", java.sql.Date.class)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDateTypeAdapter() {
|
||||
Calendar cal = new GregorianCalendar(2015, 10, 7, 3, 49, 9);
|
||||
cal.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
|
||||
assertEquals(json.deserialize("\"2015-11-07T05:49:09+02\"", Date.class), cal.getTime());
|
||||
|
||||
cal.set(Calendar.MILLISECOND, 300);
|
||||
assertEquals(json.deserialize("\"2015-11-07T03:49:09.3Z\"", Date.class), cal.getTime());
|
||||
|
||||
cal.set(Calendar.MILLISECOND, 356);
|
||||
Date date = cal.getTime();
|
||||
|
||||
final String utcDate = "\"2015-11-07T03:49:09.356Z\"";
|
||||
assertEquals(json.deserialize(utcDate, Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356+00:00\"", Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T05:49:09.356+02:00\"", Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T02:49:09.356-01:00\"", Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356Z\"", Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356+00\"", Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T02:49:09.356-0100\"", Date.class), date);
|
||||
assertEquals(json.deserialize("\"2015-11-07T03:49:09.356456789Z\"", Date.class), date);
|
||||
|
||||
assertEquals(utcDate, json.serialize(date));
|
||||
|
||||
// custom datetime format: without milli-seconds, custom time zone
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
|
||||
apiClient.setDateFormat(format);
|
||||
|
||||
String dateStr = "\"2015-11-07T13:49:09+10:00\"";
|
||||
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T03:49:09+00:00\"", Date.class)));
|
||||
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T03:49:09Z\"", Date.class)));
|
||||
assertEquals(dateStr, json.serialize(json.deserialize("\"2015-11-07T00:49:09-03:00\"", Date.class)));
|
||||
|
||||
try {
|
||||
// invalid time zone format
|
||||
json.deserialize("\"2015-11-07T03:49:09+00\"", Date.class);
|
||||
fail("json parsing should fail");
|
||||
} catch (RuntimeException e) {
|
||||
// OK
|
||||
}
|
||||
try {
|
||||
// unexpected miliseconds
|
||||
json.deserialize("\"2015-11-07T03:49:09.000Z\"", Date.class);
|
||||
fail("json parsing should fail");
|
||||
} catch (RuntimeException e) {
|
||||
// OK
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOffsetDateTimeTypeAdapter() {
|
||||
final String str = "\"2016-09-09T08:02:03.123-03:00\"";
|
||||
OffsetDateTime date = OffsetDateTime.of(2016, 9, 9, 8, 2, 3, 123000000, ZoneOffset.of("-3"));
|
||||
|
||||
assertEquals(str, json.serialize(date));
|
||||
//Use toString() instead of isEqual to verify that the offset is preserved
|
||||
assertEquals(json.deserialize(str, OffsetDateTime.class).toString(), date.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLocalDateTypeAdapter() {
|
||||
final String str = "\"2016-09-09\"";
|
||||
final LocalDate date = LocalDate.of(2016, 9, 9);
|
||||
|
||||
assertEquals(str, json.serialize(date));
|
||||
assertEquals(json.deserialize(str, LocalDate.class), date);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testDefaultDate() throws Exception {
|
||||
final DateTimeFormatter datetimeFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME;
|
||||
final String dateStr = "2015-11-07T14:11:05.267Z";
|
||||
order.setShipDate(datetimeFormat.parse(dateStr, OffsetDateTime.FROM));
|
||||
|
||||
String str = json.serialize(order);
|
||||
Type type = new TypeToken<Order>() { }.getType();
|
||||
Order o = json.deserialize(str, type);
|
||||
assertEquals(dateStr, datetimeFormat.format(o.getShipDate()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCustomDate() throws Exception {
|
||||
final DateTimeFormatter datetimeFormat = DateTimeFormatter.ISO_OFFSET_DATE_TIME.withZone(ZoneId.of("Etc/GMT+2"));
|
||||
final String dateStr = "2015-11-07T14:11:05-02:00";
|
||||
order.setShipDate(datetimeFormat.parse(dateStr, OffsetDateTime.FROM));
|
||||
|
||||
String str = json.serialize(order);
|
||||
Type type = new TypeToken<Order>() { }.getType();
|
||||
Order o = json.deserialize(str, type);
|
||||
assertEquals(dateStr, datetimeFormat.format(o.getShipDate()));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testByteArrayTypeAdapterSerialization() {
|
||||
// Arrange
|
||||
final String expectedBytesAsString = "Let's pretend this a jpg or something";
|
||||
final byte[] expectedBytes = expectedBytesAsString.getBytes(StandardCharsets.UTF_8);
|
||||
|
||||
// Act
|
||||
String serializedBytesWithQuotes = json.serialize(expectedBytes);
|
||||
|
||||
// Assert
|
||||
String serializedBytes = serializedBytesWithQuotes.substring(1, serializedBytesWithQuotes.length() - 1);
|
||||
if (json.getGson().htmlSafe()) {
|
||||
serializedBytes = serializedBytes.replaceAll("\\\\u003d", "=");
|
||||
}
|
||||
ByteString actualAsByteString = ByteString.decodeBase64(serializedBytes);
|
||||
byte[] actualBytes = actualAsByteString.toByteArray();
|
||||
assertEquals(expectedBytesAsString, new String(actualBytes, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testByteArrayTypeAdapterDeserialization() {
|
||||
// Arrange
|
||||
final String expectedBytesAsString = "Let's pretend this a jpg or something";
|
||||
final byte[] expectedBytes = expectedBytesAsString.getBytes(StandardCharsets.UTF_8);
|
||||
final ByteString expectedByteString = ByteString.of(expectedBytes);
|
||||
final String serializedBytes = expectedByteString.base64();
|
||||
final String serializedBytesWithQuotes = "\"" + serializedBytes + "\"";
|
||||
Type type = new TypeToken<byte[]>() { }.getType();
|
||||
|
||||
// Act
|
||||
byte[] actualDeserializedBytes = json.deserialize(serializedBytesWithQuotes, type);
|
||||
|
||||
// Assert
|
||||
assertEquals(expectedBytesAsString, new String(actualDeserializedBytes, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
// Obtained 22JAN2018 from stackoverflow answer by PuguaSoft https://stackoverflow.com/questions/11399491/java-timezone-offset
|
||||
// Direct link https://stackoverflow.com/a/16680815/3166133
|
||||
public static String getCurrentTimezoneOffset() {
|
||||
|
||||
TimeZone tz = TimeZone.getDefault();
|
||||
Calendar cal = GregorianCalendar.getInstance(tz, Locale.ROOT);
|
||||
int offsetInMillis = tz.getOffset(cal.getTimeInMillis());
|
||||
|
||||
String offset = String.format(Locale.ROOT,"%02d:%02d", Math.abs(offsetInMillis / 3600000), Math.abs((offsetInMillis / 60000) % 60));
|
||||
offset = (offsetInMillis >= 0 ? "+" : "-") + offset;
|
||||
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
@@ -1,564 +0,0 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.api;
|
||||
|
||||
import org.openapitools.client.ApiException;
|
||||
import org.openapitools.client.model.Pet;
|
||||
import org.openapitools.client.auth.*;
|
||||
import org.openapitools.client.model.*;
|
||||
import org.openapitools.client.*;
|
||||
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Arrays;
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.ConcurrentLinkedQueue;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import org.junit.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* API tests for PetApi
|
||||
*/
|
||||
public class PetApiTest {
|
||||
|
||||
private PetApi api = new PetApi();
|
||||
private static final Logger LOG = LoggerFactory.getLogger(PetApiTest.class);
|
||||
// In the circle.yml file, /etc/host is configured with an entry to resolve petstore.swagger.io to 127.0.0.1
|
||||
private static String basePath = "http://petstore.swagger.io:80/v2";
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
// setup authentication
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) api.getApiClient().getAuthentication("api_key");
|
||||
apiKeyAuth.setApiKey("special-key");
|
||||
api.getApiClient().setBasePath(basePath);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApiClient() {
|
||||
// the default api client is used
|
||||
assertEquals(Configuration.getDefaultApiClient(), api.getApiClient());
|
||||
assertNotNull(api.getApiClient());
|
||||
assertEquals(basePath, api.getApiClient().getBasePath());
|
||||
assertFalse(api.getApiClient().isDebugging());
|
||||
|
||||
ApiClient oldClient = api.getApiClient();
|
||||
|
||||
ApiClient newClient = new ApiClient();
|
||||
newClient.setVerifyingSsl(true);
|
||||
newClient.setBasePath("http://example.com");
|
||||
newClient.setDebugging(true);
|
||||
|
||||
// set api client via constructor
|
||||
api = new PetApi(newClient);
|
||||
assertNotNull(api.getApiClient());
|
||||
assertEquals("http://example.com", api.getApiClient().getBasePath());
|
||||
assertTrue(api.getApiClient().isDebugging());
|
||||
|
||||
// set api client via setter method
|
||||
api.setApiClient(oldClient);
|
||||
assertNotNull(api.getApiClient());
|
||||
assertEquals(basePath, api.getApiClient().getBasePath());
|
||||
assertFalse(api.getApiClient().isDebugging());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndGetPet() throws Exception {
|
||||
Pet pet = createPet();
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
assertPetMatches(pet, fetched);
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndGetPetWithHttpInfo() throws Exception {
|
||||
Pet pet = createPet();
|
||||
api.addPetWithHttpInfo(pet);
|
||||
|
||||
ApiResponse<Pet> resp = api.getPetByIdWithHttpInfo(pet.getId());
|
||||
assertEquals(200, resp.getStatusCode());
|
||||
assertEquals("application/json", resp.getHeaders().get("Content-Type").get(0));
|
||||
Pet fetched = resp.getData();
|
||||
|
||||
assertPetMatches(pet, fetched);
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndGetPetAsync() throws Exception {
|
||||
Pet pet = createPet();
|
||||
api.addPet(pet);
|
||||
// to store returned Pet or error message/exception
|
||||
final Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
api.getPetByIdAsync(pet.getId(), new ApiCallback<Pet>() {
|
||||
@Override
|
||||
public void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders) {
|
||||
result.put("error", e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Pet pet, int statusCode, Map<String, List<String>> responseHeaders) {
|
||||
result.put("pet", pet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadProgress(long bytesWritten, long contentLength, boolean done) {
|
||||
//empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadProgress(long bytesRead, long contentLength, boolean done) {
|
||||
//empty
|
||||
}
|
||||
});
|
||||
|
||||
// wait for the asynchronous call to finish (at most 10 seconds)
|
||||
final int maxTry = 10;
|
||||
int tryCount = 1;
|
||||
Pet fetched = null;
|
||||
do {
|
||||
if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds");
|
||||
Thread.sleep(1000);
|
||||
tryCount += 1;
|
||||
if (result.get("error") != null) fail((String) result.get("error"));
|
||||
if (result.get("pet") != null) {
|
||||
fetched = (Pet) result.get("pet");
|
||||
break;
|
||||
}
|
||||
} while (result.isEmpty());
|
||||
assertPetMatches(pet, fetched);
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndGetPetAsyncInvalidID() throws Exception {
|
||||
Pet pet = createPet();
|
||||
api.addPet(pet);
|
||||
// to store returned Pet or error message/exception
|
||||
final Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
// test getting a nonexistent pet
|
||||
result.clear();
|
||||
api.getPetByIdAsync(-10000L, new ApiCallback<Pet>() {
|
||||
@Override
|
||||
public void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders) {
|
||||
result.put("exception", e);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(Pet pet, int statusCode, Map<String, List<String>> responseHeaders) {
|
||||
result.put("pet", pet);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadProgress(long bytesWritten, long contentLength, boolean done) {
|
||||
//empty
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadProgress(long bytesRead, long contentLength, boolean done) {
|
||||
//empty
|
||||
}
|
||||
});
|
||||
|
||||
// wait for the asynchronous call to finish (at most 10 seconds)
|
||||
final int maxTry = 10;
|
||||
int tryCount = 1;
|
||||
Pet fetched = null;
|
||||
ApiException exception = null;
|
||||
|
||||
do {
|
||||
if (tryCount > maxTry) fail("have not got result of getPetByIdAsync after 10 seconds");
|
||||
Thread.sleep(1000);
|
||||
tryCount += 1;
|
||||
if (result.get("pet") != null) fail("expected an error");
|
||||
if (result.get("exception") != null) {
|
||||
exception = (ApiException) result.get("exception");
|
||||
break;
|
||||
}
|
||||
} while (result.isEmpty());
|
||||
assertNotNull(exception);
|
||||
assertEquals(404, exception.getCode());
|
||||
assertEquals("Not Found", exception.getMessage());
|
||||
assertEquals("application/json", exception.getResponseHeaders().get("Content-Type").get(0));
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCreateAndGetMultiplePetsAsync() throws Exception {
|
||||
Pet pet1 = createPet();
|
||||
Pet pet2 = createPet();
|
||||
|
||||
final CountDownLatch addLatch = new CountDownLatch(2);
|
||||
final TestApiCallback<Void> addCallback1 = new TestApiCallback<Void>(addLatch);
|
||||
final TestApiCallback<Void> addCallback2 = new TestApiCallback<Void>(addLatch);
|
||||
|
||||
// Make 2 simultaneous calls
|
||||
api.addPetAsync(pet1, addCallback1);
|
||||
api.addPetAsync(pet2, addCallback2);
|
||||
|
||||
// wait for both asynchronous calls to finish (at most 10 seconds)
|
||||
assertTrue(addLatch.await(10, TimeUnit.SECONDS));
|
||||
|
||||
assertTrue(addCallback1.isDone());
|
||||
assertTrue(addCallback2.isDone());
|
||||
|
||||
if (!addCallback1.isSuccess()) throw addCallback1.getException();
|
||||
if (!addCallback2.isSuccess()) throw addCallback2.getException();
|
||||
|
||||
assertValidProgress(addCallback1.getUploadProgress());
|
||||
assertValidProgress(addCallback2.getUploadProgress());
|
||||
|
||||
final CountDownLatch getLatch = new CountDownLatch(3);
|
||||
final TestApiCallback<Pet> getCallback1 = new TestApiCallback<Pet>(getLatch);
|
||||
final TestApiCallback<Pet> getCallback2 = new TestApiCallback<Pet>(getLatch);
|
||||
final TestApiCallback<Pet> getCallback3 = new TestApiCallback<Pet>(getLatch);
|
||||
|
||||
api.getPetByIdAsync(pet1.getId(), getCallback1);
|
||||
api.getPetByIdAsync(pet2.getId(), getCallback2);
|
||||
// Get nonexistent pet
|
||||
api.getPetByIdAsync(-10000L, getCallback3);
|
||||
|
||||
// wait for all asynchronous calls to finish (at most 10 seconds)
|
||||
assertTrue(getLatch.await(10, TimeUnit.SECONDS));
|
||||
|
||||
assertTrue(getCallback1.isDone());
|
||||
assertTrue(getCallback2.isDone());
|
||||
assertTrue(getCallback3.isDone());
|
||||
|
||||
if (!getCallback1.isSuccess()) throw getCallback1.getException();
|
||||
if (!getCallback2.isSuccess()) throw getCallback2.getException();
|
||||
|
||||
assertPetMatches(pet1, getCallback1.getResult());
|
||||
assertPetMatches(pet2, getCallback2.getResult());
|
||||
|
||||
assertValidProgress(getCallback1.getDownloadProgress());
|
||||
assertValidProgress(getCallback2.getDownloadProgress());
|
||||
|
||||
// Last callback should fail with ApiException
|
||||
assertFalse(getCallback3.isSuccess());
|
||||
final ApiException exception = getCallback3.getException();
|
||||
assertNotNull(exception);
|
||||
assertEquals(404, exception.getCode());
|
||||
api.deletePet(pet1.getId(), null);
|
||||
api.deletePet(pet2.getId(), null);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testUpdatePet() throws Exception {
|
||||
Pet pet = createPet();
|
||||
api.addPet(pet);
|
||||
pet.setName("programmer");
|
||||
|
||||
api.updatePet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
assertPetMatches(pet, fetched);
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindPetsByStatus() throws Exception {
|
||||
assertEquals(basePath, api.getApiClient().getBasePath());
|
||||
Pet pet = createPet();
|
||||
api.addPet(pet);
|
||||
pet.setName("programmer");
|
||||
pet.setStatus(Pet.StatusEnum.PENDING);
|
||||
api.updatePet(pet);
|
||||
|
||||
List<Pet> pets = api.findPetsByStatus(Arrays.asList("pending"));
|
||||
assertNotNull(pets);
|
||||
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
assertTrue(found);
|
||||
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void testFindPetsByTags() throws Exception {
|
||||
Pet pet = createPet();
|
||||
pet.setName("monster");
|
||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||
|
||||
List<Tag> tags = new ArrayList<Tag>();
|
||||
Tag tag1 = new Tag();
|
||||
tag1.setName("friendly");
|
||||
tags.add(tag1);
|
||||
pet.setTags(tags);
|
||||
|
||||
api.updatePet(pet);
|
||||
|
||||
Set<Pet> pets = api.findPetsByTags(new HashSet<>(Arrays.asList("friendly")));
|
||||
assertNotNull(pets);
|
||||
|
||||
boolean found = false;
|
||||
for (Pet fetched : pets) {
|
||||
if (fetched.getId().equals(pet.getId())) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(found);
|
||||
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdatePetWithForm() throws Exception {
|
||||
Pet pet = createPet();
|
||||
pet.setName("frank");
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
|
||||
api.updatePetWithForm(fetched.getId(), "furt", null);
|
||||
Pet updated = api.getPetById(fetched.getId());
|
||||
|
||||
assertEquals(updated.getName(), "furt");
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDeletePet() throws Exception {
|
||||
Pet pet = createPet();
|
||||
api.addPet(pet);
|
||||
|
||||
Pet fetched = api.getPetById(pet.getId());
|
||||
api.deletePet(pet.getId(), null);
|
||||
|
||||
try {
|
||||
fetched = api.getPetById(fetched.getId());
|
||||
fail("expected an error");
|
||||
} catch (ApiException e) {
|
||||
LOG.info("Code: {}. Message: {}", e.getCode(), e.getMessage());
|
||||
assertEquals(404, e.getCode());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUploadFile() throws Exception {
|
||||
Pet pet = createPet();
|
||||
api.addPet(pet);
|
||||
|
||||
File file = new File("hello.txt");
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||
writer.write("Hello world!");
|
||||
writer.close();
|
||||
|
||||
api.uploadFile(pet.getId(), "a test file", new File(file.getAbsolutePath()));
|
||||
api.deletePet(pet.getId(), null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEqualsAndHashCode() {
|
||||
Pet pet1 = new Pet();
|
||||
Pet pet2 = new Pet();
|
||||
assertTrue(pet1.equals(pet2));
|
||||
assertTrue(pet2.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
||||
assertTrue(pet1.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
||||
|
||||
pet2.setName("really-happy");
|
||||
pet2.setPhotoUrls(new HashSet<>(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")));
|
||||
assertFalse(pet1.equals(pet2));
|
||||
assertFalse(pet2.equals(pet1));
|
||||
assertFalse(pet1.hashCode() == (pet2.hashCode()));
|
||||
assertTrue(pet2.equals(pet2));
|
||||
assertTrue(pet2.hashCode() == pet2.hashCode());
|
||||
|
||||
pet1.setName("really-happy");
|
||||
pet1.setPhotoUrls(new HashSet<>(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2")));
|
||||
assertTrue(pet1.equals(pet2));
|
||||
assertTrue(pet2.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet2.hashCode());
|
||||
assertTrue(pet1.equals(pet1));
|
||||
assertTrue(pet1.hashCode() == pet1.hashCode());
|
||||
}
|
||||
|
||||
|
||||
private Pet createPet() {
|
||||
Pet pet = new Pet();
|
||||
pet.setId(ThreadLocalRandom.current().nextLong(Long.MAX_VALUE));
|
||||
pet.setName("gorilla");
|
||||
|
||||
Category category = new Category();
|
||||
category.setName("really-happy");
|
||||
|
||||
pet.setCategory(category);
|
||||
pet.setStatus(Pet.StatusEnum.AVAILABLE);
|
||||
Set<String> photos = new HashSet<>(Arrays.asList("http://foo.bar.com/1", "http://foo.bar.com/2"));
|
||||
pet.setPhotoUrls(photos);
|
||||
|
||||
return pet;
|
||||
}
|
||||
|
||||
private String serializeJson(Object o, ApiClient apiClient) {
|
||||
return apiClient.getJSON().serialize(o);
|
||||
}
|
||||
|
||||
private <T> T deserializeJson(String json, Type type, ApiClient apiClient) {
|
||||
return (T) apiClient.getJSON().deserialize(json, type);
|
||||
}
|
||||
|
||||
private void assertPetMatches(Pet expected, Pet actual) {
|
||||
assertNotNull(actual);
|
||||
assertEquals(expected.getId(), actual.getId());
|
||||
assertNotNull(actual.getCategory());
|
||||
assertEquals(expected.getCategory().getName(),
|
||||
actual.getCategory().getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* Assert that the given upload/download progress list satisfies the
|
||||
* following constraints:
|
||||
* <p>
|
||||
* - List is not empty
|
||||
* - Byte count should be nondecreasing
|
||||
* - The last element, and only the last element, should have done=true
|
||||
*/
|
||||
private void assertValidProgress(List<Progress> progressList) {
|
||||
assertFalse(progressList.isEmpty());
|
||||
|
||||
Progress prev = null;
|
||||
int index = 0;
|
||||
for (Progress progress : progressList) {
|
||||
if (prev != null) {
|
||||
if (prev.done || prev.bytes > progress.bytes) {
|
||||
fail("Progress list out of order at index " + index
|
||||
+ ": " + progressList);
|
||||
}
|
||||
}
|
||||
prev = progress;
|
||||
index += 1;
|
||||
}
|
||||
|
||||
if (!prev.done) {
|
||||
fail("Last progress item should have done=true: " + progressList);
|
||||
}
|
||||
}
|
||||
|
||||
private static class TestApiCallback<T> implements ApiCallback<T> {
|
||||
|
||||
private final CountDownLatch latch;
|
||||
private final ConcurrentLinkedQueue<Progress> uploadProgress =
|
||||
new ConcurrentLinkedQueue<Progress>();
|
||||
private final ConcurrentLinkedQueue<Progress> downloadProgress =
|
||||
new ConcurrentLinkedQueue<Progress>();
|
||||
|
||||
private boolean done;
|
||||
private boolean success;
|
||||
private ApiException exception;
|
||||
private T result;
|
||||
|
||||
public TestApiCallback(CountDownLatch latch) {
|
||||
this.latch = latch;
|
||||
this.done = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(ApiException e, int statusCode, Map<String, List<String>> responseHeaders) {
|
||||
exception = e;
|
||||
this.done = true;
|
||||
this.success = false;
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(T result, int statusCode, Map<String, List<String>> responseHeaders) {
|
||||
this.result = result;
|
||||
this.done = true;
|
||||
this.success = true;
|
||||
latch.countDown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUploadProgress(long bytesWritten, long contentLength, boolean done) {
|
||||
uploadProgress.add(new Progress(bytesWritten, contentLength, done));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDownloadProgress(long bytesRead, long contentLength, boolean done) {
|
||||
downloadProgress.add(new Progress(bytesRead, contentLength, done));
|
||||
}
|
||||
|
||||
public boolean isDone() {
|
||||
return done;
|
||||
}
|
||||
|
||||
public boolean isSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public ApiException getException() {
|
||||
return exception;
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<Progress> getUploadProgress() {
|
||||
return new ArrayList<Progress>(uploadProgress);
|
||||
}
|
||||
|
||||
public List<Progress> getDownloadProgress() {
|
||||
return new ArrayList<Progress>(downloadProgress);
|
||||
}
|
||||
}
|
||||
|
||||
private static class Progress {
|
||||
public final long bytes;
|
||||
public final long contentLength;
|
||||
public final boolean done;
|
||||
|
||||
public Progress(long bytes, long contentLength, boolean done) {
|
||||
this.bytes = bytes;
|
||||
this.contentLength = contentLength;
|
||||
this.done = done;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "<Progress " + bytes + " " + contentLength + " " + done + ">";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,119 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.openapitools.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ApiKeyAuthTest {
|
||||
@Test
|
||||
public void testApplyToParamsInQuery() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
|
||||
auth.setApiKey("my-api-key");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
assertEquals(1, queryParams.size());
|
||||
for (Pair queryParam : queryParams) {
|
||||
assertEquals("my-api-key", queryParam.getValue());
|
||||
}
|
||||
|
||||
// no changes to header or cookie parameters
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInQueryWithNullValue() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
|
||||
auth.setApiKey(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInHeaderWithPrefix() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or cookie parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInHeaderWithNullValue() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInCookieWithPrefix() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or header parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(1, cookieParams.size());
|
||||
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInCookieWithNullValue() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
}
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.openapitools.client.Pair;
|
||||
import org.junit.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class HttpBasicAuthTest {
|
||||
HttpBasicAuth auth = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
auth = new HttpBasicAuth();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParams() {
|
||||
List<Pair> queryParams = new ArrayList<Pair>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
Map<String, String> cookieParams = new HashMap<String, String>();
|
||||
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword("my-password");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or cookie parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
|
||||
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
|
||||
// null username should be treated as empty string
|
||||
auth.setUsername(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
|
||||
expected = "Basic Om15LXBhc3N3b3Jk";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
|
||||
// null password should be treated as empty string
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
|
||||
expected = "Basic bXktdXNlcm5hbWU6";
|
||||
assertEquals(expected, headerParams.get("Authorization"));
|
||||
|
||||
// null username and password should be ignored
|
||||
queryParams = new ArrayList<Pair>();
|
||||
headerParams = new HashMap<String, String>();
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
// no changes to parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.apache.commons.lang3.builder.EqualsBuilder;
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
/**
|
||||
* Model tests for ArrayOfArrayOfNumberOnly
|
||||
*/
|
||||
public class ArrayOfArrayOfNumberOnlyTest {
|
||||
private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly();
|
||||
|
||||
/**
|
||||
* Model tests for ArrayOfArrayOfNumberOnly
|
||||
*/
|
||||
@Test
|
||||
public void test() {
|
||||
// TODO: test ArrayOfArrayOfNumberOnly
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'arrayArrayNumber'
|
||||
*/
|
||||
@Test
|
||||
public void arrayArrayNumberTest() {
|
||||
BigDecimal b1 = new BigDecimal("12.3");
|
||||
BigDecimal b2 = new BigDecimal("5.6");
|
||||
List<BigDecimal> arrayArrayNumber = new ArrayList<BigDecimal>();
|
||||
arrayArrayNumber.add(b1);
|
||||
arrayArrayNumber.add(b2);
|
||||
model.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
|
||||
model.getArrayArrayNumber().add(arrayArrayNumber);
|
||||
|
||||
// create another instance for comparison
|
||||
BigDecimal b3 = new BigDecimal("12.3");
|
||||
BigDecimal b4 = new BigDecimal("5.6");
|
||||
ArrayOfArrayOfNumberOnly model2 = new ArrayOfArrayOfNumberOnly();
|
||||
List<BigDecimal> arrayArrayNumber2 = new ArrayList<BigDecimal>();
|
||||
arrayArrayNumber2.add(b1);
|
||||
arrayArrayNumber2.add(b2);
|
||||
model2.setArrayArrayNumber(new ArrayList<List<BigDecimal>>());
|
||||
model2.getArrayArrayNumber().add(arrayArrayNumber2);
|
||||
|
||||
Assert.assertTrue(model2.equals(model));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
public class EnumValueTest {
|
||||
|
||||
@Test
|
||||
public void testEnumClass() {
|
||||
assertEquals(EnumClass._ABC.toString(), "_abc");
|
||||
assertEquals(EnumClass._EFG.toString(), "-efg");
|
||||
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnumTest() {
|
||||
// test enum value
|
||||
EnumTest enumTest = new EnumTest();
|
||||
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
|
||||
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
|
||||
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
|
||||
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
|
||||
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
|
||||
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
|
||||
|
||||
// test serialization
|
||||
Gson gson = new Gson();
|
||||
String json = gson.toJson(enumTest);
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_integer\":1,\"enum_number\":1.1}");
|
||||
|
||||
// test deserialization
|
||||
EnumTest fromString = gson.fromJson(json, EnumTest.class);
|
||||
assertEquals(fromString.getEnumString().toString(), "lower");
|
||||
assertEquals(fromString.getEnumString().getValue(), "lower");
|
||||
assertEquals(fromString.getEnumInteger().toString(), "1");
|
||||
assertTrue(fromString.getEnumInteger().getValue() == 1);
|
||||
assertEquals(fromString.getEnumNumber().toString(), "1.1");
|
||||
assertTrue(fromString.getEnumNumber().getValue() == 1.1);
|
||||
}
|
||||
}
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
* OpenAPI Petstore
|
||||
* This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
|
||||
*
|
||||
* OpenAPI spec version: 1.0.0
|
||||
*
|
||||
*
|
||||
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
||||
* https://openapi-generator.tech
|
||||
* Do not edit the class manually.
|
||||
*/
|
||||
|
||||
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import com.google.gson.TypeAdapter;
|
||||
import com.google.gson.annotations.JsonAdapter;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import com.google.gson.stream.JsonReader;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.openapitools.client.model.Category;
|
||||
import org.openapitools.client.model.Tag;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
|
||||
/**
|
||||
* Model tests for Pet
|
||||
*/
|
||||
public class PetTest {
|
||||
private final Pet model = new Pet();
|
||||
|
||||
/**
|
||||
* Model tests for Pet
|
||||
*/
|
||||
@Test
|
||||
public void testPet() {
|
||||
// test Pet
|
||||
model.setId(1029L);
|
||||
model.setName("Dog");
|
||||
|
||||
Pet model2 = new Pet();
|
||||
model2.setId(1029L);
|
||||
model2.setName("Dog");
|
||||
|
||||
Assert.assertTrue(model.equals(model2));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'id'
|
||||
*/
|
||||
@Test
|
||||
public void idTest() {
|
||||
// TODO: test id
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'category'
|
||||
*/
|
||||
@Test
|
||||
public void categoryTest() {
|
||||
// TODO: test category
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'name'
|
||||
*/
|
||||
@Test
|
||||
public void nameTest() {
|
||||
// TODO: test name
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'photoUrls'
|
||||
*/
|
||||
@Test
|
||||
public void photoUrlsTest() {
|
||||
// TODO: test photoUrls
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'tags'
|
||||
*/
|
||||
@Test
|
||||
public void tagsTest() {
|
||||
// TODO: test tags
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the property 'status'
|
||||
*/
|
||||
@Test
|
||||
public void statusTest() {
|
||||
// TODO: test status
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,253 +0,0 @@
|
||||
package org.openapitools.client;
|
||||
|
||||
import org.openapitools.client.auth.*;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
|
||||
public class ApiClientTest {
|
||||
ApiClient apiClient = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
apiClient = new ApiClient();
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@Test
|
||||
public void testParseAndFormatDate() {
|
||||
// default date format
|
||||
String dateStr = "2015-11-07T03:49:09.356Z";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09.356Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T05:49:09.356+02:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T02:49:09.356-01:00")));
|
||||
|
||||
// custom date format: without milli-seconds, custom time zone
|
||||
DateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX", Locale.ROOT);
|
||||
format.setTimeZone(TimeZone.getTimeZone("GMT+10"));
|
||||
apiClient.setDateFormat(format);
|
||||
dateStr = "2015-11-07T13:49:09+10:00";
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09+00:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T03:49:09Z")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T00:49:09-03:00")));
|
||||
assertEquals(dateStr, apiClient.formatDate(apiClient.parseDate("2015-11-07T13:49:09+10:00")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIsJsonMime() {
|
||||
assertFalse(apiClient.isJsonMime((String) null));
|
||||
assertFalse(apiClient.isJsonMime(""));
|
||||
assertFalse(apiClient.isJsonMime("text/plain"));
|
||||
assertFalse(apiClient.isJsonMime("application/xml"));
|
||||
assertFalse(apiClient.isJsonMime("application/jsonp"));
|
||||
assertFalse(apiClient.isJsonMime("example/json"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+jsonx"));
|
||||
assertFalse(apiClient.isJsonMime("example/foo+bar+xjson"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/json"));
|
||||
assertTrue(apiClient.isJsonMime("application/json; charset=UTF8"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/JSON"));
|
||||
|
||||
assertTrue(apiClient.isJsonMime("application/problem+json"));
|
||||
assertTrue(apiClient.isJsonMime("APPLICATION/PROBLEM+JSON"));
|
||||
assertTrue(apiClient.isJsonMime("application/json\t"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+bar+json"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json;x;y"));
|
||||
assertTrue(apiClient.isJsonMime("example/foo+json\t;"));
|
||||
assertTrue(apiClient.isJsonMime("Example/fOO+JSON"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderAccept() {
|
||||
String[] accepts = {"application/json", "application/xml"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("application/json")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"APPLICATION/XML", "APPLICATION/JSON"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("APPLICATION/JSON")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("application/json; charset=UTF8")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals(Arrays.asList(MediaType.parseMediaType("text/plain"),MediaType.parseMediaType("application/xml")), apiClient.selectHeaderAccept(accepts));
|
||||
|
||||
accepts = new String[]{};
|
||||
assertNull(apiClient.selectHeaderAccept(accepts));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSelectHeaderContentType() {
|
||||
String[] contentTypes = {"application/json", "application/xml"};
|
||||
assertEquals(MediaType.parseMediaType("application/json"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"APPLICATION/JSON", "APPLICATION/XML"};
|
||||
assertEquals(MediaType.parseMediaType("APPLICATION/JSON"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"application/xml", "application/json; charset=UTF8"};
|
||||
assertEquals(MediaType.parseMediaType("application/json; charset=UTF8"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{"text/plain", "application/xml"};
|
||||
assertEquals(MediaType.parseMediaType("text/plain"), apiClient.selectHeaderContentType(contentTypes));
|
||||
|
||||
contentTypes = new String[]{};
|
||||
assertEquals(MediaType.parseMediaType("application/json"), apiClient.selectHeaderContentType(contentTypes));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAuthentications() {
|
||||
Map<String, Authentication> auths = apiClient.getAuthentications();
|
||||
|
||||
Authentication auth = auths.get("api_key");
|
||||
assertNotNull(auth);
|
||||
assertTrue(auth instanceof ApiKeyAuth);
|
||||
ApiKeyAuth apiKeyAuth = (ApiKeyAuth) auth;
|
||||
assertEquals("header", apiKeyAuth.getLocation());
|
||||
assertEquals("api_key", apiKeyAuth.getParamName());
|
||||
|
||||
auth = auths.get("petstore_auth");
|
||||
assertTrue(auth instanceof OAuth);
|
||||
assertSame(auth, apiClient.getAuthentication("petstore_auth"));
|
||||
|
||||
assertNull(auths.get("unknown"));
|
||||
|
||||
try {
|
||||
auths.put("my_auth", new HttpBasicAuth());
|
||||
fail("the authentications returned should not be modifiable");
|
||||
} catch (UnsupportedOperationException e) {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetUsernameAndPassword() {
|
||||
HttpBasicAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof HttpBasicAuth) {
|
||||
auth = (HttpBasicAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
|
||||
apiClient.setUsername("my-username");
|
||||
apiClient.setPassword("my-password");
|
||||
assertEquals("my-username", auth.getUsername());
|
||||
assertEquals("my-password", auth.getPassword());
|
||||
|
||||
// reset values
|
||||
auth.setUsername(null);
|
||||
auth.setPassword(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSetApiKeyAndPrefix() {
|
||||
ApiKeyAuth auth = null;
|
||||
for (Authentication _auth : apiClient.getAuthentications().values()) {
|
||||
if (_auth instanceof ApiKeyAuth) {
|
||||
auth = (ApiKeyAuth) _auth;
|
||||
break;
|
||||
}
|
||||
}
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
|
||||
apiClient.setApiKey("my-api-key");
|
||||
apiClient.setApiKeyPrefix("Token");
|
||||
assertEquals("my-api-key", auth.getApiKey());
|
||||
assertEquals("Token", auth.getApiKeyPrefix());
|
||||
|
||||
// reset values
|
||||
auth.setApiKey(null);
|
||||
auth.setApiKeyPrefix(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenNameIsInvalid() throws Exception {
|
||||
MultiValueMap<String, String> pairs_a = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, null, new Integer(1));
|
||||
MultiValueMap<String, String> pairs_b = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "", new Integer(1));
|
||||
|
||||
assertTrue(pairs_a.isEmpty());
|
||||
assertTrue(pairs_b.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsNull() throws Exception {
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", null);
|
||||
|
||||
assertTrue(pairs.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsEmptyStrings() throws Exception {
|
||||
|
||||
// single empty string
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", " ");
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
// list of empty strings
|
||||
List<String> strs = new ArrayList<String>();
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
strs.add(" ");
|
||||
|
||||
MultiValueMap<String, String> concatStrings = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, "param-a", strs);
|
||||
|
||||
assertEquals(1, concatStrings.get("param-a").size());
|
||||
assertFalse(concatStrings.get("param-a").isEmpty()); // should contain some delimiters
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsNotCollection() throws Exception {
|
||||
String name = "param-a";
|
||||
Integer value = 1;
|
||||
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.CSV, name, value);
|
||||
|
||||
assertEquals(1, pairs.get(name).size());
|
||||
assertEquals(value, Integer.valueOf(pairs.get(name).get(0)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParameterToMultiValueMapWhenValueIsCollection() throws Exception {
|
||||
Map<ApiClient.CollectionFormat, String> collectionFormatMap = new HashMap<ApiClient.CollectionFormat, String>();
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.CSV, ",");
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.TSV, "\t");
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.SSV, " ");
|
||||
collectionFormatMap.put(ApiClient.CollectionFormat.PIPES, "\\|");
|
||||
collectionFormatMap.put(null, ","); // no format, must default to csv
|
||||
|
||||
String name = "param-a";
|
||||
|
||||
List<Object> values = new ArrayList<Object>();
|
||||
values.add("value-a");
|
||||
values.add(123);
|
||||
values.add(new Date());
|
||||
|
||||
// check for multi separately
|
||||
MultiValueMap<String, String> multiValueMap = apiClient.parameterToMultiValueMap(ApiClient.CollectionFormat.MULTI, name, values);
|
||||
assertEquals(values.size(), multiValueMap.get(name).size());
|
||||
|
||||
// all other formats
|
||||
for (ApiClient.CollectionFormat collectionFormat : collectionFormatMap.keySet()) {
|
||||
MultiValueMap<String, String> pairs = apiClient.parameterToMultiValueMap(collectionFormat, name, values);
|
||||
|
||||
assertEquals(1, pairs.size());
|
||||
|
||||
String delimiter = collectionFormatMap.get(collectionFormat);
|
||||
String[] pairValueSplit = pairs.get(name).get(0).split(delimiter);
|
||||
|
||||
assertEquals(values.size(), pairValueSplit.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class ApiKeyAuthTest {
|
||||
@Test
|
||||
public void testApplyToParamsInQuery() {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
HttpHeaders headerParams = new HttpHeaders();
|
||||
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("query", "api_key");
|
||||
auth.setApiKey("my-api-key");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
assertEquals(1, queryParams.size());
|
||||
assertEquals("my-api-key", queryParams.get("api_key").get(0));
|
||||
|
||||
// no changes to header or cookie parameters
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInHeaderWithPrefix() {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
HttpHeaders headerParams = new HttpHeaders();
|
||||
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("header", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or cookie parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
assertEquals("Token my-api-token", headerParams.get("X-API-TOKEN").get(0));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParamsInCookieWithPrefix() {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
HttpHeaders headerParams = new HttpHeaders();
|
||||
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
ApiKeyAuth auth = new ApiKeyAuth("cookie", "X-API-TOKEN");
|
||||
auth.setApiKey("my-api-token");
|
||||
auth.setApiKeyPrefix("Token");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or cookie parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, headerParams.size());
|
||||
assertEquals(1, cookieParams.size());
|
||||
assertEquals("Token my-api-token", cookieParams.get("X-API-TOKEN").get(0));
|
||||
}
|
||||
}
|
||||
@@ -1,56 +0,0 @@
|
||||
package org.openapitools.client.auth;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.*;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
public class HttpBasicAuthTest {
|
||||
HttpBasicAuth auth = null;
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
auth = new HttpBasicAuth();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testApplyToParams() {
|
||||
MultiValueMap<String, String> queryParams = new LinkedMultiValueMap<String, String>();
|
||||
HttpHeaders headerParams = new HttpHeaders();
|
||||
MultiValueMap<String, String> cookieParams = new LinkedMultiValueMap<String, String>();
|
||||
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword("my-password");
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
|
||||
// no changes to query or cookie parameters
|
||||
assertEquals(0, queryParams.size());
|
||||
assertEquals(0, cookieParams.size());
|
||||
assertEquals(1, headerParams.size());
|
||||
// the string below is base64-encoded result of "my-username:my-password" with the "Basic " prefix
|
||||
String expected = "Basic bXktdXNlcm5hbWU6bXktcGFzc3dvcmQ=";
|
||||
assertEquals(expected, headerParams.get("Authorization").get(0));
|
||||
|
||||
// null username should be treated as empty string
|
||||
auth.setUsername(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
// the string below is base64-encoded result of ":my-password" with the "Basic " prefix
|
||||
expected = "Basic Om15LXBhc3N3b3Jk";
|
||||
assertEquals(expected, headerParams.get("Authorization").get(1));
|
||||
|
||||
// null password should be treated as empty string
|
||||
auth.setUsername("my-username");
|
||||
auth.setPassword(null);
|
||||
auth.applyToParams(queryParams, headerParams, cookieParams);
|
||||
// the string below is base64-encoded result of "my-username:" with the "Basic " prefix
|
||||
expected = "Basic bXktdXNlcm5hbWU6";
|
||||
assertEquals(expected, headerParams.get("Authorization").get(2));
|
||||
}
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
package org.openapitools.client.model;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
public class EnumValueTest {
|
||||
|
||||
@Test
|
||||
public void testEnumClass() {
|
||||
assertEquals(EnumClass._ABC.toString(), "_abc");
|
||||
assertEquals(EnumClass._EFG.toString(), "-efg");
|
||||
assertEquals(EnumClass._XYZ_.toString(), "(xyz)");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEnumTest() {
|
||||
// test enum value
|
||||
EnumTest enumTest = new EnumTest();
|
||||
enumTest.setEnumString(EnumTest.EnumStringEnum.LOWER);
|
||||
enumTest.setEnumInteger(EnumTest.EnumIntegerEnum.NUMBER_1);
|
||||
enumTest.setEnumNumber(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1);
|
||||
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.toString(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.UPPER.getValue(), "UPPER");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.toString(), "lower");
|
||||
assertEquals(EnumTest.EnumStringEnum.LOWER.getValue(), "lower");
|
||||
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_1.toString(), "1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_1.getValue() == 1);
|
||||
assertEquals(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.toString(), "-1");
|
||||
assertTrue(EnumTest.EnumIntegerEnum.NUMBER_MINUS_1.getValue() == -1);
|
||||
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.toString(), "1.1");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_1_DOT_1.getValue() == 1.1);
|
||||
assertEquals(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.toString(), "-1.2");
|
||||
assertTrue(EnumTest.EnumNumberEnum.NUMBER_MINUS_1_DOT_2.getValue() == -1.2);
|
||||
|
||||
try {
|
||||
// test serialization (object => json)
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
mapper.enable(SerializationFeature.WRITE_ENUMS_USING_TO_STRING);
|
||||
ObjectWriter ow = mapper.writer();
|
||||
String json = ow.writeValueAsString(enumTest);
|
||||
assertEquals(json, "{\"enum_string\":\"lower\",\"enum_string_required\":null,\"enum_integer\":1,\"enum_number\":1.1,\"outerEnum\":null}");
|
||||
|
||||
// test deserialization (json => object)
|
||||
EnumTest fromString = mapper.readValue(json, EnumTest.class);
|
||||
assertEquals(fromString.getEnumString().toString(), "lower");
|
||||
assertEquals(fromString.getEnumInteger().toString(), "1");
|
||||
assertEquals(fromString.getEnumNumber().toString(), "1.1");
|
||||
|
||||
} catch (Exception e) {
|
||||
fail("Exception thrown during serialization/deserialzation of JSON: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>KotlinPetstoreStringTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>kotlin-string</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>gradle</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>KotlinPetstoreThreetenbpTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>kotlin-threetenbp</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>gradle</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,26 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TypeScriptAngularBuildPestoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Fetch Default Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,59 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TypeScriptAngularBuildES6PestoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Fetch ES6 Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>npm-install</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>install</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,26 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TypeScriptAngularBuildPestoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Fetch Multiple Parameters Petstore Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,73 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TypeScriptFetchBuildPrefixParameterInterfacesPestoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Fetch Petstore Client (with namespacing for parameter interfaces)</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>npm-install</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>install</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-build</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>run</argument>
|
||||
<argument>build</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,73 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TypeScriptAngularBuildWithNPMVersionPestoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Fetch Petstore Client (with npm)</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>npm-install</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>install</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-build</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>run</argument>
|
||||
<argument>build</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,59 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>TypeScriptFetchPestoreClientTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>TS Fetch Petstore Test Client</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>npm-install</id>
|
||||
<phase>pre-integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>install</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>npm-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>npm</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-api-package-override</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-api-package-override Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-controller-only</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-controller-only Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-fake-endpoints</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-fake-endpoints Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-no-bean-validation</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-no-bean-validation Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-no-exception-handling</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-no-exception-handling Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-no-interface</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-no-interface Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-no-swagger-ui</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-no-swagger-ui Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests-no-wrap-calls</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework-no-wrap-calls Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>PlayServerTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>java-play-framework Project</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.6.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>Play Test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>sbt</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,46 +0,0 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>KotlinPetstoreKtorTests</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>kotlin-server-ktor</name>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-dependency-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>copy-dependencies</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<outputDirectory>${project.build.directory}</outputDirectory>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>exec-maven-plugin</artifactId>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>bundle-test</id>
|
||||
<phase>integration-test</phase>
|
||||
<goals>
|
||||
<goal>exec</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<executable>gradle</executable>
|
||||
<arguments>
|
||||
<argument>test</argument>
|
||||
</arguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1 +0,0 @@
|
||||
c2fcc2ae9693a8e8d02b25e286844aad88188fcb
|
||||
Binary file not shown.
@@ -4,7 +4,7 @@
|
||||
|
||||
- If you're not using the latest master to generate API clients or server stubs, please give it another try by pulling the latest master as the issue may have already been addressed. Ref: [Getting Started](https://github.com/openapitools/openapi-generator#getting-started)
|
||||
- Search the [open issue](https://github.com/openapitools/openapi-generator/issues) and [closed issue](https://github.com/openapitools/openapi-generator/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
|
||||
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information.
|
||||
- File an [issue ticket](https://github.com/openapitools/openapi-generator/issues/new) by providing all the required information. Failure to provide enough detail may result in slow response from the community.
|
||||
- Test with the latest master by building the JAR locally to see if the issue has already been addressed.
|
||||
- You can also make a suggestion or ask a question by opening an "issue".
|
||||
|
||||
@@ -85,11 +85,16 @@ For [Vendor Extensions](https://github.com/OAI/OpenAPI-Specification/blob/master
|
||||
To add test cases (optional) covering the change in the code generator, please refer to [modules/openapi-generator/src/test/java/org/openapitools/codegen](https://github.com/openapitools/openapi-generator/tree/master/modules/openapi-generator/src/test/java/org/openapitools/codegen)
|
||||
|
||||
To test the templates, please perform the following:
|
||||
- Update the Petstore sample by running the shell scripts under `bin` and `bin/openapi3` folder. For example, run `./bin/python-petstore.sh` and `./bin/openapi3/python-petstore.sh` to update the Python PetStore API client under [`samples/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/client/petstore/python) and [`samples/openapi3/client/petstore/python`](https://github.com/openapitools/openapi-generator/tree/master/samples/openapi3/client/petstore/python). For Windows, the batch files can be found under `bin\windows` folder. (If you find that there are new files generated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec from time to time. If you've questions or concerns, please open a ticket to start a discussion)
|
||||
- Run the tests in the sample folder using maven `mvn integration-test -rf :<artifactId>`, e.g. open a shell in `samples/client/petstore/python`, run `mvn integration-test -rf :PythonPetstoreClientTests`. The artifactId of the project can be found in the pom.xml file. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
|
||||
|
||||
- Update the Petstore sample by running the shell scripts under the `bin` folder. For example, run `./bin/generate-samples.sh .
|
||||
/bin/configs/python*` to update the Python-related samples under [`samples`](https://github.com/openapitools/openapi-generator/tree/master/samples). For Windows, please install [GIT bash](https://gitforwindows.org/). (If you find that there are new files g
|
||||
enerated or unexpected changes as a result of the update, that's not unusual as the test cases are added to the OpenAPI spec fro
|
||||
m time to time. If you've questions or concerns, please open a ticket to start a discussion)
|
||||
- During development it can be helpful to quickly regenerate the samples without recompiling all of openapi-generator, e.g. when you have only updated the mustache templates. This can be done by passing the `-t` parameter: `-t modules/openapi-generator/src/main/resources/python`.
|
||||
- Run the tests in the sample folder using maven `mvn integration-test -f /path/to/pom.xml`, e.g. `mvn integration-test -f samples/client/petstore/python/pom.xml`. (some languages may not contain unit testing for Petstore and we're looking for contribution from the community to implement those tests)
|
||||
- Finally, git commit the updated samples files: `git commit -a`
|
||||
(`git add -A` if added files with new test cases)
|
||||
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml)
|
||||
- For new test cases, please add to the [Fake Petstore spec](https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/3_0/petstore-with-fake-endpoints-models-for-testing.yaml)
|
||||
|
||||
To start the CI tests, you can:
|
||||
- Run `mvn verify -Psamples`, assuming you have all the required tools installed to run tests for different languages.
|
||||
@@ -104,7 +109,8 @@ See [OpenAPI Tools wiki](https://github.com/OpenAPITools/openapi-generator/wiki/
|
||||
- Add test case(s) to cover the change
|
||||
- Document the fix in the code to make the code more readable
|
||||
- Make sure test cases passed after the change (one way is to leverage https://travis-ci.org/ to run the CI tests)
|
||||
- File a PR with meaningful title, description and commit messages.
|
||||
- File a PR with meaningful title, description and commit messages
|
||||
- Make sure the option "Allow edits from maintainers" in the PR is selected so that the maintainers can update your PRs with minor fixes, if needed.
|
||||
- Recommended git settings
|
||||
- `git config core.autocrlf input` to tell Git convert CRLF to LF on commit but not the other way around
|
||||
- To close an issue (e.g. issue 1542) automatically after a PR is merged, use keywords "fix", "close", "resolve" in the PR description, e.g. `fix #1542`. (Ref: [closing issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/))
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
FROM jimschubert/8-jdk-alpine-mvn:1.0
|
||||
|
||||
RUN set -x && \
|
||||
apk add --no-cache bash
|
||||
FROM maven:3.6.3-jdk-11-openj9
|
||||
|
||||
ENV GEN_DIR /opt/openapi-generator
|
||||
WORKDIR ${GEN_DIR}
|
||||
@@ -29,6 +26,6 @@ RUN mvn -am -pl "modules/openapi-generator-cli" package
|
||||
COPY docker-entrypoint.sh /usr/local/bin/
|
||||
RUN ln -s /usr/local/bin/docker-entrypoint.sh /usr/local/bin/openapi-generator
|
||||
|
||||
ENTRYPOINT ["docker-entrypoint.sh"]
|
||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
|
||||
|
||||
CMD ["help"]
|
||||
|
||||
103
README.md
103
README.md
@@ -1,21 +1,22 @@
|
||||
<h1 align="center">OpenAPI Generator</h1>
|
||||
|
||||
|
||||
<div align="center">
|
||||
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.0.0`): [](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
[](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22) [](./LICENSE)  [](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM) [](https://twitter.com/oas_generator)
|
||||
|
||||
</div>
|
||||
|
||||
<div align="center">
|
||||
|
||||
[](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM)
|
||||
[](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22)
|
||||
[](https://twitter.com/oas_generator)
|
||||
[Master](https://github.com/OpenAPITools/openapi-generator/tree/master) (`5.0.0`):
|
||||
[](https://travis-ci.org/OpenAPITools/openapi-generator)
|
||||
[](https://circleci.com/gh/OpenAPITools/openapi-generator)
|
||||
[](https://app.shippable.com/github/OpenAPITools/openapi-generator)
|
||||
[](https://ci.appveyor.com/project/WilliamCheng/openapi-generator-wh2wu)
|
||||
[](https://cloud.drone.io/OpenAPITools/openapi-generator)
|
||||
[](https://app.bitrise.io/app/4a2b10a819d12b67)
|
||||
[](https://github.com/OpenAPITools/openapi-generator/actions?query=workflow%3A%22Check+Supported+Java+Versions%22)
|
||||
|
||||
</div>
|
||||
|
||||
@@ -45,6 +46,7 @@ If you find OpenAPI Generator useful for work, please consider asking your compa
|
||||
[](https://www.lightbow.net/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
|
||||
[<img src="https://openapi-generator.tech/img/companies/docspring.png" width="128" height="128">](https://docspring.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
|
||||
[<img src="https://openapi-generator.tech/img/companies/datadog.png" width="128" height="128">](https://datadoghq.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
|
||||
[<img src="https://openapi-generator.tech/img/companies/thales.jpg" width="128" height="128">](https://cpl.thalesgroup.com/?utm_source=openapi_generator&utm_medium=github_webpage&utm_campaign=sponsor)
|
||||
|
||||
#### Thank you GoDaddy for sponsoring the domain names, Linode for sponsoring the VPS and Checkly for sponsoring the API monitoring
|
||||
|
||||
@@ -76,7 +78,7 @@ OpenAPI Generator allows generation of API client libraries (SDK generation), se
|
||||
- [1.4 - Build Projects](#14---build-projects)
|
||||
- [1.5 - Homebrew](#15---homebrew)
|
||||
- [1.6 - Docker](#16---docker)
|
||||
- [1.7 - NPM](#17---npm)
|
||||
- [1.7 - NPM](#17---npm)
|
||||
- [2 - Getting Started](#2---getting-started)
|
||||
- [3 - Usage](#3---usage)
|
||||
- [3.1 - Customization](#31---customization)
|
||||
@@ -100,7 +102,10 @@ The OpenAPI Specification has undergone 3 revisions since initial creation in 20
|
||||
|
||||
| OpenAPI Generator Version | Release Date | Notes |
|
||||
| --------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------ | ------------------------------------------------- |
|
||||
| 5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/) | 17.06.2020 | Major release with breaking changes (no fallback) |
|
||||
| 5.0.0 (upcoming major release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/) | TBD | Major release with breaking changes (no fallback) |
|
||||
| 5.0.0-beta3 (upcoming beta release) [SNAPSHOT](https://oss.sonatype.org/content/repositories/snapshots/org/openapitools/openapi-generator-cli/5.0.0-SNAPSHOT/) | 01.11.2020 | Major beta release with breaking changes (no fallback) |
|
||||
| [5.0.0-beta2](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.0.0-beta2) (latest beta release) | 04.09.2020 | Major beta release with breaking changes (no fallback) |
|
||||
| [5.0.0-beta](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.0.0-beta) (latest beta release) | 30.06.2020 | Major beta release with breaking changes (no fallback) |
|
||||
| [4.3.1](https://github.com/OpenAPITools/openapi-generator/releases/tag/v4.3.1) (latest stable release) | 06.05.2020 | Patch release (enhancements, bug fixes, etc) |
|
||||
|
||||
OpenAPI Spec compatibility: 1.0, 1.1, 1.2, 2.0, 3.0
|
||||
@@ -157,16 +162,16 @@ See the different versions of the [openapi-generator-cli](https://mvnrepository.
|
||||
<!-- RELEASE_VERSION -->
|
||||
If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):
|
||||
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar`
|
||||
JAR location: `https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.0-beta2/openapi-generator-cli-5.0.0-beta2.jar`
|
||||
|
||||
For **Mac/Linux** users:
|
||||
```sh
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar -O openapi-generator-cli.jar
|
||||
wget https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.0-beta2/openapi-generator-cli-5.0.0-beta2.jar -O openapi-generator-cli.jar
|
||||
```
|
||||
|
||||
For **Windows** users, you will need to install [wget](http://gnuwin32.sourceforge.net/packages/wget.htm) or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.
|
||||
```
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar
|
||||
Invoke-WebRequest -OutFile openapi-generator-cli.jar https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.0-beta2/openapi-generator-cli-5.0.0-beta2.jar
|
||||
```
|
||||
|
||||
After downloading the JAR, run `java -jar openapi-generator-cli.jar help` to show the usage.
|
||||
@@ -257,6 +262,7 @@ To reinstall with the latest master, run `brew uninstall openapi-generator && br
|
||||
|
||||
To install OpenJDK (pre-requisites), please run
|
||||
```sh
|
||||
brew tap AdoptOpenJDK/openjdk
|
||||
brew cask install adoptopenjdk12
|
||||
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/
|
||||
```
|
||||
@@ -346,7 +352,7 @@ Once built, `run-in-docker.sh` will act as an executable for openapi-generator-c
|
||||
./run-in-docker.sh list # Executes 'list' command for openapi-generator-cli
|
||||
./run-in-docker.sh /gen/bin/go-petstore.sh # Builds the Go client
|
||||
./run-in-docker.sh generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml \
|
||||
-g go -o /gen/out/go-petstore -DpackageName=petstore # generates go client, outputs locally to ./out/go-petstore
|
||||
-g go -o /gen/out/go-petstore --package-name=petstore # generates go client, outputs locally to ./out/go-petstore
|
||||
```
|
||||
|
||||
##### Troubleshooting
|
||||
@@ -387,10 +393,10 @@ openapi-generator version
|
||||
```
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
Or install a particular OpenAPI Generator version (e.g. v4.3.1):
|
||||
Or install a particular OpenAPI Generator version (e.g. v5.0.0-beta2):
|
||||
|
||||
```sh
|
||||
npm install @openapitools/openapi-generator-cli@cli-4.3.1 -g
|
||||
npm install @openapitools/openapi-generator-cli@cli-5.0.0-beta2 -g
|
||||
```
|
||||
|
||||
Or install it as dev-dependency:
|
||||
@@ -414,7 +420,7 @@ java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar generat
|
||||
(if you're on Windows, replace the last command with `java -jar modules\openapi-generator-cli\target\openapi-generator-cli.jar generate -i https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g php -o c:\temp\php_api_client`)
|
||||
|
||||
<!-- RELEASE_VERSION -->
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.1/openapi-generator-cli-4.3.1.jar)
|
||||
You can also download the JAR (latest release) directly from [maven.org](https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/5.0.0-beta2/openapi-generator-cli-5.0.0-beta2.jar)
|
||||
<!-- /RELEASE_VERSION -->
|
||||
|
||||
To get a list of **general** options available, please run `java -jar modules/openapi-generator-cli/target/openapi-generator-cli.jar help generate`
|
||||
@@ -453,29 +459,28 @@ NAME
|
||||
SYNOPSIS
|
||||
openapi-generator-cli generate
|
||||
[(-a <authorization> | --auth <authorization>)]
|
||||
[--api-name-suffix <api name suffix>]
|
||||
[--api-package <api package>] [--artifact-id <artifact id>]
|
||||
[--artifact-version <artifact version>]
|
||||
[(-c <configuration file> | --config <configuration file>)]
|
||||
[-D <system properties>...]
|
||||
[--api-name-suffix <api name suffix>] [--api-package <api package>]
|
||||
[--artifact-id <artifact id>] [--artifact-version <artifact version>]
|
||||
[(-c <configuration file> | --config <configuration file>)] [--dry-run]
|
||||
[(-e <templating engine> | --engine <templating engine>)]
|
||||
[--enable-post-process-file]
|
||||
[(-g <generator name> | --generator-name <generator name>)]
|
||||
[--generate-alias-as-model] [--git-repo-id <git repo id>]
|
||||
[--git-user-id <git user id>] [--group-id <group id>]
|
||||
[--generate-alias-as-model] [--git-host <git host>]
|
||||
[--git-repo-id <git repo id>] [--git-user-id <git user id>]
|
||||
[--global-property <global properties>...] [--group-id <group id>]
|
||||
[--http-user-agent <http user agent>]
|
||||
(-i <spec file> | --input-spec <spec file>)
|
||||
[(-i <spec file> | --input-spec <spec file>)]
|
||||
[--ignore-file-override <ignore file override location>]
|
||||
[--import-mappings <import mappings>...]
|
||||
[--instantiation-types <instantiation types>...]
|
||||
[--invoker-package <invoker package>]
|
||||
[--language-specific-primitives <language specific primitives>...]
|
||||
[--library <library>] [--log-to-stderr] [--minimal-update]
|
||||
[--legacy-discriminator-behavior] [--library <library>]
|
||||
[--log-to-stderr] [--minimal-update]
|
||||
[--model-name-prefix <model name prefix>]
|
||||
[--model-name-suffix <model name suffix>]
|
||||
[--model-package <model package>]
|
||||
[(-o <output directory> | --output <output directory>)]
|
||||
[(-p <additional properties> | --additional-properties <additional properties>)...]
|
||||
[(-o <output directory> | --output <output directory>)] [(-p <additional properties> | --additional-properties <additional properties>)...]
|
||||
[--package-name <package name>] [--release-note <release note>]
|
||||
[--remove-operation-id-prefix]
|
||||
[--reserved-words-mappings <reserved word mappings>...]
|
||||
@@ -505,13 +510,12 @@ mvn package
|
||||
```
|
||||
|
||||
Other languages have petstore samples, too:
|
||||
```sh
|
||||
./bin/android-petstore-all.sh
|
||||
./bin/java-petstore-all.sh
|
||||
./bin/objc-petstore.sh
|
||||
```
|
||||
|
||||
... and others. [Here is a list of all scripts.](https://github.com/OpenAPITools/openapi-generator/wiki/Samples-folder#scripts)
|
||||
- [Swift5](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/swift5)
|
||||
- [Ruby](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/ruby)
|
||||
- [Kotlin](https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/kotlin)
|
||||
|
||||
... and more.
|
||||
|
||||
### [3.1 - Customization](#table-of-contents)
|
||||
|
||||
@@ -576,6 +580,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Camptocamp](https://www.camptocamp.com/en)
|
||||
- [Cisco](https://www.cisco.com/)
|
||||
- [codecentric AG](https://www.codecentric.de/)
|
||||
- [CoinAPI](https://www.coinapi.io/)
|
||||
- [Commencis](https://www.commencis.com/)
|
||||
- [Crossover Health](https://crossoverhealth.com/)
|
||||
- [Cupix](https://www.cupix.com/)
|
||||
@@ -598,6 +603,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [GoDaddy](https://godaddy.com)
|
||||
- [Here](https://developer.here.com/)
|
||||
- [IBM](https://www.ibm.com/)
|
||||
- [Instana](https://www.instana.com)
|
||||
- [JustStar](https://www.juststarinfo.com)
|
||||
- [k6.io](https://k6.io/)
|
||||
- [Klarna](https://www.klarna.com/)
|
||||
@@ -611,6 +617,8 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [MoonVision](https://www.moonvision.io/)
|
||||
- [Myworkout](https://myworkout.com)
|
||||
- [NamSor](https://www.namsor.com/)
|
||||
- [Nokia](https://www.nokia.com/)
|
||||
- [Options Clearing Corporation (OCC)](https://www.theocc.com/)
|
||||
- [Openet](https://www.openet.com/)
|
||||
- [openVALIDATION](https://openvalidation.io/)
|
||||
- [Oracle](https://www.oracle.com/)
|
||||
@@ -620,12 +628,14 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [Prometheus/Alertmanager](https://github.com/prometheus/alertmanager)
|
||||
- [QEDIT](https://qed-it.com)
|
||||
- [Qulix Systems](https://www.qulix.com)
|
||||
- [Raksul](https://corp.raksul.com)
|
||||
- [Raiffeisen Schweiz Genossenschaft](https://www.raiffeisen.ch)
|
||||
- [RedHat](https://www.redhat.com)
|
||||
- [RepreZen API Studio](https://www.reprezen.com/swagger-openapi-code-generation-api-first-microservices-enterprise-development)
|
||||
- [REST United](https://restunited.com)
|
||||
- [Robotinfra](https://www.robotinfra.com)
|
||||
- [Sony Interactive Entertainment](https://www.sie.com/en/index.html)
|
||||
- [Splitit](https://www.splitit.com/)
|
||||
- [Stingray](http://www.stingray.com)
|
||||
- [Suva](https://www.suva.ch/)
|
||||
- [Telstra](https://dev.telstra.com)
|
||||
@@ -633,6 +643,7 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- [TUI InfoTec GmbH](http://www.tui-infotec.com/)
|
||||
- [unblu inc.](https://www.unblu.com/)
|
||||
- [Veamly](https://www.veamly.com/)
|
||||
- [wbt-solutions](https://www.wbt-solutions.de/)
|
||||
- [Woleet](https://www.woleet.io/)
|
||||
- [WSO2](https://wso2.com/)
|
||||
- [Vouchery.io](https://vouchery.io)
|
||||
@@ -751,6 +762,22 @@ Here are some companies/projects (alphabetical order) using OpenAPI Generator in
|
||||
- 2020-05-18 - [Spring Boot REST with OpenAPI 3](https://dev.to/alfonzjanfrithz/spring-boot-rest-with-openapi-3-59jm) by [Alfonz Jan Frithz](https://dev.to/alfonzjanfrithz)
|
||||
- 2020-05-19 - [Dead Simple APIs with Open API](https://www.youtube.com/watch?v=sIaXmR6xRAw) by [Chris Tankersley](https://github.com/dragonmantank) at [Nexmo](https://developer.nexmo.com/)
|
||||
- 2020-05-22 - [TypeScript REST API Client](https://dev.to/unhurried/typescript-rest-api-client-4in3) by ["unhurried"](https://dev.to/unhurried)
|
||||
- 2020-05-28 - [【使用 lotify + Swagger 建置可共用的 LINE Notify bot】 - #NiJia @ Chatbot Developer Taiwan 第 #19 小聚](https://www.youtube.com/watch?v=agYVz6dzh1I) by [Chatbot Developer Taiwan](https://www.youtube.com/channel/UCxeYUyZNnHmpX23YNF-ewvw)
|
||||
- 2020-05-28 - [Building APIs with Laravel using OpenAPI](https://www.youtube.com/watch?v=xexLvQqAhiA) by [Chris Tankersley](https://github.com/dragonmantank) at [Laracon EU](https://laracon.eu/)
|
||||
- 2020-06-23 - [新規サーバーアプリケーションにTypeScriptを採用してみた](https://www.cam-inc.co.jp/news/20200623) at [CAM Tech Blog](https://www.cam-inc.co.jp/news/tech-blog/)
|
||||
- 2020-06-29 - [Artifact Abstract: Deployment of APIs on Android Mobile Devices and Microcontrollers](https://ieeexplore.ieee.org/document/9127353) by [Sergio Laso ; Marino Linaje ; Jose Garcia-Alonso ; Juan M. Murillo ; Javier Berrocal](https://ieeexplore.ieee.org/document/9127353/authors#authors) at [2020 IEEE International Conference on Pervasive Computing and Communications (PerCom)](https://ieeexplore.ieee.org/xpl/conhome/9125449/proceeding)
|
||||
- 2020-07-07 - [5 Best API Documentation Tools](https://blog.dreamfactory.com/5-best-api-documentation-tools/) by Susanna Bouse at [DreamFactory Blog](https://blog.dreamfactory.com/)
|
||||
- 2020-07-12 - [Open API 3.0の定義からgolangのサーバコードのスケルトンを作成する](https://qiita.com/professor/items/4cbd04ec084d13057bc2) by [@professor (Qiita Blog)](https://qiita.com/professor)
|
||||
- 2020-07-20 - [Datadog API client libraries now available for Java and Go](https://www.datadoghq.com/blog/java-go-libraries/) by Jordan Obey at [Datadog Blog](https://www.datadoghq.com/blog)
|
||||
- 2020-07-23 - [Generate Client SDK for .NET Core using Open Api](https://dev.to/no0law1/generate-client-sdk-for-net-core-using-open-api-2dgh) by [Nuno Reis](https://dev.to/no0law1)
|
||||
- 2020-07-26 - [Dartのhttp_interceptorライブラリを使うと配列のクエリパラメータが消えてしまう件の応急処置](https://qiita.com/gyamoto/items/eeeff81b6770487319ed) by [@gyamoto](https://qiita.com/gyamoto)
|
||||
- 2020-08-01 - [Generate Angular ReactiveForms from Swagger/OpenAPI](https://dev.to/martinmcwhorter/generate-angular-reactiveforms-from-swagger-openapi-35h9) by [Martin McWhorter](https://dev.to/martinmcwhorter)
|
||||
- 2020-08-03 - [Criando Bibliotecas para APIs RESTful com OpenAPI, Swagger Editor e OpenAPI Generator](https://medium.com/@everisBrasil/criando-bibliotecas-para-apis-restful-com-openapi-swagger-editor-e-openapi-generator-75349a6420fd) by [everis Brasil (an NTT DATA Company)](https://medium.com/@everisBrasil)
|
||||
- 2020-08-19 - [マイクロサービスを連携してみよう](https://thinkit.co.jp/article/17704) by [岡井 裕矢(おかい ゆうや)](https://thinkit.co.jp/author/17588), [泉 勝(いずみ まさる)](https://thinkit.co.jp/author/17705) at [Think IT(シンクイット)](https://thinkit.co.jp/)
|
||||
- 2020-08-25 - [OpenAPI Generator と TypeScript で型安全にフロントエンド開発をしている話](https://tech.smarthr.jp/entry/2020/08/25/135631) at [SmartHR Tech Blog](https://tech.smarthr.jp/)
|
||||
- 2020-09-10 - [Introduction to OpenAPI with Instana](https://www.instana.com/blog/introduction-to-openapi-with-instana/) by [Cedric Ziel](https://www.instana.com/blog/author/cedricziel/) at [Instana Blog](https://www.instana.com/blog/)
|
||||
- 2020-09-17 - [Generate PowerShellSDK using openapi-generator](https://medium.com/@ghufz.learn/generate-powershellsdk-using-openapi-generator-33b700891e33) by [Ghufran Zahidi](https://medium.com/@ghufz.learn)
|
||||
- 2020-09-24 - [How to automate API code generation (OpenAPI/Swagger) and boost productivity - Tutorial with React Native featuring TypeScript](https://medium.com/@sceleski/how-to-automate-api-code-generation-openapi-swagger-and-boost-productivity-1176a0056d8a) by [Sanjin Celeski](https://medium.com/@sceleski)
|
||||
|
||||
## [6 - About Us](#table-of-contents)
|
||||
|
||||
@@ -943,7 +970,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Bash | @frol (2017/07) @bkryza (2017/08) @kenjones-cisco (2017/09) |
|
||||
| C | @zhemant (2018/11) @ityuhui (2019/12) @michelealbano (2020/03) |
|
||||
| C++ | @ravinikam (2017/07) @stkrwork (2017/07) @etherealjoy (2018/02) @martindelille (2018/03) @muttleyxd (2019/08) |
|
||||
| C# | @mandrean (2017/08), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert) @frankyjuang (2019/09) @shibayan (2020/02) |
|
||||
| C# | @mandrean (2017/08) @frankyjuang (2019/09) @shibayan (2020/02) |
|
||||
| Clojure | |
|
||||
| Dart | @ircecho (2017/07) @swipesight (2018/09) @jaumard (2018/09) @athornz (2019/12) @amondnet (2019/12) |
|
||||
| Eiffel | @jvelilla (2017/09) |
|
||||
@@ -951,7 +978,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Elm | @eriktim (2018/09) |
|
||||
| Erlang | @tsloughter (2017/11) @jfacorro (2018/10) @robertoaloi (2018/10) |
|
||||
| F# | @nmfisher (2019/05) |
|
||||
| Go | @antihax (2017/11) @bvwells (2017/12) @grokify (2018/07) @kemokemo (2018/09) @bkabrda (2019/07) |
|
||||
| Go | @antihax (2017/11) @grokify (2018/07) @kemokemo (2018/09) @bkabrda (2019/07) |
|
||||
| GraphQL | @renepardon (2018/12) |
|
||||
| Groovy | |
|
||||
| Haskell | |
|
||||
@@ -968,7 +995,7 @@ If you want to join the committee, please kindly apply by sending an email to te
|
||||
| Python | @taxpon (2017/07) @frol (2017/07) @mbohlool (2017/07) @cbornet (2017/09) @kenjones-cisco (2017/11) @tomplus (2018/10) @Jyhess (2019/01) @arun-nalla (2019/11) @spacether (2019/11) |
|
||||
| R | @Ramanth (2019/07) @saigiridhar21 (2019/07) |
|
||||
| Ruby | @cliffano (2017/07) @zlx (2017/09) @autopp (2019/02) |
|
||||
| Rust | @frol (2017/07) @farcaller (2017/08) @bjgill (2017/12) @richardwhiuk (2019/07) @paladinzh (2020/05) |
|
||||
| Rust | @frol (2017/07) @farcaller (2017/08) @richardwhiuk (2019/07) @paladinzh (2020/05) |
|
||||
| Scala | @clasnake (2017/07), @jimschubert (2017/09) [:heart:](https://www.patreon.com/jimschubert), @shijinkui (2018/01), @ramzimaalej (2018/03), @chameleon82 (2020/03), @Bouillie (2020/04) |
|
||||
| Swift | @jgavris (2017/07) @ehyche (2017/08) @Edubits (2017/09) @jaz-ah (2017/09) @4brunu (2019/11) |
|
||||
| TypeScript | @TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02) |
|
||||
|
||||
19
appveyor.yml
19
appveyor.yml
@@ -1,5 +1,5 @@
|
||||
version: '{branch}-{build}'
|
||||
image: Visual Studio 2017
|
||||
image: Visual Studio 2019
|
||||
hosts:
|
||||
petstore.swagger.io: 127.0.0.1
|
||||
install:
|
||||
@@ -15,14 +15,14 @@ install:
|
||||
# install gradle
|
||||
- ps: |
|
||||
Add-Type -AssemblyName System.IO.Compression.FileSystem
|
||||
if (!(Test-Path -Path "C:\gradle" )) {
|
||||
if (!(Test-Path -Path "C:\gradle\gradle-5.6.4" )) {
|
||||
(new-object System.Net.WebClient).DownloadFile(
|
||||
'https://services.gradle.org/distributions/gradle-5.3.1-bin.zip',
|
||||
'https://services.gradle.org/distributions/gradle-5.6.4-bin.zip',
|
||||
'C:\gradle-bin.zip'
|
||||
)
|
||||
[System.IO.Compression.ZipFile]::ExtractToDirectory("C:\gradle-bin.zip", "C:\gradle")
|
||||
}
|
||||
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.3.1\bin;%JAVA_HOME%\bin;%PATH%
|
||||
- cmd: SET PATH=C:\maven\apache-maven-3.2.5\bin;C:\gradle\gradle-5.6.4\bin;%JAVA_HOME%\bin;%PATH%
|
||||
- cmd: SET MAVEN_OPTS=-Xmx4g
|
||||
- cmd: SET JAVA_OPTS=-Xmx4g
|
||||
- cmd: SET M2_HOME=C:\maven\apache-maven-3.2.5
|
||||
@@ -52,21 +52,20 @@ build_script:
|
||||
# run the locally installed openapi-generator-gradle-plugin
|
||||
- gradle -b modules\openapi-generator-gradle-plugin\samples\local-spec\build.gradle buildGoSdk --stacktrace
|
||||
test_script:
|
||||
# restore test-related files
|
||||
- copy /b/v/y CI\samples.ci\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test c# API client (netcore)
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClientCore\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
- dotnet test samples\client\petstore\csharp-netcore\OpenAPIClient\src\Org.OpenAPITools.Test\Org.OpenAPITools.Test.csproj
|
||||
# test c# API client
|
||||
- nunit3-console samples\client\petstore\csharp\OpenAPIClient\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
|
||||
# test c# API client (with PropertyChanged)
|
||||
- nunit3-console samples\client\petstore\csharp\OpenAPIClientWithPropertyChanged\src\Org.OpenAPITools.Test\bin\Debug\Org.OpenAPITools.Test.dll --result=myresults.xml;format=AppVeyor
|
||||
|
||||
### TODO: Execute all generators via powershell or other
|
||||
# generate all petstore clients
|
||||
- .\bin\windows\run-all-petstore.cmd
|
||||
|
||||
# - .\bin\windows\run-all-petstore.cmd
|
||||
# generate all petstore clients (openapi3)
|
||||
- .\bin\openapi3\windows\run-all-petstore.cmd
|
||||
# - .\bin\openapi3\windows\run-all-petstore.cmd
|
||||
|
||||
# test ps pestore
|
||||
- ps: |
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
model="modules/openapi-generator/src/test/resources/2_0/petstore.yaml"
|
||||
ags="generate --template-dir modules/openapi-generator/src/main/resources/Ada -g ada $@"
|
||||
ags="$ags -i $model -t modules/openapi-generator/src/main/resources/Ada -o samples/client/petstore/ada"
|
||||
ags="$ags --additional-properties projectName=Petstore --model-package Samples.Petstore"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
rm -rf samples/client/petstore/ada/src/server
|
||||
@@ -1,5 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
./bin/android-petstore-httpclient.sh
|
||||
./bin/android-petstore-volley.sh
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/android -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android --additional-properties library=httpclient -o samples/client/petstore/android/httpclient $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"library": "volley",
|
||||
"artifactId": "petstore-android-volley"
|
||||
}
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g android -c bin/android-petstore-volley.json -o samples/client/petstore/android/volley $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -g apache2 -t modules/openapi-generator/src/main/resources/apache2/ -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -o samples/config/petstore/apache2 $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/apex -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g apex -o samples/client/petstore/apex --global-property skipFormModel=true $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,31 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=$(ls -ld "$SCRIPT")
|
||||
link=$(expr "$ls" : '.*-> \(.*\)$')
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=$(dirname "$SCRIPT")/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=$(dirname "$SCRIPT")/..
|
||||
APP_DIR=$(cd "${APP_DIR}"; pwd)
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/asciidoc-documentation --additional-properties=specDir=modules/openapi-generator/src/main/resources/asciidoc-documentation,snippetDir=. -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g asciidoc -o samples/documentation/asciidoc $@"
|
||||
|
||||
java ${JAVA_OPTS} -jar ${executable} ${ags}
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/3.0/ -o samples/server/petstore/aspnetcore-3.0 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.0 $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/3.0/ -o samples/server/petstore/aspnetcore-3.1 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.1 $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/2.1/ -o samples/server/petstore/aspnetcore --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -g aspnetcore -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -t modules/openapi-generator/src/main/resources/aspnetcore/3.0/ -o samples/server/petstore/aspnetcore3 --additional-properties packageGuid={3C799344-F285-4669-8FD5-7ED9B795D5C5} --additional-properties aspnetCoreVersion=3.0 $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/avro-schema -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -g avro-schema -o samples/openapi3/schema/petstore/avro-schema $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
args="generate -t modules/openapi-generator/src/main/resources/bash -i modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml -g bash -o samples/client/petstore/bash -c modules/openapi-generator/src/test/resources/2_0/bash-config.json --additional-properties hideGenerationTimestamp=true $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $args
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT="$0"
|
||||
echo "# START SCRIPT: $SCRIPT"
|
||||
|
||||
while [ -h "$SCRIPT" ] ; do
|
||||
ls=`ls -ld "$SCRIPT"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
SCRIPT="$link"
|
||||
else
|
||||
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||
fi
|
||||
done
|
||||
|
||||
if [ ! -d "${APP_DIR}" ]; then
|
||||
APP_DIR=`dirname "$SCRIPT"`/..
|
||||
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||
fi
|
||||
|
||||
executable="./modules/openapi-generator-cli/target/openapi-generator-cli.jar"
|
||||
|
||||
if [ ! -f "$executable" ]
|
||||
then
|
||||
mvn -B clean package
|
||||
fi
|
||||
|
||||
# if you've executed sbt assembly previously it will use that instead.
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||
ags="generate -t modules/openapi-generator/src/main/resources/C-libcurl -i modules/openapi-generator/src/test/resources/2_0/petstore.yaml -g c -o samples/client/petstore/c $@"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"generatorName": "apex",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/apex",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/apex"
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "csharp-netcore",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
|
||||
"outputDir": "samples/client/petstore/csharp-netcore/OpenAPIClientCore",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/csharp-netcore/",
|
||||
"additionalProperties": {
|
||||
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}",
|
||||
"useCompareNetObjects": true,
|
||||
"targetFramework": "netcoreapp2.0"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"generatorName": "csharp-netcore",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
|
||||
"outputDir": "samples/client/petstore/csharp-netcore/OpenAPIClient",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/csharp-netcore/",
|
||||
"additionalProperties": {
|
||||
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}",
|
||||
"useCompareNetObjects": true
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"generatorName": "csharp",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
|
||||
"outputDir": "samples/client/petstore/csharp/OpenAPIClient",
|
||||
"additionalProperties": {
|
||||
"packageGuid": "{321C8C3F-0156-40C1-AE42-D59761FB9B6C}"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/dart/flutter_petstore/openapi",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true,
|
||||
"browserClient": false,
|
||||
"supportDart2": false
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart-jaguar",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/dart-jaguar/flutter_petstore/openapi",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true,
|
||||
"pubName": "openapi"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart-jaguar",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml",
|
||||
"outputDir": "samples/client/petstore/dart-jaguar/flutter_proto_petstore/openapi",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
|
||||
"additionalProperties": {
|
||||
"serialization": "proto",
|
||||
"hideGenerationTimestamp": true,
|
||||
"pubName": "openapi"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart-jaguar",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-proto.yaml",
|
||||
"outputDir": "samples/client/petstore/dart-jaguar/openapi_proto",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
|
||||
"additionalProperties": {
|
||||
"serialization": "proto",
|
||||
"hideGenerationTimestamp": true,
|
||||
"pubName": "openapi"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart-jaguar",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/dart-jaguar/openapi",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart-jaguar",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true,
|
||||
"pubName": "openapi"
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/dart/flutter_petstore/openapi",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true,
|
||||
"browserClient": false,
|
||||
"supportDart2": false
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/dart/openapi-browser-client",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true,
|
||||
"browserClient": true,
|
||||
"supportDart2": false
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/dart/openapi",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true,
|
||||
"browserClient": false,
|
||||
"supportDart2": false
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"generatorName": "dart",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/client/petstore/dart2/openapi",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/dart2",
|
||||
"additionalProperties": {
|
||||
"hideGenerationTimestamp": true
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"generatorName": "elixir",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
|
||||
"outputDir": "samples/client/petstore/elixir/",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/elixir",
|
||||
"additionalProperties": {
|
||||
"invokerPackage": "OpenapiPetstore"
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"generatorName": "go-gin-server",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore.yaml",
|
||||
"outputDir": "samples/server/petstore/go-gin-api-server",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/go-gin-server",
|
||||
"additionalProperties": {
|
||||
"packageName": "petstoreserver",
|
||||
"hideGenerationTimestamp": true
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
"generatorName": "go",
|
||||
"inputSpec": "modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml",
|
||||
"outputDir": "samples/client/petstore/go/go-petstore-withXml",
|
||||
"templateDir": "modules/openapi-generator/src/main/resources/go",
|
||||
"additionalProperties": {
|
||||
"packageName": "petstore",
|
||||
"withXml": true,
|
||||
"withGoCodegenComment": true
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user