forked from loafle/openapi-generator-original
Compare commits
2613 Commits
swagger-co
...
v2.1.3
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6aa66897aa | ||
|
|
9b0ddd3a7f | ||
|
|
ee05366d0b | ||
|
|
d048a68438 | ||
|
|
9cc7615b71 | ||
|
|
dfb9d26c75 | ||
|
|
715c0af41f | ||
|
|
65829e5b6e | ||
|
|
a3c7e22d55 | ||
|
|
d8ceb8c648 | ||
|
|
87f1ef4dc2 | ||
|
|
7c2310a13f | ||
|
|
6dcb8da2d8 | ||
|
|
a83f01ad60 | ||
|
|
6c1f7243bf | ||
|
|
164ed99812 | ||
|
|
355cc88e0d | ||
|
|
35ed412d1e | ||
|
|
a5190266b6 | ||
|
|
d51fe80138 | ||
|
|
ec9cdca7cb | ||
|
|
8a9f43b142 | ||
|
|
0fc5702e4d | ||
|
|
3390fae15b | ||
|
|
e19b883c89 | ||
|
|
9531e1ae59 | ||
|
|
3d38c41b0e | ||
|
|
718e1ff68a | ||
|
|
a6a9d743be | ||
|
|
414de00894 | ||
|
|
cc7366787f | ||
|
|
3486eecdfc | ||
|
|
66e6d4fb8a | ||
|
|
f7dc066dec | ||
|
|
3160913433 | ||
|
|
e253fdea33 | ||
|
|
ac49d0dcdc | ||
|
|
b956d47a9d | ||
|
|
f662699fd0 | ||
|
|
1c1571cc3a | ||
|
|
e13374e1df | ||
|
|
f2df26f6e6 | ||
|
|
569082743f | ||
|
|
595c01c537 | ||
|
|
dc423cc11d | ||
|
|
4f25a0e6c5 | ||
|
|
0af29cc5cf | ||
|
|
44b4af0374 | ||
|
|
b68beefa69 | ||
|
|
07162811a7 | ||
|
|
4023460f2e | ||
|
|
83bea6a0c5 | ||
|
|
d03f680c64 | ||
|
|
4189d0765b | ||
|
|
6218ad139f | ||
|
|
b7cd38d38b | ||
|
|
2b61305582 | ||
|
|
2057d0e144 | ||
|
|
af2ec4cf85 | ||
|
|
9a239ad2a4 | ||
|
|
a610fb5ac3 | ||
|
|
fb4c62cc28 | ||
|
|
894d571ea5 | ||
|
|
dc1992ad45 | ||
|
|
c62fca8c54 | ||
|
|
5d52952ebd | ||
|
|
c1fbf6bb1c | ||
|
|
10cd672529 | ||
|
|
52918d325e | ||
|
|
8cff8fc55a | ||
|
|
90d5ce228a | ||
|
|
d4ff25f0b3 | ||
|
|
4163f07911 | ||
|
|
560fd5718d | ||
|
|
97580a8c45 | ||
|
|
aee72d97c3 | ||
|
|
49ad008d7c | ||
|
|
7a2c0a076a | ||
|
|
365f4bc0c0 | ||
|
|
3478e053e1 | ||
|
|
75536868f2 | ||
|
|
84e8ef489c | ||
|
|
cffba0299a | ||
|
|
a6c07a8364 | ||
|
|
b14edffc79 | ||
|
|
b971aa7433 | ||
|
|
bb4311b7a2 | ||
|
|
1c0eb60c71 | ||
|
|
a0eeb90a97 | ||
|
|
38fccbd73d | ||
|
|
6fbb8ab1e0 | ||
|
|
6044f0586e | ||
|
|
84ff5cfc87 | ||
|
|
96be2b196b | ||
|
|
d93b404b23 | ||
|
|
be63776162 | ||
|
|
ae4b4979a7 | ||
|
|
0a8fb1e532 | ||
|
|
e78844cb54 | ||
|
|
2eb0c8cea6 | ||
|
|
2aaad03ab6 | ||
|
|
cb181e3480 | ||
|
|
b686b53259 | ||
|
|
f27eb7e0de | ||
|
|
36b7fb20b2 | ||
|
|
f2ef21e756 | ||
|
|
e57f1de21f | ||
|
|
a41361c959 | ||
|
|
167e95bb3a | ||
|
|
732a9eb64d | ||
|
|
c7f595fc91 | ||
|
|
29e8a8f573 | ||
|
|
d5b959d8cd | ||
|
|
7a92f53b55 | ||
|
|
4ac8a93022 | ||
|
|
cad2f961bd | ||
|
|
5328c00e8f | ||
|
|
1b31a01b76 | ||
|
|
c67a6582fc | ||
|
|
dc76887820 | ||
|
|
4321339d4f | ||
|
|
07f10a8abc | ||
|
|
4ba521a5c0 | ||
|
|
d88ec847ae | ||
|
|
7c16dfcf13 | ||
|
|
aff21e5e6b | ||
|
|
befacc41bd | ||
|
|
edebbcb802 | ||
|
|
bfb4629ab7 | ||
|
|
1007534575 | ||
|
|
97d24a7119 | ||
|
|
13038d2a12 | ||
|
|
c5dc070685 | ||
|
|
a30b66beb1 | ||
|
|
aff766b785 | ||
|
|
112a7ec8c1 | ||
|
|
55be0330e3 | ||
|
|
fe83d18a09 | ||
|
|
a6f8f9e4ff | ||
|
|
79c988616c | ||
|
|
dc62f688d9 | ||
|
|
db10bd764b | ||
|
|
92208b4ec2 | ||
|
|
0ef4702aa8 | ||
|
|
cc358cf9ce | ||
|
|
a1e6908b65 | ||
|
|
2d4c07a474 | ||
|
|
05f00013f1 | ||
|
|
bc528ef928 | ||
|
|
318a239976 | ||
|
|
189962208e | ||
|
|
bd28271b0b | ||
|
|
14b808a910 | ||
|
|
d345f8fae3 | ||
|
|
26336356cf | ||
|
|
9c3fad3040 | ||
|
|
d396a0a0e4 | ||
|
|
dc7c2a4bab | ||
|
|
0b85ad464a | ||
|
|
c5d02fe98e | ||
|
|
a81e5096f5 | ||
|
|
52971e6aa9 | ||
|
|
b2e0d83f2e | ||
|
|
2be3414357 | ||
|
|
ea901bf1ce | ||
|
|
8bd282acd6 | ||
|
|
b51ef77401 | ||
|
|
3265ec0f72 | ||
|
|
732e645042 | ||
|
|
cc45ff17cb | ||
|
|
b843b55339 | ||
|
|
75711f954b | ||
|
|
d0b5af31a5 | ||
|
|
c01c06b198 | ||
|
|
586f4c14e1 | ||
|
|
fe0e43f963 | ||
|
|
47abfe7079 | ||
|
|
d0a3def441 | ||
|
|
64f2e85608 | ||
|
|
09ccf12a3b | ||
|
|
fde5c60cb0 | ||
|
|
b18cc5e0de | ||
|
|
6d8dea5dfc | ||
|
|
a8f580032f | ||
|
|
d0baa48fcd | ||
|
|
31200acc1a | ||
|
|
3b9b3e82f9 | ||
|
|
783a4c0572 | ||
|
|
9ce824d720 | ||
|
|
dee828622a | ||
|
|
5c0ae7babe | ||
|
|
02da80e837 | ||
|
|
e41a475335 | ||
|
|
fea8e680df | ||
|
|
b0f6b49595 | ||
|
|
b56da43953 | ||
|
|
979a704310 | ||
|
|
5dcdadb751 | ||
|
|
f98974190e | ||
|
|
6719a6cc74 | ||
|
|
3f9b2a9678 | ||
|
|
bbf0ce8c80 | ||
|
|
9fc8c770d3 | ||
|
|
8f2c99f0af | ||
|
|
81f5cc47e7 | ||
|
|
db37c02ebd | ||
|
|
fc71b23464 | ||
|
|
e924cec595 | ||
|
|
90f152da75 | ||
|
|
713ae4a957 | ||
|
|
50736458d0 | ||
|
|
34b341874c | ||
|
|
7a1f3dbf9e | ||
|
|
3723a9ba2d | ||
|
|
bc8eae838c | ||
|
|
88ed496b44 | ||
|
|
646da19c7d | ||
|
|
80b5363202 | ||
|
|
071fc2ded6 | ||
|
|
992b0c7e5e | ||
|
|
037f59d0df | ||
|
|
5a235c642a | ||
|
|
08ea05f7a1 | ||
|
|
e301d9d00e | ||
|
|
8a399ee1cb | ||
|
|
4e5b9e4af3 | ||
|
|
37c79525f7 | ||
|
|
f9ad16e7aa | ||
|
|
cde8d7ba4c | ||
|
|
bd6fa6a2e4 | ||
|
|
b9287cf417 | ||
|
|
df93ca80f7 | ||
|
|
0247f0774d | ||
|
|
37dbd6e4cd | ||
|
|
34db9814d8 | ||
|
|
cf7082c2e6 | ||
|
|
6b4f810fec | ||
|
|
f7a07f72b8 | ||
|
|
a6012ecf41 | ||
|
|
0b7b57bf4d | ||
|
|
498a400d4e | ||
|
|
405e5a7a35 | ||
|
|
f1304022b0 | ||
|
|
fc7f2a92d0 | ||
|
|
27113cf326 | ||
|
|
7179c15158 | ||
|
|
ba72e7344a | ||
|
|
596bde2ef6 | ||
|
|
a863e538a8 | ||
|
|
a134b5ca76 | ||
|
|
1f7664f81e | ||
|
|
68820e5a80 | ||
|
|
195c71da37 | ||
|
|
ddfa713f55 | ||
|
|
c9889c5baf | ||
|
|
60d6cd744a | ||
|
|
1072c9d017 | ||
|
|
4bc4a8aed1 | ||
|
|
0ad7005547 | ||
|
|
3993ef3dc8 | ||
|
|
8746f1544b | ||
|
|
f0e09ae33a | ||
|
|
e879268043 | ||
|
|
33561fa159 | ||
|
|
78760907a5 | ||
|
|
30eb1f1075 | ||
|
|
5c9afbafb2 | ||
|
|
0092d8a63b | ||
|
|
3c6f07cbe3 | ||
|
|
95cb5f73a3 | ||
|
|
02f6c805af | ||
|
|
13d74f01a2 | ||
|
|
8877be82f0 | ||
|
|
a25d3f2543 | ||
|
|
3f017af464 | ||
|
|
0e56d0d1c6 | ||
|
|
f48a7f20e6 | ||
|
|
9a15ced211 | ||
|
|
e244d20152 | ||
|
|
412b6b3839 | ||
|
|
0a652a3d13 | ||
|
|
4d302683f3 | ||
|
|
517717958d | ||
|
|
b42ead3c0f | ||
|
|
8a3c64aa41 | ||
|
|
d97b0984cb | ||
|
|
0e8cf70dc4 | ||
|
|
88e5860d9b | ||
|
|
157b07e552 | ||
|
|
1f097ee1a1 | ||
|
|
7a5fd24785 | ||
|
|
59258be3dd | ||
|
|
e5bdb3a0c1 | ||
|
|
dd35c672f0 | ||
|
|
18ea21087f | ||
|
|
746a55be73 | ||
|
|
7242a664e3 | ||
|
|
9f76acbbd7 | ||
|
|
af67353022 | ||
|
|
ecf4082d68 | ||
|
|
5821e41185 | ||
|
|
822e640e0a | ||
|
|
30925b7800 | ||
|
|
bb570d7efa | ||
|
|
c88c85a317 | ||
|
|
23dfac0194 | ||
|
|
b99f006861 | ||
|
|
80d1deb2dd | ||
|
|
2912ee8ae1 | ||
|
|
6df6c079ee | ||
|
|
f4226474e2 | ||
|
|
b70a0bf0c6 | ||
|
|
7dca394eca | ||
|
|
80303b524d | ||
|
|
6e7c70f247 | ||
|
|
715c56afcc | ||
|
|
aad05c4dee | ||
|
|
3f9d1607b6 | ||
|
|
879c1b921c | ||
|
|
fb0b7d622f | ||
|
|
f154e407d2 | ||
|
|
44705b566d | ||
|
|
71a22141bf | ||
|
|
38149173ff | ||
|
|
2258a4632d | ||
|
|
259b31ccd4 | ||
|
|
7f31da734d | ||
|
|
fcd0b31d7d | ||
|
|
4c2df94ec7 | ||
|
|
38760d2aa1 | ||
|
|
f6174051cb | ||
|
|
68915eeb8f | ||
|
|
1434691927 | ||
|
|
b46efd839d | ||
|
|
c7f8f0171b | ||
|
|
045a3b44c1 | ||
|
|
6c85fc285a | ||
|
|
7cc9581f04 | ||
|
|
9283249963 | ||
|
|
461f556289 | ||
|
|
e3d3641b96 | ||
|
|
7e8f8e85d7 | ||
|
|
abc7100a17 | ||
|
|
661b9d6315 | ||
|
|
a21c2be877 | ||
|
|
5c29cbf33d | ||
|
|
d3bc347e31 | ||
|
|
1f35f58841 | ||
|
|
a51d71e728 | ||
|
|
b8c06505f6 | ||
|
|
80731633b4 | ||
|
|
4c16366f45 | ||
|
|
4133cae2bc | ||
|
|
f6a1af2831 | ||
|
|
a24fee00cb | ||
|
|
f42f329ace | ||
|
|
6fd2ccabee | ||
|
|
20c7932df4 | ||
|
|
e49fe7a12f | ||
|
|
b1b0e28f59 | ||
|
|
dfd8d5ef64 | ||
|
|
94768d44b5 | ||
|
|
3b1999af4b | ||
|
|
7e4a82bcfb | ||
|
|
f823c0e26a | ||
|
|
bf32777b67 | ||
|
|
987a61640b | ||
|
|
66d16cfeaf | ||
|
|
0bf4163389 | ||
|
|
b61a400d91 | ||
|
|
55827fe516 | ||
|
|
5c888ad039 | ||
|
|
d7d6ba957e | ||
|
|
57b54d8ad7 | ||
|
|
4b896c759c | ||
|
|
aba755d3de | ||
|
|
fe35675168 | ||
|
|
d825b96720 | ||
|
|
422da698f6 | ||
|
|
488e604207 | ||
|
|
846d282ba0 | ||
|
|
6f1dd5ce35 | ||
|
|
108b2241c0 | ||
|
|
4d6dbf7d92 | ||
|
|
eca827613d | ||
|
|
2e76b56f30 | ||
|
|
f290de95dd | ||
|
|
59987a54a9 | ||
|
|
2d59c5d190 | ||
|
|
9726ada8d1 | ||
|
|
76ece5a4eb | ||
|
|
91af76cf41 | ||
|
|
65af735d6c | ||
|
|
30bc58f6ff | ||
|
|
3eca940e7d | ||
|
|
38d62d768a | ||
|
|
1de6952279 | ||
|
|
54d6a7e19c | ||
|
|
fafddbf040 | ||
|
|
d8b0cb739f | ||
|
|
2d3d35cfd7 | ||
|
|
8c10e4f2b0 | ||
|
|
0ac1ef266f | ||
|
|
327128dbba | ||
|
|
16e80c65d7 | ||
|
|
40c9f05536 | ||
|
|
091e76703c | ||
|
|
6a24b328e3 | ||
|
|
4143e28637 | ||
|
|
31efefe0b9 | ||
|
|
e60bd564cb | ||
|
|
69b75bb1af | ||
|
|
1fb796f14d | ||
|
|
e996498a24 | ||
|
|
c3d1367e7c | ||
|
|
69eae7d35b | ||
|
|
162d1d1f98 | ||
|
|
07d5365c5c | ||
|
|
f1239aba6c | ||
|
|
37620518e7 | ||
|
|
9d739a44cd | ||
|
|
18ac6e8aae | ||
|
|
8cce7ac053 | ||
|
|
e6e1db2064 | ||
|
|
ceafbcc97f | ||
|
|
f3a0f464f7 | ||
|
|
1af23fb751 | ||
|
|
ea76f34de5 | ||
|
|
8ce3823698 | ||
|
|
644231b915 | ||
|
|
621e3e7b1a | ||
|
|
6aac24398a | ||
|
|
545fb52b7d | ||
|
|
8e6c0f96fb | ||
|
|
1b1f860c82 | ||
|
|
50dd196d42 | ||
|
|
ce6ec20fef | ||
|
|
11e56f5c9c | ||
|
|
efd5b806be | ||
|
|
1b4c71c280 | ||
|
|
d83036ccdf | ||
|
|
d18426c69a | ||
|
|
351833a923 | ||
|
|
2979d93829 | ||
|
|
2fce2e4109 | ||
|
|
13d350be2e | ||
|
|
550493ba84 | ||
|
|
c45af23946 | ||
|
|
19ee56592e | ||
|
|
aec4af1b88 | ||
|
|
46869df631 | ||
|
|
c91a1b963b | ||
|
|
2fced0f634 | ||
|
|
60b0ffeb0e | ||
|
|
6623e120cd | ||
|
|
46ec934a9c | ||
|
|
5a9e9550ca | ||
|
|
8e0142338e | ||
|
|
61e368ce87 | ||
|
|
c93b0dd3b8 | ||
|
|
79e31a5761 | ||
|
|
fa3a9a9d61 | ||
|
|
febaa340e3 | ||
|
|
bcab55e3ef | ||
|
|
24465d2df4 | ||
|
|
8540ac71c8 | ||
|
|
9e47042122 | ||
|
|
e0109afc60 | ||
|
|
ff88f7175d | ||
|
|
c9a9b0ad2b | ||
|
|
db01ec801f | ||
|
|
495e528eec | ||
|
|
a7c91d610f | ||
|
|
d08acf7298 | ||
|
|
7be35bb02e | ||
|
|
b4d6fd3ba3 | ||
|
|
d5d1483656 | ||
|
|
02c41ac574 | ||
|
|
3a6f431f62 | ||
|
|
4fe979a8c0 | ||
|
|
3b6a3b4a38 | ||
|
|
da14c9e692 | ||
|
|
b8b003bc83 | ||
|
|
229ea93627 | ||
|
|
24296eacea | ||
|
|
6958db3d3d | ||
|
|
32b50e7c8e | ||
|
|
b803895750 | ||
|
|
d1153dfeb4 | ||
|
|
385fab225e | ||
|
|
89a5abb217 | ||
|
|
79a5614be9 | ||
|
|
a1b56c9b83 | ||
|
|
ecddfb7ccf | ||
|
|
bd5eb7ace3 | ||
|
|
8e15bd6a85 | ||
|
|
5ef50f9f4b | ||
|
|
a6331244e1 | ||
|
|
01d7776fc1 | ||
|
|
109b7eeaec | ||
|
|
5de99bafa7 | ||
|
|
a664abcf51 | ||
|
|
6f11092a57 | ||
|
|
e598384d97 | ||
|
|
53bddae904 | ||
|
|
1519912a1a | ||
|
|
b3a3bdd2e0 | ||
|
|
04be474f56 | ||
|
|
99e963709b | ||
|
|
b9ca19168a | ||
|
|
acf09da578 | ||
|
|
1d59937150 | ||
|
|
caa1b7f411 | ||
|
|
7a9a41fe01 | ||
|
|
acdc5328fe | ||
|
|
3252dd0d18 | ||
|
|
5c409884b9 | ||
|
|
f9f58596b8 | ||
|
|
bb11322919 | ||
|
|
4495774fd5 | ||
|
|
1aeb50feef | ||
|
|
b74050dd7b | ||
|
|
2ac7384abf | ||
|
|
eed45a41a3 | ||
|
|
69c2f6f945 | ||
|
|
5119299e8a | ||
|
|
719a0b732e | ||
|
|
8ed690cad0 | ||
|
|
f957471509 | ||
|
|
0b0325b8af | ||
|
|
d178d5e7d8 | ||
|
|
4ef34680cd | ||
|
|
6ab7be4058 | ||
|
|
df72188bc0 | ||
|
|
8d18aee2f2 | ||
|
|
449ba4f644 | ||
|
|
194c8ff71d | ||
|
|
62f4c252f2 | ||
|
|
5d19ef6146 | ||
|
|
a32335dfbc | ||
|
|
6b6480a026 | ||
|
|
a4df33d040 | ||
|
|
8b15416be5 | ||
|
|
bc92465bf7 | ||
|
|
a6bdc35d59 | ||
|
|
c50c8b724d | ||
|
|
0da3e58fff | ||
|
|
edcb71ad22 | ||
|
|
d6d707543d | ||
|
|
8858e7d7e3 | ||
|
|
64b46c2e15 | ||
|
|
82baa7ce4b | ||
|
|
d7315b56dc | ||
|
|
10e07eaf74 | ||
|
|
e7d4a438dd | ||
|
|
9e8631b75f | ||
|
|
e39ec927a2 | ||
|
|
6ad3a717fe | ||
|
|
f66b5cf65b | ||
|
|
d8c337185f | ||
|
|
5ade64b3e1 | ||
|
|
e65a079f0e | ||
|
|
378ffffdc7 | ||
|
|
dd356b54c0 | ||
|
|
f56388845c | ||
|
|
436db1f8e7 | ||
|
|
ba4b88ef86 | ||
|
|
b39d44db03 | ||
|
|
9c4e5ed596 | ||
|
|
ce40da0f71 | ||
|
|
7f4586a47f | ||
|
|
24a2de7389 | ||
|
|
5f1df9e093 | ||
|
|
5435777c65 | ||
|
|
7c355030f4 | ||
|
|
7b5b874fdc | ||
|
|
f87bb12ebb | ||
|
|
d2d5cf0d57 | ||
|
|
6348f67b18 | ||
|
|
eaf5a371ff | ||
|
|
dee0948e3e | ||
|
|
a59d4ba346 | ||
|
|
ec8e5179cb | ||
|
|
9d5928551b | ||
|
|
456e17430b | ||
|
|
839f0971f0 | ||
|
|
e9c1dd7842 | ||
|
|
24b110be9d | ||
|
|
7a560865a0 | ||
|
|
718a9a79ed | ||
|
|
ff9623fb5c | ||
|
|
80616b4c2b | ||
|
|
36f0ed6d0c | ||
|
|
4c8c6c3880 | ||
|
|
e38fc2c3da | ||
|
|
2fdae91cbc | ||
|
|
7aab1eaffb | ||
|
|
a0c55693dc | ||
|
|
9aca2868b9 | ||
|
|
4982784d7c | ||
|
|
e2d441e862 | ||
|
|
303dbe7730 | ||
|
|
d7b10a17c1 | ||
|
|
3f194d3288 | ||
|
|
672fcd5a14 | ||
|
|
3768932ba2 | ||
|
|
eafcc43295 | ||
|
|
1315e2d72c | ||
|
|
44780e6e1b | ||
|
|
570383d5d5 | ||
|
|
3d2f09a693 | ||
|
|
33c2b1b623 | ||
|
|
207776cec6 | ||
|
|
3b3738e587 | ||
|
|
680078dc58 | ||
|
|
a593271de1 | ||
|
|
7fd996bc86 | ||
|
|
d155ddd026 | ||
|
|
fc38b9bb79 | ||
|
|
29c41adddf | ||
|
|
180d48e89d | ||
|
|
900f39686d | ||
|
|
46c5b776ed | ||
|
|
7b6480f7f8 | ||
|
|
f610958209 | ||
|
|
ab9daaacd6 | ||
|
|
a8f6044c9b | ||
|
|
6efef51036 | ||
|
|
6617af5209 | ||
|
|
410144ea1c | ||
|
|
d8060f47a8 | ||
|
|
f2ee63da3b | ||
|
|
b636d2a2c9 | ||
|
|
7d6fdf96c0 | ||
|
|
b1f5c0314e | ||
|
|
eede02a6ab | ||
|
|
eee8685847 | ||
|
|
6253bbff3d | ||
|
|
263b4080ee | ||
|
|
50ae9659ad | ||
|
|
2e12ac5957 | ||
|
|
5f6622c70d | ||
|
|
d5cbbae182 | ||
|
|
0dd8670724 | ||
|
|
d2a82d56aa | ||
|
|
915ad77d03 | ||
|
|
f025dda4e2 | ||
|
|
1644956a9c | ||
|
|
b1cea25237 | ||
|
|
c1ddb84839 | ||
|
|
445d0f7928 | ||
|
|
637ee77d66 | ||
|
|
fb989fcd0e | ||
|
|
64ea3f8177 | ||
|
|
aaa0603e29 | ||
|
|
450edae160 | ||
|
|
4f0198dd13 | ||
|
|
56714e6c07 | ||
|
|
aa0586c666 | ||
|
|
8ee8eddcff | ||
|
|
1c2d0656b0 | ||
|
|
22d7db2cb4 | ||
|
|
96107193e9 | ||
|
|
1a39678206 | ||
|
|
6c57810128 | ||
|
|
8c340d52a4 | ||
|
|
1df3ed4487 | ||
|
|
0c1657d744 | ||
|
|
44af46c9b3 | ||
|
|
18eb3cde97 | ||
|
|
776508759d | ||
|
|
6a7fa67581 | ||
|
|
3f97d63886 | ||
|
|
c3d2a581c9 | ||
|
|
d345283ab5 | ||
|
|
ddbef8b25d | ||
|
|
d2cb05f14f | ||
|
|
3fe2169ffa | ||
|
|
ab5b2da21a | ||
|
|
b4f153c202 | ||
|
|
0d09d43257 | ||
|
|
98c303042e | ||
|
|
d0f9345c5a | ||
|
|
fffc5d7c35 | ||
|
|
e737964f66 | ||
|
|
8f2e84d263 | ||
|
|
947935f3d9 | ||
|
|
277287a341 | ||
|
|
5a75eba42b | ||
|
|
31c6a0a9da | ||
|
|
a1f156ca19 | ||
|
|
eb90b907e7 | ||
|
|
61a7d848f7 | ||
|
|
d70742119b | ||
|
|
622b5c179a | ||
|
|
ddc5293e6a | ||
|
|
a30f537f5f | ||
|
|
813c0119aa | ||
|
|
8ef4c4401e | ||
|
|
5fbda0e206 | ||
|
|
fbe327ac2f | ||
|
|
ab6f327f35 | ||
|
|
51887c64b5 | ||
|
|
654a73c5a8 | ||
|
|
eac884d85b | ||
|
|
d7aaaea0df | ||
|
|
b09250ed33 | ||
|
|
0ca97e4b68 | ||
|
|
59ca8bd986 | ||
|
|
e1393d1912 | ||
|
|
ddb3bd5477 | ||
|
|
2ec18a1397 | ||
|
|
34072faccd | ||
|
|
26d9215e43 | ||
|
|
496e06a373 | ||
|
|
513bd17610 | ||
|
|
d9fcb777c1 | ||
|
|
05700a6799 | ||
|
|
29bd743391 | ||
|
|
13e14652e3 | ||
|
|
b41e88e83a | ||
|
|
cbc4da58ab | ||
|
|
aecb4adf4a | ||
|
|
ba227b7e72 | ||
|
|
0423e0a2df | ||
|
|
afe816efb6 | ||
|
|
58feda7c8e | ||
|
|
217765998d | ||
|
|
0ffe53933d | ||
|
|
cf4b4de970 | ||
|
|
2e285ed562 | ||
|
|
9b919c54dd | ||
|
|
9618960558 | ||
|
|
fceaed34e4 | ||
|
|
eb4973237b | ||
|
|
9c747e3e37 | ||
|
|
3d16d8b2b6 | ||
|
|
1a75489b42 | ||
|
|
24c29acc09 | ||
|
|
2662167372 | ||
|
|
e98320862c | ||
|
|
2d6a7092e3 | ||
|
|
7080983521 | ||
|
|
19540ed7f0 | ||
|
|
699df0029b | ||
|
|
86971ee752 | ||
|
|
d258a6c1c2 | ||
|
|
3e0913a813 | ||
|
|
762a3279ea | ||
|
|
f357f4c9d7 | ||
|
|
8d708c2442 | ||
|
|
83d069d053 | ||
|
|
b5429d9e8e | ||
|
|
0996901e72 | ||
|
|
ec08d31031 | ||
|
|
ca46405850 | ||
|
|
7d7ed15fdc | ||
|
|
34315f7338 | ||
|
|
26a22a30a1 | ||
|
|
41e4fc79ae | ||
|
|
049299f07f | ||
|
|
5f36ad3b75 | ||
|
|
18cf6bcfa6 | ||
|
|
a8c526efd5 | ||
|
|
62c8f9e1e2 | ||
|
|
ac134c0afa | ||
|
|
a29c3abeb8 | ||
|
|
623a1278cf | ||
|
|
e52694cde0 | ||
|
|
95813714a5 | ||
|
|
6a6473ede3 | ||
|
|
e10e1f5249 | ||
|
|
6eb1a89205 | ||
|
|
4d25d264c4 | ||
|
|
ba7025d54b | ||
|
|
1f360961e0 | ||
|
|
08647b337f | ||
|
|
c5a7800ec6 | ||
|
|
26a2290078 | ||
|
|
2edcd82094 | ||
|
|
165efdbdbb | ||
|
|
412fcf11f9 | ||
|
|
e993d08563 | ||
|
|
61bc652229 | ||
|
|
699f6fff44 | ||
|
|
1a868abdfa | ||
|
|
c9c58cbe4c | ||
|
|
c3055c7cc4 | ||
|
|
2cca1a8c2c | ||
|
|
a9e767cbd8 | ||
|
|
1657f2e5f7 | ||
|
|
e93a377982 | ||
|
|
2c12312b97 | ||
|
|
866b546cfd | ||
|
|
74f5c769f9 | ||
|
|
1e09f5149e | ||
|
|
e08a5a9d83 | ||
|
|
d7dec5a43d | ||
|
|
33436d62c3 | ||
|
|
9f1504062a | ||
|
|
f8cafaaee7 | ||
|
|
4d1d163a73 | ||
|
|
171bf969c7 | ||
|
|
ca145297e9 | ||
|
|
c2c43bba37 | ||
|
|
951b7a9075 | ||
|
|
f807e34b2b | ||
|
|
aa03be7f76 | ||
|
|
ed14c515bf | ||
|
|
2d545c7f0b | ||
|
|
3beeb6125e | ||
|
|
19a8ac4841 | ||
|
|
85d0e08a80 | ||
|
|
fff8972a77 | ||
|
|
92dd5cab93 | ||
|
|
141b580c8c | ||
|
|
095771d345 | ||
|
|
5d581c3b03 | ||
|
|
087c28dae4 | ||
|
|
85c37fbe27 | ||
|
|
ad9b790712 | ||
|
|
82436c5b44 | ||
|
|
156afa7795 | ||
|
|
74dc05bbf5 | ||
|
|
b6d206aff7 | ||
|
|
e3c116312b | ||
|
|
5527932a8e | ||
|
|
3cb9d094d3 | ||
|
|
d83a275b6e | ||
|
|
98d5dd727b | ||
|
|
565f054b79 | ||
|
|
f4aee62fb4 | ||
|
|
864f0f5a3a | ||
|
|
d447c423b5 | ||
|
|
f9ed8a9a08 | ||
|
|
3638d79291 | ||
|
|
2514f3aa08 | ||
|
|
3d3cbe115e | ||
|
|
691838c47d | ||
|
|
612abf134b | ||
|
|
87a730b5a2 | ||
|
|
8d0efd812c | ||
|
|
245ce642ce | ||
|
|
df4b952312 | ||
|
|
43cfc7d401 | ||
|
|
16ba2a54ea | ||
|
|
bc9abceef3 | ||
|
|
8a311d693b | ||
|
|
52807c0724 | ||
|
|
fa15f58506 | ||
|
|
f616605e7e | ||
|
|
3d4b5a10c9 | ||
|
|
2b7bbd9513 | ||
|
|
89e3bcc4bb | ||
|
|
a590239df9 | ||
|
|
0c3f7a54cd | ||
|
|
99a11636da | ||
|
|
3a2f258517 | ||
|
|
3629a190ae | ||
|
|
715a9b8678 | ||
|
|
4187be2dc3 | ||
|
|
dd70a13c02 | ||
|
|
c8a56add5d | ||
|
|
01ebdb6122 | ||
|
|
e66f9d7fce | ||
|
|
35f63b3f6a | ||
|
|
9bf9b3edb7 | ||
|
|
92b1a13438 | ||
|
|
515f5440a1 | ||
|
|
632480787d | ||
|
|
e4faa82cfa | ||
|
|
779915a51f | ||
|
|
c509bbcb99 | ||
|
|
8231e7e36a | ||
|
|
ee145aebe7 | ||
|
|
11dd7784f8 | ||
|
|
6fe6a6daa7 | ||
|
|
e921b7cbdc | ||
|
|
fd928a3d16 | ||
|
|
5a4d3317c2 | ||
|
|
ab23cccab4 | ||
|
|
7d4cc82077 | ||
|
|
e58f8db9aa | ||
|
|
b059910a01 | ||
|
|
19de558f4a | ||
|
|
2d9772e7a9 | ||
|
|
0c1bdc0fd6 | ||
|
|
e592d1b46b | ||
|
|
8dbb1aa8e9 | ||
|
|
ef5cb5021b | ||
|
|
ff81789b37 | ||
|
|
e6efcdb6af | ||
|
|
9cf4c66331 | ||
|
|
956a3c024c | ||
|
|
efb40e149f | ||
|
|
a6876b8028 | ||
|
|
713e7a6584 | ||
|
|
778ce0b9f6 | ||
|
|
05268c2742 | ||
|
|
17d8d14cc8 | ||
|
|
4f310cd7b1 | ||
|
|
9ff0d90853 | ||
|
|
6e13403a37 | ||
|
|
8bf84aabe5 | ||
|
|
50a767ef03 | ||
|
|
4702285184 | ||
|
|
dde73d592d | ||
|
|
9a1dedbe76 | ||
|
|
20439e646f | ||
|
|
06c7a6a109 | ||
|
|
278a653154 | ||
|
|
3a8b149f09 | ||
|
|
deca6a0329 | ||
|
|
7205407818 | ||
|
|
2f6b975669 | ||
|
|
16a4b60526 | ||
|
|
9cf1835230 | ||
|
|
3623a0dd56 | ||
|
|
e0c0d2a72a | ||
|
|
dbfc46658f | ||
|
|
bb3ec04ed1 | ||
|
|
be7fccce68 | ||
|
|
f21d8503d5 | ||
|
|
063e6d062d | ||
|
|
0b7d758077 | ||
|
|
5dfa753f5c | ||
|
|
23d714f2f1 | ||
|
|
f627c81399 | ||
|
|
0fb1918196 | ||
|
|
312f1c6f25 | ||
|
|
792059f195 | ||
|
|
70c74d282f | ||
|
|
ab4975b7f1 | ||
|
|
6eaaa5cc69 | ||
|
|
f766614b4d | ||
|
|
fcf1327c1f | ||
|
|
b140f1f152 | ||
|
|
87904e8b69 | ||
|
|
194e9e6f05 | ||
|
|
8dd7d3aacd | ||
|
|
104bcc1f89 | ||
|
|
a55c03013d | ||
|
|
b783363c56 | ||
|
|
f0e4ea1780 | ||
|
|
6a336f2e1e | ||
|
|
312637c94b | ||
|
|
e717f74a0a | ||
|
|
3dde19bb59 | ||
|
|
a0abea4b72 | ||
|
|
5744bd0138 | ||
|
|
db9ca1a485 | ||
|
|
af260cba41 | ||
|
|
a77ae51318 | ||
|
|
5aad44e628 | ||
|
|
41e178e268 | ||
|
|
e068ad4494 | ||
|
|
7fc2f74851 | ||
|
|
abbea5ec4c | ||
|
|
72a4d2df2f | ||
|
|
05ac516ffa | ||
|
|
01423d4a6b | ||
|
|
3de9b4bfc8 | ||
|
|
92a2011207 | ||
|
|
8710fbfde7 | ||
|
|
0c94b89e42 | ||
|
|
9e382ecf9a | ||
|
|
0e0e265a2a | ||
|
|
d6ac7c5ecf | ||
|
|
8501ffe240 | ||
|
|
919bab0765 | ||
|
|
3e719d087f | ||
|
|
472e2afd8e | ||
|
|
68b0259c47 | ||
|
|
9809ce1d18 | ||
|
|
7a5db5e665 | ||
|
|
6ec7cf5a9d | ||
|
|
f4cbd88e2c | ||
|
|
9904c0e09f | ||
|
|
e4f5243e54 | ||
|
|
33138c139f | ||
|
|
a2d2deeb0c | ||
|
|
b4674d6fc5 | ||
|
|
1f6a19b684 | ||
|
|
c06cb38d64 | ||
|
|
3bc319d534 | ||
|
|
30496ffdc3 | ||
|
|
3544136ab1 | ||
|
|
6826a1d7df | ||
|
|
d798b943f5 | ||
|
|
4466b6e15e | ||
|
|
0248d6fd9f | ||
|
|
bc66894553 | ||
|
|
c12673a407 | ||
|
|
86e48ceef8 | ||
|
|
adcd0f4bb8 | ||
|
|
75b39e812e | ||
|
|
622d883344 | ||
|
|
8519480f2c | ||
|
|
f9db729e75 | ||
|
|
0b2eced6a3 | ||
|
|
dae01b5043 | ||
|
|
1912973d36 | ||
|
|
037a00720f | ||
|
|
c2ee64e669 | ||
|
|
e703fc7982 | ||
|
|
5a1fa6ee65 | ||
|
|
d6016757cb | ||
|
|
08184aab1d | ||
|
|
e33fbc67ad | ||
|
|
f80238ae2d | ||
|
|
75ff9089af | ||
|
|
2f5f2b367b | ||
|
|
66dea18b61 | ||
|
|
bae40ded74 | ||
|
|
fc43828c20 | ||
|
|
063a1ffd36 | ||
|
|
1d4735f76d | ||
|
|
c03250132d | ||
|
|
48844442fc | ||
|
|
f69fb40c71 | ||
|
|
0a34793f5a | ||
|
|
07cd23edac | ||
|
|
a7ef1262e5 | ||
|
|
c5fcf3ba2c | ||
|
|
d206035e0f | ||
|
|
2eeb96116d | ||
|
|
2edfb96c36 | ||
|
|
c7e22b7a3b | ||
|
|
20ced771ba | ||
|
|
01b7385a5e | ||
|
|
070a6203e0 | ||
|
|
902c56f09b | ||
|
|
129086eea7 | ||
|
|
157da246c0 | ||
|
|
321dfb7311 | ||
|
|
65097a4908 | ||
|
|
df2cbfd0e9 | ||
|
|
df95114a93 | ||
|
|
f7d30c847f | ||
|
|
b94eb443ea | ||
|
|
b70f5bc98b | ||
|
|
9876e792f1 | ||
|
|
e3f09ae4cc | ||
|
|
cd2e030dc1 | ||
|
|
6be2c06ed3 | ||
|
|
2e85871a4b | ||
|
|
47a8ef3031 | ||
|
|
93e4ef0eec | ||
|
|
303378c5eb | ||
|
|
5082f69631 | ||
|
|
abe072c83d | ||
|
|
5fbd0afdc5 | ||
|
|
4725dfb121 | ||
|
|
14c2d14fc2 | ||
|
|
119a981701 | ||
|
|
fb3088b765 | ||
|
|
e7b170bf3c | ||
|
|
96d837274e | ||
|
|
8818c209df | ||
|
|
5c057e1306 | ||
|
|
6c23a21312 | ||
|
|
2f8e0bb09c | ||
|
|
b6495a9fc2 | ||
|
|
8952759eda | ||
|
|
c96f5f6fa8 | ||
|
|
b0d2d1116b | ||
|
|
4a55223a8f | ||
|
|
3aa9982b23 | ||
|
|
7d706f6a00 | ||
|
|
161aeb393b | ||
|
|
f9195a8a0e | ||
|
|
9a36174685 | ||
|
|
4f5f6a9e8f | ||
|
|
78072f753c | ||
|
|
d5a3cc7300 | ||
|
|
fc0be6d503 | ||
|
|
699973dcfe | ||
|
|
465266e219 | ||
|
|
5c935a4c29 | ||
|
|
95ff0b9313 | ||
|
|
eed04560c0 | ||
|
|
2c0e8f6079 | ||
|
|
152eabbd6a | ||
|
|
60ab624b23 | ||
|
|
4dd793c0ac | ||
|
|
7f4916f333 | ||
|
|
bf4d0a5466 | ||
|
|
d053d464dd | ||
|
|
5465708a42 | ||
|
|
3622cfd169 | ||
|
|
ae389a8993 | ||
|
|
1d175c1c7d | ||
|
|
7e37f3294a | ||
|
|
1e273640b4 | ||
|
|
cbbe29cf70 | ||
|
|
c87579e1f7 | ||
|
|
c30ed059fe | ||
|
|
676c4d0835 | ||
|
|
4c717829b3 | ||
|
|
8512259d02 | ||
|
|
e45b04ef32 | ||
|
|
de21088619 | ||
|
|
61bf7f49cc | ||
|
|
a819e4d523 | ||
|
|
57ca71fcc9 | ||
|
|
a03574e119 | ||
|
|
19d7dad33c | ||
|
|
2cd8ba9875 | ||
|
|
dc11c94514 | ||
|
|
037fe442dc | ||
|
|
0525d66b86 | ||
|
|
a168c4bf06 | ||
|
|
a465edd890 | ||
|
|
164a01ed12 | ||
|
|
39602c4b2b | ||
|
|
33dfcd247d | ||
|
|
1617b76e27 | ||
|
|
0a9df88e53 | ||
|
|
989641892e | ||
|
|
21fcbc7acb | ||
|
|
dfa17d2291 | ||
|
|
f4a2eff4b7 | ||
|
|
f9fd511eb0 | ||
|
|
ff71a2cc60 | ||
|
|
41371bd901 | ||
|
|
7db7b146be | ||
|
|
de25d63838 | ||
|
|
42829ffb13 | ||
|
|
444666a365 | ||
|
|
41db8798af | ||
|
|
33bd614a42 | ||
|
|
10ad0b48dc | ||
|
|
4a0314849e | ||
|
|
10a9d298d7 | ||
|
|
13d513f02b | ||
|
|
7f84deaf30 | ||
|
|
765a5c6aa1 | ||
|
|
f7c195a7ac | ||
|
|
252cb18aeb | ||
|
|
54a5ecb101 | ||
|
|
63ca000482 | ||
|
|
00aa844964 | ||
|
|
e6bf58a707 | ||
|
|
ccc0653923 | ||
|
|
70c14092f9 | ||
|
|
a1e62ea4b1 | ||
|
|
22f72e2b23 | ||
|
|
a0756bf6f2 | ||
|
|
78e1fb231e | ||
|
|
5cbe5d60aa | ||
|
|
e9c5c1434b | ||
|
|
817a74d4df | ||
|
|
02fa04aec8 | ||
|
|
7cd8d0a1ac | ||
|
|
7dcdaca288 | ||
|
|
3259a1d814 | ||
|
|
806c26d54f | ||
|
|
f2ecc271b5 | ||
|
|
a05251da51 | ||
|
|
555ef7677d | ||
|
|
eb2ec92b66 | ||
|
|
e1a3540caf | ||
|
|
c1d51266b3 | ||
|
|
9de22c8146 | ||
|
|
eb0fccd1d2 | ||
|
|
cb2f5d3e25 | ||
|
|
73665a2b67 | ||
|
|
24d5dc093f | ||
|
|
18476114b9 | ||
|
|
bd07425b25 | ||
|
|
49ad6f47a5 | ||
|
|
b85c8bbe7f | ||
|
|
e8ae9178af | ||
|
|
12d4e812a6 | ||
|
|
07030e1f42 | ||
|
|
c04f947a85 | ||
|
|
d55aaffc48 | ||
|
|
b9514a40de | ||
|
|
ed43a38db2 | ||
|
|
2967cc3801 | ||
|
|
9c5153e8c8 | ||
|
|
0a4fc6a40f | ||
|
|
a717aba826 | ||
|
|
5c335beb60 | ||
|
|
8d6d1cb329 | ||
|
|
6b2035e353 | ||
|
|
3811a5a209 | ||
|
|
c1046cc87b | ||
|
|
2bb42a1147 | ||
|
|
1b4367ffba | ||
|
|
b4df8477d8 | ||
|
|
27c7e69fba | ||
|
|
5a5bb6edbf | ||
|
|
448462552f | ||
|
|
14cbc2d90d | ||
|
|
dfa2c22e0c | ||
|
|
a57588caa1 | ||
|
|
fad7246e05 | ||
|
|
a0c9296ee8 | ||
|
|
0c2e464c71 | ||
|
|
15236ef376 | ||
|
|
950bfff1c1 | ||
|
|
bba91c7e92 | ||
|
|
33c87e8e72 | ||
|
|
ba2ccf788c | ||
|
|
e114875f02 | ||
|
|
09346c761b | ||
|
|
f0e41bf43e | ||
|
|
9c75304832 | ||
|
|
02fd96a24a | ||
|
|
568ca26747 | ||
|
|
1e82fc5d24 | ||
|
|
d9f8fcb7a4 | ||
|
|
17ca7c4648 | ||
|
|
acf2c8cc9d | ||
|
|
43c88f51c6 | ||
|
|
60e5899dc3 | ||
|
|
f75312105d | ||
|
|
610143f4ad | ||
|
|
2cc9b10a1e | ||
|
|
f3ab28b92d | ||
|
|
660d336646 | ||
|
|
15c25c8277 | ||
|
|
b4d4fa1a43 | ||
|
|
d4ac668cd4 | ||
|
|
38e34e0dd6 | ||
|
|
9159892965 | ||
|
|
eda1a44fa3 | ||
|
|
65b6d210bc | ||
|
|
6c4765fd00 | ||
|
|
ef3811390f | ||
|
|
2ce55115a6 | ||
|
|
0811e0bce3 | ||
|
|
40d512fe43 | ||
|
|
e73957e790 | ||
|
|
b773d40034 | ||
|
|
b6be19b266 | ||
|
|
1c0cb7f884 | ||
|
|
bc24e5e290 | ||
|
|
80259fbcc4 | ||
|
|
64292cdc9b | ||
|
|
df771b5a4d | ||
|
|
8b8e8d70f9 | ||
|
|
27dfa12335 | ||
|
|
13ee40a4b8 | ||
|
|
df9efe5734 | ||
|
|
f142474a54 | ||
|
|
084d448fd4 | ||
|
|
1385a157e9 | ||
|
|
fe3c3cc8bc | ||
|
|
97e44679d3 | ||
|
|
d5ad4c4ae7 | ||
|
|
6ac497d774 | ||
|
|
cd2c8f6527 | ||
|
|
d4b9a41786 | ||
|
|
93fef67c7e | ||
|
|
f72e5907bb | ||
|
|
01c956caba | ||
|
|
5f07fb0b03 | ||
|
|
f17968d5b3 | ||
|
|
055c4397e9 | ||
|
|
62a99115fc | ||
|
|
7483a06226 | ||
|
|
f265ce361a | ||
|
|
744952aee4 | ||
|
|
66591f567c | ||
|
|
03c48af9e6 | ||
|
|
3096c6c3ce | ||
|
|
cb2f1e1bb1 | ||
|
|
59140bd3f3 | ||
|
|
ce700b9421 | ||
|
|
761ab22f08 | ||
|
|
0ee39c67fe | ||
|
|
148b2daaa3 | ||
|
|
a927d679f0 | ||
|
|
a4ce6d7074 | ||
|
|
3739d2876e | ||
|
|
0c50d9807e | ||
|
|
5e83b6602e | ||
|
|
5ab425e82d | ||
|
|
b5be12a25b | ||
|
|
367f81d52d | ||
|
|
b10445f3f6 | ||
|
|
1e7862a466 | ||
|
|
943efce971 | ||
|
|
e7675e48ed | ||
|
|
63efc4f442 | ||
|
|
a5c92be360 | ||
|
|
8de8f48679 | ||
|
|
63fae85ff4 | ||
|
|
8f6afda99a | ||
|
|
510254e5a3 | ||
|
|
9981daad61 | ||
|
|
c1824b5387 | ||
|
|
517c0a4f52 | ||
|
|
cab50ccb59 | ||
|
|
e51f548807 | ||
|
|
8a214838e5 | ||
|
|
37118cab47 | ||
|
|
e6d7517e63 | ||
|
|
90db8e2147 | ||
|
|
65883a5d85 | ||
|
|
7383520639 | ||
|
|
49e9c74324 | ||
|
|
492ab20c00 | ||
|
|
92621f2f2d | ||
|
|
f2ce5ef273 | ||
|
|
836f7ecb95 | ||
|
|
0dcd307333 | ||
|
|
c2b3e68f8c | ||
|
|
11c8e2268a | ||
|
|
a12cc1c544 | ||
|
|
27e1b1c4b2 | ||
|
|
a62cd193ad | ||
|
|
0686a91690 | ||
|
|
4f6d5f6265 | ||
|
|
99271e77ab | ||
|
|
c9a2a14da5 | ||
|
|
236a1147b7 | ||
|
|
7eba8670e3 | ||
|
|
bdd1d1621f | ||
|
|
98c8f867e5 | ||
|
|
bfb35aa3ee | ||
|
|
6ab51bcb4e | ||
|
|
1c547e9598 | ||
|
|
19c05eefab | ||
|
|
3d12c8847f | ||
|
|
5d6d563a8e | ||
|
|
442be8624c | ||
|
|
287bb7d936 | ||
|
|
ddb1d6e0d3 | ||
|
|
8b98a92805 | ||
|
|
8b4a077f8a | ||
|
|
3d53cfc298 | ||
|
|
fb2ab79455 | ||
|
|
731bfc1fc6 | ||
|
|
ae52a62c09 | ||
|
|
62d4516fe7 | ||
|
|
9ba1398831 | ||
|
|
a4690d76db | ||
|
|
fe11b064af | ||
|
|
a2dc767559 | ||
|
|
93e19e48db | ||
|
|
fbe069cf5c | ||
|
|
20add5b58e | ||
|
|
b7c2c3448e | ||
|
|
f577345b14 | ||
|
|
bf46da7c14 | ||
|
|
d2f5b9ea65 | ||
|
|
e8052f0505 | ||
|
|
be373f88d4 | ||
|
|
ceffa10ab7 | ||
|
|
b36f3c98ca | ||
|
|
f459982560 | ||
|
|
56104566fc | ||
|
|
85463f049c | ||
|
|
30acfc1869 | ||
|
|
2ce0049ce4 | ||
|
|
e82ecf695d | ||
|
|
dc9a00809c | ||
|
|
31418b3936 | ||
|
|
db14a3fd05 | ||
|
|
de0e108d27 | ||
|
|
b8cd52aa07 | ||
|
|
16403950d5 | ||
|
|
8ba444141e | ||
|
|
fb3e44ecc4 | ||
|
|
8107162540 | ||
|
|
ee096569c4 | ||
|
|
81e1fd53e2 | ||
|
|
07237f8eb9 | ||
|
|
9442e23fd9 | ||
|
|
970facaa8a | ||
|
|
fe92889b10 | ||
|
|
fe82d7dc05 | ||
|
|
915fcf9b92 | ||
|
|
31e8d58b1d | ||
|
|
87b85e5b93 | ||
|
|
823ac04abb | ||
|
|
0cf1c3c74a | ||
|
|
fd602af180 | ||
|
|
048bea6249 | ||
|
|
601a519cb6 | ||
|
|
f1f9805a01 | ||
|
|
62d28ebca5 | ||
|
|
c46f3f9ee4 | ||
|
|
f008b75e99 | ||
|
|
38204b2237 | ||
|
|
d71785470b | ||
|
|
b5a4d5be04 | ||
|
|
f085860eb1 | ||
|
|
8323fdf8e8 | ||
|
|
0c3f06604d | ||
|
|
e782ea2c05 | ||
|
|
9062016bf0 | ||
|
|
2301e604b3 | ||
|
|
34eab98ce4 | ||
|
|
00c1018d79 | ||
|
|
c36e5a96fe | ||
|
|
c024a4c099 | ||
|
|
92e5574ec1 | ||
|
|
cdf8648d3b | ||
|
|
de56f76284 | ||
|
|
ae1d43dc84 | ||
|
|
531e2d7032 | ||
|
|
32fe6b0333 | ||
|
|
75714ac518 | ||
|
|
8262d30202 | ||
|
|
d332cdf200 | ||
|
|
f6c18cd50f | ||
|
|
ab8d62214a | ||
|
|
a149bb9120 | ||
|
|
02283fae46 | ||
|
|
c82b31aa61 | ||
|
|
37303745df | ||
|
|
e5357df67a | ||
|
|
c109c11bea | ||
|
|
3a8c798596 | ||
|
|
9311bdf972 | ||
|
|
925caa223a | ||
|
|
95e7265bd7 | ||
|
|
93afc3bd95 | ||
|
|
cbdb31048e | ||
|
|
6b1f176a66 | ||
|
|
f2ee9b39e9 | ||
|
|
b6e5c55817 | ||
|
|
963d92e23f | ||
|
|
081757c592 | ||
|
|
ac78c15fbf | ||
|
|
dd78de1ed8 | ||
|
|
64fbcb6045 | ||
|
|
86c6892eb6 | ||
|
|
9cfbd8bde0 | ||
|
|
1e1d193556 | ||
|
|
f8a5e900f8 | ||
|
|
d0dcb2fb43 | ||
|
|
bb45790375 | ||
|
|
369689d001 | ||
|
|
df39fe5d08 | ||
|
|
b73340ab83 | ||
|
|
a1d02785af | ||
|
|
4f32e9dbff | ||
|
|
b6ca69f57a | ||
|
|
62992c2de1 | ||
|
|
b2da6dc8a2 | ||
|
|
c96853d5aa | ||
|
|
c215d8ab91 | ||
|
|
46d1950fbd | ||
|
|
03b764d404 | ||
|
|
a8aebec9ba | ||
|
|
fd72ff56bf | ||
|
|
ebec85fd54 | ||
|
|
fd792ef180 | ||
|
|
486186e042 | ||
|
|
8111d4e909 | ||
|
|
fc9d632522 | ||
|
|
d580d294b6 | ||
|
|
e9227ad7e5 | ||
|
|
156ec2a2dd | ||
|
|
186310b553 | ||
|
|
bcdee4e038 | ||
|
|
6bc8de1230 | ||
|
|
b8166f283a | ||
|
|
ad7a5967ff | ||
|
|
a0dc2097eb | ||
|
|
24842d4a29 | ||
|
|
0854ca5ce5 | ||
|
|
6ca34e362d | ||
|
|
470ba201d8 | ||
|
|
fc52ab972b | ||
|
|
7aca1cfb3f | ||
|
|
d9b247f302 | ||
|
|
c1e45a5931 | ||
|
|
4748af4d59 | ||
|
|
575967b5de | ||
|
|
6c57d6a76e | ||
|
|
56ff34dc47 | ||
|
|
5b72653d7f | ||
|
|
0a949e26f0 | ||
|
|
5347915c12 | ||
|
|
d0edb836ac | ||
|
|
c75cd55e2c | ||
|
|
911be4360a | ||
|
|
939b4c713d | ||
|
|
e6abc2a881 | ||
|
|
b2977cd29b | ||
|
|
da6f0eec84 | ||
|
|
7555dda2bf | ||
|
|
941f6e7757 | ||
|
|
1887170dad | ||
|
|
b2cfb77222 | ||
|
|
5d77321dca | ||
|
|
f20522a586 | ||
|
|
17435212ed | ||
|
|
6207c2b5e9 | ||
|
|
b6f7f85baa | ||
|
|
9c77742046 | ||
|
|
e9d0619358 | ||
|
|
7c23eedf07 | ||
|
|
27c6af3491 | ||
|
|
dc5ee9dcf5 | ||
|
|
07ff6a2278 | ||
|
|
dce9a81536 | ||
|
|
156055fdd5 | ||
|
|
3a5c03c778 | ||
|
|
9ce4156e4c | ||
|
|
f82afe0026 | ||
|
|
c3bb458ed9 | ||
|
|
5c2c8e1d76 | ||
|
|
ced95d658f | ||
|
|
a724cd0780 | ||
|
|
6b823b88d9 | ||
|
|
8fb180133a | ||
|
|
e877abf153 | ||
|
|
dd0ccff58a | ||
|
|
a793d5c6cc | ||
|
|
d313d4da3f | ||
|
|
dfc8f7c60f | ||
|
|
c15ac0b6d4 | ||
|
|
f9a16d856c | ||
|
|
5713dce00a | ||
|
|
23e848b437 | ||
|
|
5b01e78a72 | ||
|
|
eb68d0bdbd | ||
|
|
05297e05a5 | ||
|
|
1a0d2d19f5 | ||
|
|
292fc99bd5 | ||
|
|
b339db65be | ||
|
|
e5c70d5961 | ||
|
|
69be95d586 | ||
|
|
c82dfa3a64 | ||
|
|
4fd4c17036 | ||
|
|
4bd227271a | ||
|
|
5c31d68fee | ||
|
|
bfc1ed3081 | ||
|
|
1c7c39c1ab | ||
|
|
4ce0a65ad5 | ||
|
|
784afee7b7 | ||
|
|
f89e04d210 | ||
|
|
12531943d0 | ||
|
|
3061cd8277 | ||
|
|
686f3656c5 | ||
|
|
9ae106affd | ||
|
|
2550539495 | ||
|
|
06164cdc51 | ||
|
|
583a932fba | ||
|
|
fdd485608f | ||
|
|
0307d3818a | ||
|
|
9a473ceae6 | ||
|
|
12365b9591 | ||
|
|
c832889db8 | ||
|
|
39487d9917 | ||
|
|
aa37542411 | ||
|
|
279f43d697 | ||
|
|
fee6de5974 | ||
|
|
5fa98b12b8 | ||
|
|
ff94196295 | ||
|
|
0195749f3b | ||
|
|
97fca910a1 | ||
|
|
577aad3364 | ||
|
|
05c6cc756c | ||
|
|
66c6662f42 | ||
|
|
6319167464 | ||
|
|
aea2909490 | ||
|
|
842421bb44 | ||
|
|
c6f10ef1ea | ||
|
|
3df04839a6 | ||
|
|
618b4698c2 | ||
|
|
72feda8346 | ||
|
|
2e88dea3ac | ||
|
|
678bbd6676 | ||
|
|
5853326f6a | ||
|
|
8befb95986 | ||
|
|
026c93a104 | ||
|
|
15fde46ca5 | ||
|
|
f3455397ec | ||
|
|
4f0823bffa | ||
|
|
31eb392d40 | ||
|
|
fde5014bf9 | ||
|
|
39b2bf4204 | ||
|
|
a1cf365288 | ||
|
|
166a18bfc8 | ||
|
|
a0ea195ffc | ||
|
|
0563be891c | ||
|
|
5790c7d289 | ||
|
|
c7c3c969db | ||
|
|
04074bd853 | ||
|
|
76a367072c | ||
|
|
e4cf9c5d55 | ||
|
|
a4bde0368e | ||
|
|
da8176e170 | ||
|
|
bd276f5680 | ||
|
|
f10da06188 | ||
|
|
13ef879703 | ||
|
|
8cbba12282 | ||
|
|
d98e894b41 | ||
|
|
73a6c0c42d | ||
|
|
7363365447 | ||
|
|
3b501f4134 | ||
|
|
ffe5353987 | ||
|
|
1556bf16a9 | ||
|
|
88351ed844 | ||
|
|
9707f0a1ab | ||
|
|
4daac48c6b | ||
|
|
e943f5c864 | ||
|
|
719820c089 | ||
|
|
fe06652931 | ||
|
|
098f7930eb | ||
|
|
f942e82691 | ||
|
|
db5259b913 | ||
|
|
dfc7750dda | ||
|
|
dd971f19e7 | ||
|
|
785cc4e29a | ||
|
|
0c3e82e375 | ||
|
|
a6744507ef | ||
|
|
9614dd8b95 | ||
|
|
5208b36939 | ||
|
|
779bdb23eb | ||
|
|
4bd1b99213 | ||
|
|
4841485456 | ||
|
|
d5ddf0c404 | ||
|
|
7d4cc6bdde | ||
|
|
a0d74531f7 | ||
|
|
feb6119572 | ||
|
|
dbc4ab51b1 | ||
|
|
8daebf78f4 | ||
|
|
391806570c | ||
|
|
ed1e082896 | ||
|
|
0640c63573 | ||
|
|
9985d9e2d9 | ||
|
|
cd3dfe164b | ||
|
|
85b396ce88 | ||
|
|
241c69fef7 | ||
|
|
20deb15c8c | ||
|
|
2bc5e71f91 | ||
|
|
dd9da67f51 | ||
|
|
10e9e8a51d | ||
|
|
c3978d2ea3 | ||
|
|
54db9f8f24 | ||
|
|
8785759fdf | ||
|
|
59b0a062a0 | ||
|
|
95155f07d8 | ||
|
|
14795df85d | ||
|
|
d821a897b3 | ||
|
|
fd560f4dc1 | ||
|
|
6ecc569abd | ||
|
|
ece072aee3 | ||
|
|
759c0aea80 | ||
|
|
8e327aa24b | ||
|
|
592d59ceb2 | ||
|
|
2386e394ae | ||
|
|
781c9f7d83 | ||
|
|
70803a1d09 | ||
|
|
ffe5fc7fd2 | ||
|
|
cbc9fdbe34 | ||
|
|
bd91922072 | ||
|
|
416c087be0 | ||
|
|
09bfecf76e | ||
|
|
8b4180ca4a | ||
|
|
73a702f91e | ||
|
|
f55d9eaa68 | ||
|
|
7315b0ce2c | ||
|
|
de4534475c | ||
|
|
0bf660ebe8 | ||
|
|
8b32db73c2 | ||
|
|
bffd43c8fc | ||
|
|
6f7a1bb7e3 | ||
|
|
eb1dce3d11 | ||
|
|
a841f94273 | ||
|
|
a7f12c04e6 | ||
|
|
422cd88b51 | ||
|
|
eb9e95952d | ||
|
|
1e717addf4 | ||
|
|
3885991439 | ||
|
|
3815dfa6a2 | ||
|
|
5f65c5aa49 | ||
|
|
e86837dd9a | ||
|
|
585311c06a | ||
|
|
69dceb7f69 | ||
|
|
f1ac82f8a0 | ||
|
|
2c55649797 | ||
|
|
5c519f6429 | ||
|
|
20e600c80e | ||
|
|
2ed8e10fe4 | ||
|
|
caaa753f58 | ||
|
|
f7c6810757 | ||
|
|
2f16ee3b29 | ||
|
|
d97c7c7668 | ||
|
|
11df3530f3 | ||
|
|
6bb2e4ccb4 | ||
|
|
450894c52e | ||
|
|
0f041dae90 | ||
|
|
6c97a9c6c7 | ||
|
|
257d67346c | ||
|
|
e955c9dcfd | ||
|
|
8414046fc5 | ||
|
|
fd270d7733 | ||
|
|
67a3fffad7 | ||
|
|
7d0e003bf2 | ||
|
|
bad6798433 | ||
|
|
949b321e13 | ||
|
|
c84fd54215 | ||
|
|
5acb01eb6b | ||
|
|
568504ffb4 | ||
|
|
eec525a40f | ||
|
|
f8624dbcaa | ||
|
|
5fdb609767 | ||
|
|
4c53d7b8c4 | ||
|
|
3b96894e75 | ||
|
|
63bb20238b | ||
|
|
55575541d8 | ||
|
|
33e6105822 | ||
|
|
87be442ad9 | ||
|
|
33834d6cce | ||
|
|
212b7cee72 | ||
|
|
d9ca26c40d | ||
|
|
65b3b594e3 | ||
|
|
94ceb504b8 | ||
|
|
fcb21da7f9 | ||
|
|
124e17fb8a | ||
|
|
f914f26f3b | ||
|
|
1bc5fcc29e | ||
|
|
4a6e719d6a | ||
|
|
35dc8d4e5d | ||
|
|
61ea9564f8 | ||
|
|
bfc14938d0 | ||
|
|
c98a78062f | ||
|
|
fd128cbab0 | ||
|
|
59568915de | ||
|
|
bff2515bf2 | ||
|
|
d196c6656e | ||
|
|
a2b01e9599 | ||
|
|
34a61e1256 | ||
|
|
ec995838fb | ||
|
|
b49572005b | ||
|
|
ea11b4fc35 | ||
|
|
556485538f | ||
|
|
53e8683a5d | ||
|
|
6491223ed9 | ||
|
|
29a7375082 | ||
|
|
8f9947a20a | ||
|
|
dcaf639bec | ||
|
|
2f6bf95fa2 | ||
|
|
154c28b062 | ||
|
|
8106de95dc | ||
|
|
7c342a060a | ||
|
|
a15eb6f905 | ||
|
|
4198779b5b | ||
|
|
711d2c8cf4 | ||
|
|
42ad403e5e | ||
|
|
527fca5a8b | ||
|
|
60bd56b91c | ||
|
|
89c776a3b9 | ||
|
|
6a5b4e2fb4 | ||
|
|
fd39402116 | ||
|
|
f6055dde30 | ||
|
|
3abc42eee9 | ||
|
|
2d81c71b52 | ||
|
|
52db5b0925 | ||
|
|
9aa9f4e842 | ||
|
|
21396d0797 | ||
|
|
93eca2a6b6 | ||
|
|
74b9257de4 | ||
|
|
a921278650 | ||
|
|
2d193a0e92 | ||
|
|
09e7bd9c43 | ||
|
|
0ece4a084f | ||
|
|
0821d1859b | ||
|
|
25aef5fd6e | ||
|
|
20c21cb2f7 | ||
|
|
3a77287f8b | ||
|
|
d2111a8e68 | ||
|
|
8fa4b196b4 | ||
|
|
3bf45de1f7 | ||
|
|
3c0d639d0e | ||
|
|
ed1d0948a3 | ||
|
|
83699e5324 | ||
|
|
1f30c65464 | ||
|
|
45d5e480c0 | ||
|
|
5ecada11ef | ||
|
|
4f6878a278 | ||
|
|
50e0445ab4 | ||
|
|
78b36e0ba9 | ||
|
|
7a5068d632 | ||
|
|
c010b4c9c6 | ||
|
|
cc9029236b | ||
|
|
3f0b71b3e0 | ||
|
|
0eb467e46e | ||
|
|
f2c64a0fbb | ||
|
|
f4424a5eae | ||
|
|
1b68671e98 | ||
|
|
f3ac9a579f | ||
|
|
6e858ee645 | ||
|
|
96ea15a4d0 | ||
|
|
586420b919 | ||
|
|
c05e07c8aa | ||
|
|
43a5ece5b3 | ||
|
|
9f6d883e68 | ||
|
|
23d2d09136 | ||
|
|
f35c748fb2 | ||
|
|
a24556f0be | ||
|
|
a1d604feb3 | ||
|
|
524497a606 | ||
|
|
665ba22c7a | ||
|
|
9085a0d148 | ||
|
|
74d4ff0fc9 | ||
|
|
29d956d424 | ||
|
|
06031a0a34 | ||
|
|
9ffece910d | ||
|
|
d12a565032 | ||
|
|
9d6e6b56c6 | ||
|
|
acc0bad668 | ||
|
|
697457415d | ||
|
|
bcfd2e8ab6 | ||
|
|
5adb82f6f6 | ||
|
|
4415cfe30d | ||
|
|
0614d1b221 | ||
|
|
fb3f331e3c | ||
|
|
4e9378965b | ||
|
|
d1fe146522 | ||
|
|
718e6ba7b4 | ||
|
|
b9758107c3 | ||
|
|
06332e5dce | ||
|
|
aa262f6021 | ||
|
|
436d2530e4 | ||
|
|
77053fa855 | ||
|
|
810c7f9ed2 | ||
|
|
59b477d2da | ||
|
|
4c674ca94b | ||
|
|
63c428d048 | ||
|
|
2454bfa225 | ||
|
|
d6bdd09273 | ||
|
|
73425fe582 | ||
|
|
bc974e6514 | ||
|
|
237f00e2e3 | ||
|
|
88692ec42d | ||
|
|
ee833da0ca | ||
|
|
36aad8bc0a | ||
|
|
a656ea301e | ||
|
|
e2ae99acac | ||
|
|
461cb51f6a | ||
|
|
681628dba2 | ||
|
|
7167bf28c7 | ||
|
|
5e4e838a48 | ||
|
|
f3dc69a7e7 | ||
|
|
86f9a0a58a | ||
|
|
df1a987e2d | ||
|
|
40b4d34870 | ||
|
|
c6e3608ffa | ||
|
|
0aa87cfbeb | ||
|
|
053419234a | ||
|
|
12eba440ae | ||
|
|
5d43282f51 | ||
|
|
2826b69487 | ||
|
|
63c6bc28c3 | ||
|
|
bf3eb94c51 | ||
|
|
350d736706 | ||
|
|
e0aed88e98 | ||
|
|
52a4370c35 | ||
|
|
5c0577aa8e | ||
|
|
1e1abde846 | ||
|
|
b2f34a152b | ||
|
|
4676c4cdf7 | ||
|
|
d5674c9a7b | ||
|
|
7c998a2d67 | ||
|
|
5a70550a37 | ||
|
|
4d214dbcef | ||
|
|
97623af8df | ||
|
|
b87bc2a908 | ||
|
|
c8dac4a3cf | ||
|
|
6f30a6d65a | ||
|
|
9d1f0bf568 | ||
|
|
643c211d72 | ||
|
|
fb84985e9b | ||
|
|
afb34b4f2f | ||
|
|
5024e0bbda | ||
|
|
e771ed3332 | ||
|
|
2e81b38838 | ||
|
|
67d28e8b3c | ||
|
|
b834ba436f | ||
|
|
6da7cbf095 | ||
|
|
d5d1eb2833 | ||
|
|
e66f3c48ac | ||
|
|
c10cf7bf7f | ||
|
|
178d7d19c4 | ||
|
|
3c2845aaa6 | ||
|
|
a215e93505 | ||
|
|
bc99361100 | ||
|
|
48f8e16fb0 | ||
|
|
ffda821f68 | ||
|
|
1bce51de7a | ||
|
|
1734ac2e18 | ||
|
|
ddb7aad530 | ||
|
|
31ca832bdf | ||
|
|
a80af33260 | ||
|
|
3971bbf334 | ||
|
|
8cf9cb95f5 | ||
|
|
2787fa82c6 | ||
|
|
05e1d02341 | ||
|
|
277f26a5bb | ||
|
|
c05a3c3a99 | ||
|
|
ca06241307 | ||
|
|
cb25eb6bc0 | ||
|
|
72bef1fb68 | ||
|
|
b7452fa8ee | ||
|
|
89a009c411 | ||
|
|
c75a951668 | ||
|
|
d714f097eb | ||
|
|
48f05b41e4 | ||
|
|
f04827c6d3 | ||
|
|
2729070d7f | ||
|
|
9e5576d3fe | ||
|
|
530ebe1f7d | ||
|
|
ba45641801 | ||
|
|
f2b03d2930 | ||
|
|
7006c2f6e9 | ||
|
|
108880cbe9 | ||
|
|
64aa948445 | ||
|
|
eb6c09bfce | ||
|
|
2dd73872a4 | ||
|
|
ba94dc3d68 | ||
|
|
5bc907f1d4 | ||
|
|
1406c36ced | ||
|
|
394a064cc3 | ||
|
|
db29ecc8d0 | ||
|
|
ec99bef893 | ||
|
|
64f7aece12 | ||
|
|
46f5fe0611 | ||
|
|
923ed596ac | ||
|
|
2fd29d74f2 | ||
|
|
033a9a4b97 | ||
|
|
8762f38470 | ||
|
|
e5392dc21a | ||
|
|
7630fd4f85 | ||
|
|
134c900aa1 | ||
|
|
a0876f24a3 | ||
|
|
504e1b28c5 | ||
|
|
885e463bcb | ||
|
|
b8f3201dba | ||
|
|
983edbd85b | ||
|
|
24268661af | ||
|
|
b90742e995 | ||
|
|
86d56b978a | ||
|
|
ed86bfb79b | ||
|
|
44a73c32fa | ||
|
|
39662e45b1 | ||
|
|
9ab12eeda3 | ||
|
|
2128741218 | ||
|
|
4442dcf203 | ||
|
|
fff1f30dba | ||
|
|
c123bb9130 | ||
|
|
5112b655bd | ||
|
|
d4122d197f | ||
|
|
998bf633d8 | ||
|
|
b927ffbd53 | ||
|
|
cab4ffa286 | ||
|
|
1ff47393ed | ||
|
|
a6ecc7a65b | ||
|
|
d5e62086c8 | ||
|
|
370c22cddb | ||
|
|
fbf8398324 | ||
|
|
79c456ecfc | ||
|
|
bc0cc567d9 | ||
|
|
ad3006d49c | ||
|
|
73ad502251 | ||
|
|
7901d8a7c6 | ||
|
|
6f63ba43ad | ||
|
|
812520e29f | ||
|
|
d1daf3a0e6 | ||
|
|
c5ccc0a908 | ||
|
|
dbf04a9563 | ||
|
|
d1603ba25e | ||
|
|
d4ce57bd15 | ||
|
|
5e56346dc9 | ||
|
|
05db83a067 | ||
|
|
707ee1c85b | ||
|
|
a54adb925f | ||
|
|
8c53837802 | ||
|
|
3625b89a15 | ||
|
|
2ed68c2df8 | ||
|
|
db1915ec89 | ||
|
|
77e9ce5ede | ||
|
|
013c19eb36 | ||
|
|
61c04ddaf1 | ||
|
|
b4d361130c | ||
|
|
8e7571c34f | ||
|
|
1ba42ef6cc | ||
|
|
fc77521d49 | ||
|
|
1522069281 | ||
|
|
a13f46e781 | ||
|
|
3ad1ecf153 | ||
|
|
6087181634 | ||
|
|
c09adc4539 | ||
|
|
a626dea181 | ||
|
|
454ec4b438 | ||
|
|
4a64d602a0 | ||
|
|
f294656073 | ||
|
|
c7da910e68 | ||
|
|
40d33693cf | ||
|
|
13eaf2bf63 | ||
|
|
d4508ed112 | ||
|
|
c252e9f7c6 | ||
|
|
6690b80b29 | ||
|
|
19bb97a725 | ||
|
|
62ee62ebd3 | ||
|
|
87083034ee | ||
|
|
d9de57da6f | ||
|
|
d0b0323925 | ||
|
|
f592414409 | ||
|
|
e1c8f58d28 | ||
|
|
4870ed7e51 | ||
|
|
bbe48814b4 | ||
|
|
3b6ffa4a1f | ||
|
|
527c40b996 | ||
|
|
3aa2c86991 | ||
|
|
e2a20447df | ||
|
|
5d42c8cc5f | ||
|
|
256485ec5b | ||
|
|
7ab0394e76 | ||
|
|
89b04b2e10 | ||
|
|
a019a438e0 | ||
|
|
9834059786 | ||
|
|
550fade9e0 | ||
|
|
aa1b4fc0fb | ||
|
|
5a659803a8 | ||
|
|
7bc7789e81 | ||
|
|
cf0721da73 | ||
|
|
dcbf4d1bfd | ||
|
|
017b578502 | ||
|
|
58bade3b01 | ||
|
|
02631e674a | ||
|
|
5f5e534d05 | ||
|
|
51deeb478d | ||
|
|
acff8229b3 | ||
|
|
233555790a | ||
|
|
d5ddac8e7e | ||
|
|
e8210cd5e3 | ||
|
|
2dc6b485e0 | ||
|
|
11bede2b7d | ||
|
|
ed51dd9dea | ||
|
|
218f514005 | ||
|
|
209e8e066c | ||
|
|
7d05b01a56 | ||
|
|
64f6bedc37 | ||
|
|
4ae4aa98bb | ||
|
|
db8bda087b | ||
|
|
06eb52118e | ||
|
|
63be7d0069 | ||
|
|
c7468125fa | ||
|
|
7b3d8bf799 | ||
|
|
c4913fe583 | ||
|
|
d3339cb087 | ||
|
|
ba4fda12dc | ||
|
|
7a6d6d27ff | ||
|
|
bcabb03225 | ||
|
|
a404823c54 | ||
|
|
96ea70e3c9 | ||
|
|
9a01331ddd | ||
|
|
3bfa468ed1 | ||
|
|
fdf8572535 | ||
|
|
cff8b1552d | ||
|
|
e73dd0a7c4 | ||
|
|
9c4c2dfd37 | ||
|
|
2f8355c953 | ||
|
|
3f480482b6 | ||
|
|
8274196999 | ||
|
|
4e8c71f754 | ||
|
|
57e7b41e9c | ||
|
|
58d9894f1f | ||
|
|
4b4d4d32cd | ||
|
|
6a2ea9f614 | ||
|
|
0d6754e167 | ||
|
|
cb5c2a9708 | ||
|
|
dc8ad7edf5 | ||
|
|
52bc82149f | ||
|
|
f53b5e27e0 | ||
|
|
ce5be3452c | ||
|
|
ce14c225e5 | ||
|
|
b78721826e | ||
|
|
85113df113 | ||
|
|
607b56cb87 | ||
|
|
2dbf8b7d41 | ||
|
|
7d4c10043d | ||
|
|
64604124c9 | ||
|
|
50f20ad836 | ||
|
|
ac40283501 | ||
|
|
e03d4fc1a5 | ||
|
|
05e9443db5 | ||
|
|
1250cc758f | ||
|
|
a18784da6c | ||
|
|
c87d637edd | ||
|
|
bf4a4e5296 | ||
|
|
4f7b80dad2 | ||
|
|
8a2f9bc7bb | ||
|
|
b9806c183b | ||
|
|
5aa4c4c999 | ||
|
|
424cfac80f | ||
|
|
715913f3b4 | ||
|
|
1c2c4fdcd3 | ||
|
|
2ea6c2a3a7 | ||
|
|
d91da857a0 | ||
|
|
31e65969b3 | ||
|
|
df250bc056 | ||
|
|
1569274684 | ||
|
|
6d8f751da4 | ||
|
|
c2dd00a4ab | ||
|
|
9e6ae6eef8 | ||
|
|
58b985ba02 | ||
|
|
b4f3143c8c | ||
|
|
84ad6b5d50 | ||
|
|
32c14af5ce | ||
|
|
46023c47f5 | ||
|
|
71212e5f68 | ||
|
|
6d1c34048c | ||
|
|
f67006057e | ||
|
|
e1e397a7b5 | ||
|
|
0f35799a77 | ||
|
|
be44221d98 | ||
|
|
94ad254a58 | ||
|
|
666a4be1f2 | ||
|
|
e542fbd0a2 | ||
|
|
f4b2d13aa4 | ||
|
|
abcae6da96 | ||
|
|
1b9b3eaa8e | ||
|
|
0babc4f192 | ||
|
|
e51ffb37b4 | ||
|
|
2fba96713c | ||
|
|
dccf8edc25 | ||
|
|
d98aeac818 | ||
|
|
62bfc4ea19 | ||
|
|
8d74029fba | ||
|
|
809cb5cf1f | ||
|
|
a4196609c9 | ||
|
|
e7eedcf48d | ||
|
|
8bf042b153 | ||
|
|
8325a12faf | ||
|
|
03abccd8e8 | ||
|
|
19e79fedb2 | ||
|
|
71eacaa3b1 | ||
|
|
7cfa46d838 | ||
|
|
7989e78460 | ||
|
|
08466f615f | ||
|
|
880d14990f | ||
|
|
39ac8f6d46 | ||
|
|
685fc7066f | ||
|
|
127600e728 | ||
|
|
d764328026 | ||
|
|
cae8296999 | ||
|
|
86efb71124 | ||
|
|
0899b08b8c | ||
|
|
a770db9d3e | ||
|
|
87b5c43166 | ||
|
|
d14ab2aeff | ||
|
|
5e95362542 | ||
|
|
e92d4e6258 | ||
|
|
641aada8a8 | ||
|
|
c8c59fe93a | ||
|
|
450746f94d | ||
|
|
827f03f272 | ||
|
|
de6f949c64 | ||
|
|
82cdec7197 | ||
|
|
ab7e152877 | ||
|
|
0ec694940e | ||
|
|
5a4af29f0e | ||
|
|
d72578e492 | ||
|
|
405e8b1786 | ||
|
|
8909bd4ba1 | ||
|
|
e9af56eb87 | ||
|
|
ee361e9ae2 | ||
|
|
a580c38fed | ||
|
|
668059a2c4 | ||
|
|
31a53d5842 | ||
|
|
e4e768062a | ||
|
|
3192240dc0 | ||
|
|
2d9a011f82 | ||
|
|
476aed7f5b | ||
|
|
09580c2d87 | ||
|
|
48a07d031e | ||
|
|
7414a9d56a | ||
|
|
91e08b5524 | ||
|
|
8abb6521b4 | ||
|
|
6394e5448c | ||
|
|
2f5651d988 | ||
|
|
a7afbd106f | ||
|
|
d67774d90f | ||
|
|
07f36d3500 | ||
|
|
cc1bcf7989 | ||
|
|
096653daf7 | ||
|
|
773a6b50eb | ||
|
|
bb3bd0d357 | ||
|
|
16eb944d2f | ||
|
|
74df3ab4f7 | ||
|
|
d18e75bbf1 | ||
|
|
b7cffe4121 | ||
|
|
5180b09acb | ||
|
|
6fad954147 | ||
|
|
3b1eac0e50 | ||
|
|
7715dbf0f2 | ||
|
|
bbb682c13d | ||
|
|
42a8514c22 | ||
|
|
ffca1e2969 | ||
|
|
1aa65bc14b | ||
|
|
1f46819b61 | ||
|
|
5892fdb2bb | ||
|
|
32d792de01 | ||
|
|
82646f34ca | ||
|
|
4f25ea7e6b | ||
|
|
146f5c4c2a | ||
|
|
6b9cba1411 | ||
|
|
a413efc3ca | ||
|
|
6c8aed5dcc | ||
|
|
52905fd6de | ||
|
|
f8807c7440 | ||
|
|
755591f9e5 | ||
|
|
896d0d4b54 | ||
|
|
cf95d4e59e | ||
|
|
b503994577 | ||
|
|
569f77b512 | ||
|
|
773fb89acb | ||
|
|
890b1ee3c2 | ||
|
|
bfb5b721c5 | ||
|
|
9b6995f28c | ||
|
|
1b8bb4a0a6 | ||
|
|
7f35b875a4 | ||
|
|
b5d2ed0322 | ||
|
|
a7b78a6210 | ||
|
|
90c14fd116 | ||
|
|
830ad87fcb | ||
|
|
3a8928f869 | ||
|
|
f883c5e77c | ||
|
|
8cc83d180d | ||
|
|
65cc529ec6 | ||
|
|
9686ceed2d | ||
|
|
2c73efa536 | ||
|
|
800312361f | ||
|
|
59897c19a9 | ||
|
|
08a3e9e881 | ||
|
|
1e2f7cb1f8 | ||
|
|
17c38115e6 | ||
|
|
0ee6531fcd | ||
|
|
87c12c155d | ||
|
|
b373e4312e | ||
|
|
b39a609226 | ||
|
|
d25f64cca0 | ||
|
|
0d40a53e06 | ||
|
|
c779905163 | ||
|
|
59da358eb5 | ||
|
|
b815ffa403 | ||
|
|
27a8be2381 | ||
|
|
d5b53a1778 | ||
|
|
01b745c366 | ||
|
|
af96f33e6f | ||
|
|
2dda926cb6 | ||
|
|
8fb6fc847c | ||
|
|
11d1b8fcd4 | ||
|
|
5076d76a74 | ||
|
|
044621b325 | ||
|
|
5a3426dee6 | ||
|
|
b6b28bb1a2 | ||
|
|
189569518d | ||
|
|
731fddbc30 | ||
|
|
c4990b773d | ||
|
|
d56c5e3b44 | ||
|
|
6f1a4a2f82 | ||
|
|
a96d49f045 | ||
|
|
ee19dfadf1 | ||
|
|
2c5524476e | ||
|
|
7bde2ffd6e | ||
|
|
f17654cd96 | ||
|
|
0a47fc23a3 | ||
|
|
13eb435138 | ||
|
|
329f2817c2 | ||
|
|
609cef0b65 | ||
|
|
cfa1f1a3c1 | ||
|
|
e851262875 | ||
|
|
7956ccc979 | ||
|
|
13bc111bd6 | ||
|
|
cc0a30edf8 | ||
|
|
0ffc6cb7a0 | ||
|
|
6a2f53f07d | ||
|
|
930b1ea0ea | ||
|
|
8e8e5308b6 | ||
|
|
8f71d3fc50 | ||
|
|
a123d8f066 | ||
|
|
ea15cad8d5 | ||
|
|
e4a4f25f22 | ||
|
|
93677742d3 | ||
|
|
389765c113 | ||
|
|
5ef5fa7296 | ||
|
|
4e408e6d80 | ||
|
|
a140ea2b9d | ||
|
|
b920881490 | ||
|
|
56d5167a27 | ||
|
|
ddf81948a8 | ||
|
|
6652028d71 | ||
|
|
c9fccc5c75 | ||
|
|
f766937ac7 | ||
|
|
54f0823ec4 | ||
|
|
5f61d20610 | ||
|
|
7ed2df2722 | ||
|
|
a8a2a41315 | ||
|
|
676283875b | ||
|
|
4f95550977 | ||
|
|
7056081605 | ||
|
|
c90083855f | ||
|
|
2f997e6b29 | ||
|
|
8ad07d069c | ||
|
|
51e29cdfaf | ||
|
|
811425a15f | ||
|
|
9ee361df5b | ||
|
|
c1df192f09 | ||
|
|
7d6660d56c | ||
|
|
450b3c7ed5 | ||
|
|
e1e95fc1d2 | ||
|
|
8365270134 | ||
|
|
33163cd253 | ||
|
|
2b04a5a127 | ||
|
|
baa0a45537 | ||
|
|
6747e3eb0b | ||
|
|
bad8d7c4b3 | ||
|
|
2610ac7fc3 | ||
|
|
e2730ae34e | ||
|
|
beeeb133e6 | ||
|
|
01dc29d789 | ||
|
|
21085b472a | ||
|
|
5483ba5ae7 | ||
|
|
4a50bb3183 | ||
|
|
daeb964bfc | ||
|
|
ad4bf57535 | ||
|
|
83ff341e5e | ||
|
|
701d4c15a9 | ||
|
|
01ff7be020 | ||
|
|
a7bf8b6314 | ||
|
|
c386edb2e4 | ||
|
|
9e12191a64 | ||
|
|
feb6c188d3 | ||
|
|
1e245583c9 | ||
|
|
0e03509cbc | ||
|
|
3bf486e49d | ||
|
|
2497e3a8cf | ||
|
|
d798725d9e | ||
|
|
f0517880e7 | ||
|
|
dd68c31fb4 | ||
|
|
f6622fbb59 | ||
|
|
aa1fbb680b | ||
|
|
93067a0ce0 | ||
|
|
5a064d6bad | ||
|
|
feb5a2ff3b | ||
|
|
73a70a65ff | ||
|
|
3b81d81143 | ||
|
|
74543f75f9 | ||
|
|
d9d6cc1e76 | ||
|
|
a3f5c0c688 | ||
|
|
17b63b2be8 | ||
|
|
558a9cbf64 | ||
|
|
021f269d9d | ||
|
|
7f73007ec4 | ||
|
|
1a1bfd2c7c | ||
|
|
90b34333f5 | ||
|
|
fa59f168a7 | ||
|
|
9102a333e3 | ||
|
|
43bc3f5be2 | ||
|
|
fbc09aa77b | ||
|
|
03619b19a1 | ||
|
|
422e79dd01 | ||
|
|
b9a60649a8 | ||
|
|
a06dd72989 | ||
|
|
932dc843f9 | ||
|
|
c45c8d251a | ||
|
|
ea6a9305be | ||
|
|
c82a5c8aaa | ||
|
|
8135cd65dc | ||
|
|
db68a3acbd | ||
|
|
0628c63b15 | ||
|
|
4d05b5d81f | ||
|
|
24af6a00c6 | ||
|
|
fd72c1b9f1 | ||
|
|
885cd36165 | ||
|
|
a31780e08f | ||
|
|
dc3a4b4eb5 | ||
|
|
c1e018947d | ||
|
|
4a3321f253 | ||
|
|
c9614ab795 | ||
|
|
500262bd03 | ||
|
|
4467fe66c6 | ||
|
|
981ce3d990 | ||
|
|
936387d1df | ||
|
|
d14f74b82c | ||
|
|
85b1fb71c2 | ||
|
|
9e8f817a6b | ||
|
|
697f6dc7c7 | ||
|
|
d038ef4799 | ||
|
|
3a2d7adc35 | ||
|
|
0e8274ff3b | ||
|
|
a335fe008d | ||
|
|
251384bb47 | ||
|
|
54ec7f2bb2 | ||
|
|
2199d08e72 | ||
|
|
e9fa4434f2 | ||
|
|
154b2fdeca | ||
|
|
cf05602924 | ||
|
|
9a73eb8994 | ||
|
|
181e7a8b55 | ||
|
|
6635616826 | ||
|
|
71426e58a3 | ||
|
|
00d279ccd5 | ||
|
|
a4cd839c1e | ||
|
|
4354002bce | ||
|
|
106e2b7cb9 | ||
|
|
8443e7a749 | ||
|
|
3f3471997e | ||
|
|
90fbbec405 | ||
|
|
384ac98295 | ||
|
|
53f1394c25 | ||
|
|
5eff3fd976 | ||
|
|
f4c859aede | ||
|
|
65f2ec1f79 | ||
|
|
c3cb548fb3 | ||
|
|
996e605008 | ||
|
|
92ac02e6c6 | ||
|
|
ffc6a2fc9e | ||
|
|
36bf178947 | ||
|
|
a757416a0e | ||
|
|
f167959a38 | ||
|
|
e8e8c18c8f | ||
|
|
e91df944cc | ||
|
|
cc4fecb217 | ||
|
|
2443d3d91b | ||
|
|
f2f33b98f7 | ||
|
|
184a9d0d5c | ||
|
|
90aa2ab4eb | ||
|
|
2fab0b46c8 | ||
|
|
bff8736889 | ||
|
|
37e5571965 | ||
|
|
6c3935f7ea | ||
|
|
dbf42de407 | ||
|
|
900fbe6e75 | ||
|
|
fe4af50fb0 | ||
|
|
81c103b12d | ||
|
|
023013b6fe | ||
|
|
dfdd8cac94 | ||
|
|
d30441dd27 | ||
|
|
bd565be660 | ||
|
|
ad81434310 | ||
|
|
965df0bc2a | ||
|
|
cb1c36721c | ||
|
|
fede9e97e4 | ||
|
|
617baa29cd | ||
|
|
645109111e | ||
|
|
24aa603230 | ||
|
|
8b8a956155 | ||
|
|
5e801dd1d7 | ||
|
|
98200e6b39 | ||
|
|
f3405bcf29 | ||
|
|
1724c9328e | ||
|
|
025502efad | ||
|
|
397ebd4bdb | ||
|
|
6adf368c08 | ||
|
|
871e0e30f1 | ||
|
|
07ab7d98a6 | ||
|
|
69d4c2a27b | ||
|
|
0b4fa11486 | ||
|
|
7929dbfee1 | ||
|
|
73b234fd23 | ||
|
|
df333fdfb5 | ||
|
|
99c292a7ad | ||
|
|
8cd540e2e1 | ||
|
|
9bef2a8ac6 | ||
|
|
e3ac63da93 | ||
|
|
958206c469 | ||
|
|
98f1941b30 | ||
|
|
812dc0f528 | ||
|
|
9fa5737f54 | ||
|
|
0188c719d0 | ||
|
|
45ac101779 | ||
|
|
a75a406e05 | ||
|
|
80b031710e | ||
|
|
87b1d71f72 | ||
|
|
9a86b1df8b | ||
|
|
b86eb53256 | ||
|
|
9f5be1cf5a | ||
|
|
a1da95c9a5 | ||
|
|
cb422950f8 | ||
|
|
af5f8909a6 | ||
|
|
0a7e606650 | ||
|
|
c47e553425 | ||
|
|
7659ab5a47 | ||
|
|
a31ae97ea0 | ||
|
|
3cbf2abc5c | ||
|
|
d92294695d | ||
|
|
d7e93cbda9 | ||
|
|
a9e0635d31 | ||
|
|
f22dbc510d | ||
|
|
16aa731867 | ||
|
|
e1f295398e | ||
|
|
d00c5d0ad8 | ||
|
|
29a132496e | ||
|
|
c032b3c2d4 | ||
|
|
68ce5d78f9 | ||
|
|
70fef15f81 | ||
|
|
7b651dedcd | ||
|
|
a6af380833 | ||
|
|
b0993379ee | ||
|
|
7e7005abe2 | ||
|
|
55cf01d9f7 | ||
|
|
7354d6722f | ||
|
|
8e7c3b7164 | ||
|
|
c33358d48f | ||
|
|
ea541a6cf7 | ||
|
|
9a067c7821 | ||
|
|
67d48e4e35 | ||
|
|
1b89879a47 | ||
|
|
79c4a09181 | ||
|
|
ea35f2cf0e | ||
|
|
828607c67b | ||
|
|
64ffd7be36 | ||
|
|
4003a0d61c | ||
|
|
631b44fee2 | ||
|
|
c2c1bbc417 | ||
|
|
10c5a8346f | ||
|
|
c0c2f0bebc | ||
|
|
85e8ead0cf | ||
|
|
2e0ac79f0c | ||
|
|
b7dae2a846 | ||
|
|
cf470009ba | ||
|
|
434102550f | ||
|
|
00ac23c462 | ||
|
|
402266e65b | ||
|
|
852eb0bf49 | ||
|
|
84e17c7707 | ||
|
|
fb4a6c968c | ||
|
|
b3076d95b2 | ||
|
|
a2bff39427 | ||
|
|
0d82786715 | ||
|
|
17a433fb59 | ||
|
|
55ce19a233 | ||
|
|
59d74a83af | ||
|
|
dea4b746b7 | ||
|
|
61f5031f8a | ||
|
|
5d60632aa6 | ||
|
|
fe30ed3580 | ||
|
|
7370354535 | ||
|
|
b2890a00a3 | ||
|
|
f329b94625 | ||
|
|
62352a126e | ||
|
|
16be3a7f54 | ||
|
|
1de97d204d | ||
|
|
2bc8cc01a5 | ||
|
|
6266a94857 | ||
|
|
bd19ef489c | ||
|
|
a7b9a930e5 | ||
|
|
39659d8c36 | ||
|
|
22ebb85c35 | ||
|
|
30109204d9 | ||
|
|
3cd48e17d2 | ||
|
|
da5c7a77c3 | ||
|
|
43708f6395 | ||
|
|
29cec989b2 | ||
|
|
93c0134da9 | ||
|
|
5840120124 | ||
|
|
9d014e89bc | ||
|
|
15a3e15f2f | ||
|
|
95d77807c2 | ||
|
|
28221b5f5a | ||
|
|
c9397ce1e7 | ||
|
|
a1f8bcd0ae | ||
|
|
f1f466b69f | ||
|
|
df48f4d8a9 | ||
|
|
4c6cea87f1 | ||
|
|
828cc5d1bf | ||
|
|
59328ae65a | ||
|
|
6d76738427 | ||
|
|
0f3087cbd6 | ||
|
|
4c19ff30ed | ||
|
|
a38fbe8d21 | ||
|
|
8c1539ab24 | ||
|
|
af3b3eb323 | ||
|
|
c8f6d8a7f2 | ||
|
|
cf52e7d788 | ||
|
|
8eb34c5141 | ||
|
|
2a9cf7c06d | ||
|
|
f4cd02283b | ||
|
|
99cca5d249 | ||
|
|
5d8877a679 | ||
|
|
d18cc2d3e4 | ||
|
|
0ae00dc79c | ||
|
|
e1bfdfbc5e | ||
|
|
c2d332ce20 | ||
|
|
35a4039955 | ||
|
|
b7368654f1 | ||
|
|
87bad7b36d | ||
|
|
25837e3367 | ||
|
|
61a9cc6e6a | ||
|
|
8b5e638409 | ||
|
|
69fe17380c | ||
|
|
98ca711e44 | ||
|
|
b9ec912698 | ||
|
|
bc0fd47522 | ||
|
|
3e527e3141 | ||
|
|
ed423a4a8e | ||
|
|
f88b500ee8 | ||
|
|
32d645572c | ||
|
|
4a6ab18b73 | ||
|
|
8ec999089a | ||
|
|
1a07c0796f | ||
|
|
d4baff8d90 | ||
|
|
8aa414360e | ||
|
|
3b7de86b99 | ||
|
|
feb6c5928f | ||
|
|
d9c3277f9e | ||
|
|
1d33b33f28 | ||
|
|
e51179ed0f | ||
|
|
3a8db77200 |
47
.dockerignore
Normal file
47
.dockerignore
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
*.iml
|
||||||
|
out/
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
classpath.txt
|
||||||
|
version.properties
|
||||||
|
.project
|
||||||
|
.classpath
|
||||||
|
lib/*
|
||||||
|
build/*
|
||||||
|
generated-files/*
|
||||||
|
generated-sources/*
|
||||||
|
generated-code/*
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
/target
|
||||||
|
/generated-files
|
||||||
|
/nbactions.xml
|
||||||
|
*.pyc
|
||||||
|
__pycache__
|
||||||
|
samples/server-generator/scalatra/output
|
||||||
|
samples/server-generator/node/output/node_modules
|
||||||
|
samples/server-generator/scalatra/target
|
||||||
|
samples/server-generator/scalatra/output/.history
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/moc_*
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/*.o
|
||||||
|
samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata
|
||||||
|
samples/client/petstore/qt5cpp/build-*
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/PetStore
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/Makefile
|
||||||
|
samples/client/petstore/java/hello.txt
|
||||||
|
samples/client/petstore/android-java/hello.txt
|
||||||
|
samples/client/petstore/objc/Build
|
||||||
|
samples/client/petstore/objc/Pods
|
||||||
|
samples/server/petstore/nodejs/node_modules
|
||||||
|
target
|
||||||
|
.idea
|
||||||
|
.lib
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
samples/client/petstore/php/SwaggerClient-php/composer.lock
|
||||||
|
samples/client/petstore/php/SwaggerClient-php/vendor/
|
||||||
|
|
||||||
|
samples/client/petstore/silex/SwaggerServer/composer.lock
|
||||||
|
samples/client/petstore/silex/SwaggerServer/venodr/
|
||||||
27
.gitignore
vendored
27
.gitignore
vendored
@@ -9,6 +9,7 @@ version.properties
|
|||||||
lib/*
|
lib/*
|
||||||
build/*
|
build/*
|
||||||
generated-files/*
|
generated-files/*
|
||||||
|
generated-sources/*
|
||||||
generated-code/*
|
generated-code/*
|
||||||
*.swp
|
*.swp
|
||||||
*.swo
|
*.swo
|
||||||
@@ -22,4 +23,30 @@ samples/server-generator/scalatra/output
|
|||||||
samples/server-generator/node/output/node_modules
|
samples/server-generator/node/output/node_modules
|
||||||
samples/server-generator/scalatra/target
|
samples/server-generator/scalatra/target
|
||||||
samples/server-generator/scalatra/output/.history
|
samples/server-generator/scalatra/output/.history
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/moc_*
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/*.o
|
||||||
|
samples/client/petstore/objc/PetstoreClient.xcworkspace/xcuserdata
|
||||||
|
samples/client/petstore/qt5cpp/build-*
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/PetStore
|
||||||
|
samples/client/petstore/qt5cpp/PetStore/Makefile
|
||||||
|
samples/client/petstore/java/hello.txt
|
||||||
|
samples/client/petstore/android-java/hello.txt
|
||||||
|
samples/client/petstore/objc/SwaggerClientTests/Build
|
||||||
|
samples/client/petstore/objc/SwaggerClientTests/Pods
|
||||||
|
samples/client/petstore/objc/SwaggerClientTests/SwaggerClient.xcworkspace
|
||||||
|
samples/client/petstore/objc/SwaggerClientTests/Podfile.lock
|
||||||
|
samples/server/petstore/nodejs/node_modules
|
||||||
|
target
|
||||||
|
.idea
|
||||||
|
.lib
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
samples/client/petstore/php/SwaggerClient-php/composer.lock
|
||||||
|
samples/client/petstore/php/SwaggerClient-php/vendor/
|
||||||
|
|
||||||
|
samples/client/petstore/silex/SwaggerServer/composer.lock
|
||||||
|
samples/client/petstore/silex/SwaggerServer/venodr/
|
||||||
|
|
||||||
|
samples/client/petstore/python/.projectile
|
||||||
|
samples/client/petstore/python/.venv/
|
||||||
|
|||||||
5
.travis.yml
Normal file
5
.travis.yml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
sudo: false
|
||||||
|
language: java
|
||||||
|
script: mvn verify -Psamples
|
||||||
|
jdk:
|
||||||
|
- oraclejdk7
|
||||||
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
FROM maven:3.3-jdk-7
|
||||||
|
|
||||||
|
WORKDIR /src
|
||||||
|
VOLUME /src
|
||||||
|
VOLUME /root/.m2/repository
|
||||||
|
|
||||||
|
ADD . /opt/swagger-codegen
|
||||||
|
|
||||||
|
RUN cd /opt/swagger-codegen && mvn package
|
||||||
|
|
||||||
|
ENTRYPOINT ["java", "-jar", "/opt/swagger-codegen/modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"]
|
||||||
|
|
||||||
|
CMD ["help"]
|
||||||
11
LICENSE
Normal file
11
LICENSE
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Copyright 2015 SmartBear Software
|
||||||
|
|
||||||
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
you may not use this file except in compliance with the License.
|
||||||
|
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing, software
|
||||||
|
distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
See the License for the specific language governing permissions and
|
||||||
|
limitations under the License.
|
||||||
420
README.md
420
README.md
@@ -1,138 +1,376 @@
|
|||||||
# Swagger Client Code-Generator
|
# Swagger Code Generator
|
||||||
|
|
||||||
|
[](https://travis-ci.org/swagger-api/swagger-codegen)
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
This is the swagger codegen project, which allows generation of client libraries automatically from a
|
This is the swagger codegen project, which allows generation of client libraries automatically from a Swagger-compliant server.
|
||||||
Swagger-compliant server. You can find out more about both the spec and the framework at
|
|
||||||
http://swagger.wordnik.com. For more information about Wordnik's APIs, please visit http://developer.wordnik.com.
|
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
|
||||||
|
|
||||||
|
## Build and run using docker
|
||||||
|
|
||||||
|
```
|
||||||
|
git clone https://github.com/swagger-api/swagger-codegen
|
||||||
|
|
||||||
|
cd swagger-codegen
|
||||||
|
|
||||||
|
./run-in-docker.sh mvn package
|
||||||
|
```
|
||||||
|
|
||||||
|
Build a nodejs server stub:
|
||||||
|
|
||||||
|
```
|
||||||
|
./run-in-docker.sh generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l nodejs \
|
||||||
|
-o samples/server/petstore/nodejs
|
||||||
|
```
|
||||||
|
|
||||||
|
## Compatibility
|
||||||
|
The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-codegen project has the following compatibilies with the swagger specification:
|
||||||
|
|
||||||
|
Swagger Codegen Version | Release Date | Swagger Spec compatibility | Notes
|
||||||
|
-------------------------- | ------------ | -------------------------- | -----
|
||||||
|
2.1.3 | | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen)
|
||||||
|
2.1.3 (**current stable**) | 2015-08-24 | 1.0, 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-codegen/tree/v2.1.3)
|
||||||
|
2.0.17 | 2014-08-22 | 1.1, 1.2 | [tag v2.0.17](https://github.com/swagger-api/swagger-codegen/tree/v2.0.17)
|
||||||
|
1.0.4 | 2012-04-12 | 1.0, 1.1 | [tag v1.0.4](https://github.com/swagger-api/swagger-codegen/tree/swagger-codegen_2.9.1-1.1)
|
||||||
|
|
||||||
|
|
||||||
### Prerequisites
|
### Prerequisites
|
||||||
You need the following installed and available in your $PATH:
|
You need the following installed and available in your $PATH:
|
||||||
|
|
||||||
* [Java 1.6](http://java.oracle.com)
|
* [Java 7](http://java.oracle.com)
|
||||||
|
|
||||||
* [Apache maven 3.0.3 or greater](http://maven.apache.org/)
|
* [Apache maven 3.0.3 or greater](http://maven.apache.org/)
|
||||||
|
|
||||||
|
#### OS X Users
|
||||||
|
Don't forget to install Java 7. You probably have 1.6 or 1.8.
|
||||||
|
|
||||||
* [Scala](http://www.scala-lang.org)
|
Export JAVA_HOME in order to user proper Java version:
|
||||||
|
```
|
||||||
|
export JAVA_HOME=`/usr/libexec/java_home -v 1.7`
|
||||||
|
export PATH=${JAVA_HOME}/bin:$PATH
|
||||||
|
```
|
||||||
|
|
||||||
You also need to add the scala binary to your PATH.
|
#### Building
|
||||||
|
|
||||||
|
After cloning the project, you can build it from source with this command:
|
||||||
|
|
||||||
|
```
|
||||||
|
mvn package
|
||||||
|
```
|
||||||
|
|
||||||
### To generate a sample client library
|
### To generate a sample client library
|
||||||
You can build a client against Wordnik's [petstore](http://petstore.swagger.wordnik.com) API as follows:
|
You can build a client against the swagger sample [petstore](http://petstore.swagger.io) API as follows:
|
||||||
|
|
||||||
```
|
```
|
||||||
./bin/scala-petstore.sh
|
./bin/java-petstore.sh
|
||||||
```
|
```
|
||||||
|
|
||||||
This will run the script in [samples/client/petstore/ScalaPetstoreCodegen.scala](https://github.com/wordnik/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) and create the client. You can then
|
This will run the generator with this command:
|
||||||
compile and run the client, as well as unit tests against it:
|
|
||||||
|
|
||||||
```
|
```
|
||||||
cd samples/client/petstore/scala
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l java \
|
||||||
|
-o samples/client/petstore/java
|
||||||
|
```
|
||||||
|
|
||||||
|
With a number of options. You can get the options with the `help generate` command:
|
||||||
|
|
||||||
|
```
|
||||||
|
NAME
|
||||||
|
swagger generate - Generate code with chosen lang
|
||||||
|
|
||||||
|
SYNOPSIS
|
||||||
|
swagger generate [(-a <authorization> | --auth <authorization>)]
|
||||||
|
[(-c <configuration file> | --config <configuration file>)]
|
||||||
|
[-D <system properties>]
|
||||||
|
(-i <spec file> | --input-spec <spec file>)
|
||||||
|
(-l <language> | --lang <language>)
|
||||||
|
[(-o <output directory> | --output <output directory>)]
|
||||||
|
[(-t <template directory> | --template-dir <template directory>)]
|
||||||
|
[(-v | --verbose)]
|
||||||
|
[(-s | --skip-overwrite)]
|
||||||
|
|
||||||
|
OPTIONS
|
||||||
|
-a <authorization>, --auth <authorization>
|
||||||
|
adds authorization headers when fetching the swagger definitions
|
||||||
|
remotely. Pass in a URL-encoded string of name:header with a comma
|
||||||
|
separating multiple values
|
||||||
|
|
||||||
|
-c <configuration file>, --config <configuration file>
|
||||||
|
Path to json configuration file. File content should be in a json
|
||||||
|
format {"optionKey":"optionValue", "optionKey1":"optionValue1"...}
|
||||||
|
Supported options can be different for each language. Run
|
||||||
|
config-help -l {lang} command for language specific config options.
|
||||||
|
|
||||||
|
-D <system properties>
|
||||||
|
sets specified system properties in the format of
|
||||||
|
name=value,name=value
|
||||||
|
|
||||||
|
-i <spec file>, --input-spec <spec file>
|
||||||
|
location of the swagger spec, as URL or file (required)
|
||||||
|
|
||||||
|
-l <language>, --lang <language>
|
||||||
|
client language to generate (maybe class name in classpath,
|
||||||
|
required)
|
||||||
|
|
||||||
|
-o <output directory>, --output <output directory>
|
||||||
|
where to write the generated files (current dir by default)
|
||||||
|
|
||||||
|
-t <template directory>, --template-dir <template directory>
|
||||||
|
folder containing the template files
|
||||||
|
|
||||||
|
-v, --verbose
|
||||||
|
verbose mode
|
||||||
|
|
||||||
|
-s , --skip-overwrite
|
||||||
|
specifies if the existing files should be overwritten during
|
||||||
|
the generation
|
||||||
|
```
|
||||||
|
|
||||||
|
You can then compile and run the client, as well as unit tests against it:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd samples/client/petstore/java
|
||||||
mvn package
|
mvn package
|
||||||
```
|
```
|
||||||
|
|
||||||
Other languages have petstore samples, too:
|
Other languages have petstore samples, too:
|
||||||
```
|
```
|
||||||
./bin/flash-petstore.sh
|
./bin/android-petstore.sh
|
||||||
./bin/java-petstore.sh
|
./bin/java-petstore.sh
|
||||||
./bin/objc-petstore.sh
|
./bin/objc-petstore.sh
|
||||||
./bin/php-petstore.sh
|
|
||||||
./bin/python-petstore.sh
|
|
||||||
./bin/python3-petstore.sh
|
|
||||||
./bin/ruby-petstore.sh
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Generating libraries from your server
|
### Generating libraries from your server
|
||||||
It's just as easy--you can either run the default generators:
|
It's just as easy--just use the `-i` flag to point to either a server or file.
|
||||||
|
|
||||||
```
|
|
||||||
./bin/runscala.sh com.wordnik.swagger.codegen.BasicScalaGenerator http://petstore.swagger.wordnik.com/api/resources.json special-key
|
|
||||||
```
|
|
||||||
|
|
||||||
Replace `Scala` with `Flash`, `Java`, `Objc`, `PHP`, `Python`, `Python3`, `Ruby`.
|
|
||||||
|
|
||||||
You will probably want to override some of the defaults--like packages, etc. For doing this, just create a scala
|
|
||||||
script with the overrides you want. Follow [ScalaPetstoreCodegen](https://github.com/wordnik/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) as an example:
|
|
||||||
|
|
||||||
For example, create `src/main/scala/MyCodegen.scala` with these contents:
|
|
||||||
|
|
||||||
```scala
|
|
||||||
import com.wordnik.swagger.codegen.BasicScalaGenerator
|
|
||||||
|
|
||||||
object MyCodegen extends BasicScalaGenerator {
|
|
||||||
def main(args: Array[String]) = generateClient(args)
|
|
||||||
|
|
||||||
// location of templates
|
|
||||||
override def templateDir = "scala"
|
|
||||||
|
|
||||||
// where to write generated code
|
|
||||||
override def destinationDir = "client/scala/src/main/scala"
|
|
||||||
|
|
||||||
// api invoker package
|
|
||||||
override def invokerPackage = "com.myapi.client"
|
|
||||||
|
|
||||||
// package for models
|
|
||||||
override def modelPackage = Some("com.myapi.client.model")
|
|
||||||
|
|
||||||
// package for api classes
|
|
||||||
override def apiPackage = Some("com.myapi.client.api")
|
|
||||||
|
|
||||||
// supporting classes
|
|
||||||
override def supportingFiles = List(
|
|
||||||
("apiInvoker.mustache", destinationDir + java.io.File.separator + packageName.replaceAll("\\.", java.io.File.separator), "ApiInvoker.scala"),
|
|
||||||
("pom.mustache", destinationDir, "pom.xml")
|
|
||||||
)
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Now you can generate your client like this:
|
|
||||||
|
|
||||||
```
|
|
||||||
./bin/runscala.sh src/main/scala/MyCodegen.scala http://my.api.com/resources.json super-secret-key
|
|
||||||
```
|
|
||||||
|
|
||||||
w00t! Thanks to the scala interpretor, you didn't even need to recompile.
|
|
||||||
|
|
||||||
### Modifying the client library format
|
### Modifying the client library format
|
||||||
Don't like the default swagger client syntax? Want a different language supported? No problem! Swagger codegen
|
Don't like the default swagger client syntax? Want a different language supported? No problem! Swagger codegen processes mustache templates with the [jmustache](https://github.com/samskivert/jmustache) engine. You can modify our templates or make your own.
|
||||||
processes mustache templates with the [scalate](http://scalate.fusesource.org/) engine. You can modify our templates or
|
|
||||||
make your own.
|
|
||||||
|
|
||||||
You can look at `src/main/resources/${your-language}` for examples. To make your own templates, create your own files
|
You can look at `modules/swagger-codegen/src/main/resources/${your-language}` for examples. To make your own templates, create your own files and use the `-t` flag to specify your template folder. It actually is that easy.
|
||||||
and override the `templateDir` in your script to point to the right place. It actually is that easy.
|
|
||||||
|
### Making your own codegen modules
|
||||||
|
If you're starting a project with a new language and don't see what you need, swagger-codegen can help you create a project to generate your own libraries:
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-distribution/target/swagger-codegen-cli.jar meta \
|
||||||
|
-o output/myLibrary -n myClientCodegen -p com.my.company.codegen
|
||||||
|
```
|
||||||
|
|
||||||
|
This will write, in the folder `output/myLibrary`, all the files you need to get started, including a README.md. Once modified and compiled, you can load your library with the codegen and generate clients with your own, custom-rolled logic.
|
||||||
|
|
||||||
### Where is Javascript???
|
### Where is Javascript???
|
||||||
See our [javascript library](http://github.com/wordnik/swagger.js)--it's completely dynamic and doesn't require
|
See our [javascript library](http://github.com/swagger-api/swagger-js)--it's completely dynamic and doesn't require
|
||||||
static code generation.
|
static code generation.
|
||||||
|
There is a third-party component called [swagger-js-codegen](https://github.com/wcandillon/swagger-js-codegen) that can generate angularjs or nodejs source code from a swagger specification.
|
||||||
|
|
||||||
|
|
||||||
#### Generating a client from flat files (i.e. no remote server calls)
|
#### Generating a client from flat files (i.e. no remote server calls)
|
||||||
If you don't want to call your server, you can save the swagger spec files into a directory and pass an argument
|
If you don't want to call your server, you can save the swagger spec files into a directory and pass an argument
|
||||||
to the code generator like this:
|
to the code generator like this:
|
||||||
|
|
||||||
```
|
```
|
||||||
-DfileMap=/path/to/files
|
-i ./modules/swagger-codegen/src/test/resources/2_0/petstore.json
|
||||||
```
|
```
|
||||||
|
|
||||||
Or for example:
|
Great for creating libraries on your ci server, from the [Swagger Editor](http://editor.swagger.io)... or while coding on an airplane.
|
||||||
|
|
||||||
|
### Customizing the generator
|
||||||
|
|
||||||
|
There are different aspects of customizing the code generator beyond just creating or modifying templates. Each language has a supporting configuration file to handle different type mappings, etc:
|
||||||
|
|
||||||
```
|
```
|
||||||
./bin/java-petstore-filemap.sh
|
$ ls -1 modules/swagger-codegen/src/main/java/io/swagger/codegen/languages/
|
||||||
|
AbstractTypeScriptClientCodegen.java
|
||||||
|
AkkaScalaClientCodegen.java
|
||||||
|
AndroidClientCodegen.java
|
||||||
|
AsyncScalaClientCodegen.java
|
||||||
|
CSharpClientCodegen.java
|
||||||
|
CodeGenStatus.java
|
||||||
|
CsharpDotNet2ClientCodegen.java
|
||||||
|
FlashClientCodegen.java
|
||||||
|
JavaClientCodegen.java
|
||||||
|
JavaInflectorServerCodegen.java
|
||||||
|
JaxRSServerCodegen.java
|
||||||
|
NodeJSServerCodegen.java
|
||||||
|
ObjcClientCodegen.java
|
||||||
|
PerlClientCodegen.java
|
||||||
|
PhpClientCodegen.java
|
||||||
|
Python3ClientCodegen.java
|
||||||
|
PythonClientCodegen.java
|
||||||
|
Qt5CPPGenerator.java
|
||||||
|
RetrofitClientCodegen.java
|
||||||
|
RubyClientCodegen.java
|
||||||
|
ScalaClientCodegen.java
|
||||||
|
ScalatraServerCodegen.java
|
||||||
|
SilexServerCodegen.java
|
||||||
|
SinatraServerCodegen.java
|
||||||
|
SpringMVCServerCodegen.java
|
||||||
|
StaticDocCodegen.java
|
||||||
|
StaticHtmlGenerator.java
|
||||||
|
SwaggerGenerator.java
|
||||||
|
SwaggerYamlGenerator.java
|
||||||
|
SwiftCodegen.java
|
||||||
|
TizenClientCodegen.java
|
||||||
|
TypeScriptAngularClientCodegen.java
|
||||||
|
TypeScriptNodeClientCodegen.java
|
||||||
```
|
```
|
||||||
|
|
||||||
Which simple passes `-DfileMap=src/test/resources/petstore` as an argument. Great for creating libraries on your
|
Each of these files creates reasonable defaults so you can get running quickly. But if you want to configure package names, prefixes, model folders, etc. you can use a json config file to pass the values.
|
||||||
ci server... or while coding on an airplane.
|
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l java \
|
||||||
|
-o samples/client/petstore/java \
|
||||||
|
-c path/to/config.json
|
||||||
|
```
|
||||||
|
Supported config options can be different per language. Running `config-help -l {lang}` will show available options.
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar config-help -l java
|
||||||
|
```
|
||||||
|
|
||||||
|
Output
|
||||||
|
|
||||||
|
```
|
||||||
|
CONFIG OPTIONS
|
||||||
|
modelPackage
|
||||||
|
package for generated models
|
||||||
|
|
||||||
|
apiPackage
|
||||||
|
package for generated api classes
|
||||||
|
|
||||||
|
invokerPackage
|
||||||
|
root package for generated code
|
||||||
|
|
||||||
|
groupId
|
||||||
|
groupId in generated pom.xml
|
||||||
|
|
||||||
|
artifactId
|
||||||
|
artifactId in generated pom.xml
|
||||||
|
|
||||||
|
artifactVersion
|
||||||
|
artifact version in generated pom.xml
|
||||||
|
|
||||||
|
sourceFolder
|
||||||
|
source folder for generated code
|
||||||
|
|
||||||
|
library
|
||||||
|
library template (sub-template) to use:
|
||||||
|
<default> - HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2
|
||||||
|
jersey2 - HTTP client: Jersey client 2.6
|
||||||
|
```
|
||||||
|
|
||||||
|
Your config file for java can look like
|
||||||
|
|
||||||
|
```
|
||||||
|
{
|
||||||
|
"groupId":"com.my.company",
|
||||||
|
"artifactId":"MyClent",
|
||||||
|
"artifactVersion":"1.2.0"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For all the unspecified options default values will be used.
|
||||||
|
|
||||||
|
Another way to override default options is to extend config class for specific language.
|
||||||
|
To change, for example, the prefix for the Objective-C generated files, simply subclass the ObjcClientCodegen.java:
|
||||||
|
|
||||||
|
```
|
||||||
|
package com.mycompany.swagger.codegen;
|
||||||
|
|
||||||
|
import io.swagger.codegen.languages.*;
|
||||||
|
|
||||||
|
public class MyObjcCodegen extends ObjcClientCodegen {
|
||||||
|
static {
|
||||||
|
PREFIX = "HELO";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
and specify the `classname` when running the generator:
|
||||||
|
|
||||||
|
```
|
||||||
|
-l com.mycompany.swagger.codegen.MyObjcCodegen
|
||||||
|
```
|
||||||
|
|
||||||
|
Your subclass will now be loaded and overrides the `PREFIX` value in the superclass.
|
||||||
|
|
||||||
### Validating your swagger spec
|
### Validating your swagger spec
|
||||||
You can use the validation tool to see that your server is creating a proper spec file. If you want to learn
|
|
||||||
more about the spec file and format, please see [swagger-core](https://github.com/wordnik/swagger-core/wiki). This
|
|
||||||
tool will read the server and generate a report of any violations of the spec. If there are violations, the
|
|
||||||
client codegen and ui may not work correctly.
|
|
||||||
|
|
||||||
To validate an api and write output to ./swagger-errors.html:
|
You have options. The easiest is to use our [online validator](https://github.com/swagger-api/validator-badge) which not only will let you validate your spec, but with the debug flag, you can see what's wrong with your spec. For example:
|
||||||
|
|
||||||
|
http://online.swagger.io/validator/debug?url=http://petstore.swagger.io/v2/swagger.json
|
||||||
|
|
||||||
|
### Generating dynamic html api documentation
|
||||||
|
|
||||||
|
To do so, just use the `-l dynamic-html` flag when reading a spec file. This creates HTML documentation that is available as a single-page application with AJAX. To view the documentation:
|
||||||
|
|
||||||
```
|
```
|
||||||
./bin/validate.sh http://petstore.swagger.wordnik.com/api/resources.json "" ./swagger-errors.html
|
cd samples/dynamic-html/
|
||||||
|
npm install
|
||||||
|
node .
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Which launches a node.js server so the AJAX calls have a place to go.
|
||||||
|
|
||||||
|
|
||||||
|
### Generating static html api documentation
|
||||||
|
|
||||||
|
To do so, just use the `-l html` flag when reading a spec file. This creates a single, simple HTML file with embedded css so you can ship it as an email attachment, or load it from your filesystem:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd samples/html/
|
||||||
|
open index.html
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### To build a server stub
|
||||||
|
|
||||||
|
You can also use the codegen to generate a server for a couple different frameworks. Take a look here:
|
||||||
|
|
||||||
|
### node.js
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l nodejs \
|
||||||
|
-o samples/server/petstore/nodejs
|
||||||
|
```
|
||||||
|
|
||||||
|
### rails-grape
|
||||||
|
#### Not yet migrated to this branch
|
||||||
|
|
||||||
|
|
||||||
|
### scala scalatra
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l scalatra \
|
||||||
|
-o samples/server/petstore/scalatra
|
||||||
|
```
|
||||||
|
|
||||||
|
### java jax-rs
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l jaxrs \
|
||||||
|
-o samples/server/petstore/jaxrs
|
||||||
|
```
|
||||||
|
|
||||||
|
### java spring-mvc
|
||||||
|
|
||||||
|
```
|
||||||
|
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||||
|
-i http://petstore.swagger.io/v2/swagger.json \
|
||||||
|
-l spring-mvc \
|
||||||
|
-o samples/server/petstore/spring-mvc
|
||||||
|
```
|
||||||
### To build the codegen library
|
### To build the codegen library
|
||||||
|
|
||||||
This will create the swagger-codegen library from source.
|
This will create the swagger-codegen library from source.
|
||||||
@@ -141,24 +379,12 @@ This will create the swagger-codegen library from source.
|
|||||||
mvn package
|
mvn package
|
||||||
```
|
```
|
||||||
|
|
||||||
Note! The templates are included in the library generated. If you want to modify the templates, you'll need to
|
Note! The templates are included in the library generated. If you want to modify the templates, you'll need to either repackage the library OR specify a path to your scripts
|
||||||
either repackage the library OR modify your codegen script to use a file path!
|
|
||||||
|
|
||||||
|
|
||||||
### To build a server stub
|
|
||||||
|
|
||||||
You can also use the codegen to generate a server for a couple different frameworks. Take a look here:
|
|
||||||
|
|
||||||
* [javascript node.js Server generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/node)
|
|
||||||
|
|
||||||
* [ruby sinatra generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/sinatra)
|
|
||||||
|
|
||||||
* [scala sinatra generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/scalatra)
|
|
||||||
|
|
||||||
License
|
License
|
||||||
-------
|
-------
|
||||||
|
|
||||||
Copyright 2012 Wordnik, Inc.
|
Copyright 2015 SmartBear Software
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|||||||
31
bin/akka-scala-petstore.sh
Executable file
31
bin/akka-scala-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/akka-scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l akka-scala -o samples/client/petstore/akka-scala"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
46
bin/all-petstore.sh
Executable file
46
bin/all-petstore.sh
Executable file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
cd $APP_DIR
|
||||||
|
./bin/akka-scala-petstore.sh
|
||||||
|
./bin/android-java-petstore.sh
|
||||||
|
./bin/csharp-petstore.sh
|
||||||
|
./bin/dynamic-html.sh
|
||||||
|
./bin/html-petstore.sh
|
||||||
|
./bin/java-petstore.sh
|
||||||
|
./bin/java-petstore-jersey2.sh
|
||||||
|
./bin/jaxrs-petstore-server.sh
|
||||||
|
./bin/nodejs-petstore-server.sh
|
||||||
|
./bin/objc-petstore.sh
|
||||||
|
./bin/perl-petstore.sh
|
||||||
|
./bin/php-petstore.sh
|
||||||
|
./bin/python-petstore.sh
|
||||||
|
./bin/python3-petstore.sh
|
||||||
|
./bin/qt5-petstore.sh
|
||||||
|
./bin/retrofit-petstore.sh
|
||||||
|
./bin/ruby-petstore.sh
|
||||||
|
./bin/scala-async-petstore.sh
|
||||||
|
./bin/scala-petstore.sh
|
||||||
|
./bin/scalatra-petstore-server.sh
|
||||||
|
./bin/silex-petstore-server.sh
|
||||||
|
./bin/spring-mvc-petstore-server.sh
|
||||||
|
./bin/swift-petstore.sh
|
||||||
|
./bin/tizen-petstore.sh
|
||||||
|
./bin/typescript-angular-petstore.sh
|
||||||
|
./bin/typescript-node-petstore.sh
|
||||||
24
bin/all-wordnik.sh
Executable file
24
bin/all-wordnik.sh
Executable file
@@ -0,0 +1,24 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
cd $APP_DIR
|
||||||
|
./bin/android-java-wordnik-api.sh
|
||||||
|
./bin/java-wordnik-api.sh
|
||||||
|
./bin/objc-wordnik-api.sh
|
||||||
|
./bin/scala-wordnik-api.sh
|
||||||
31
bin/android-java-petstore.sh
Executable file
31
bin/android-java-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/android-java -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l android -o samples/client/petstore/android-java"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/android-java-wordnik-api.sh
Executable file
31
bin/android-java-wordnik-api.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l android -o samples/client/wordnik/android-java"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/csharp-dotnet2-petstore.sh
Executable file
31
bin/csharp-dotnet2-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l CsharpDotNet2 -o samples/client/petstore/csharp-dotnet2/SwaggerClientTest/Lib/SwaggerClient"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/csharp-petstore.sh
Executable file
31
bin/csharp-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l csharp -o samples/client/petstore/csharp/SwaggerClientTest/Lib/SwaggerClient"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/dynamic-html.sh
Executable file
31
bin/dynamic-html.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l dynamic-html -o samples/dynamic-html"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/flash/FlashPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/flash -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l flash -o samples/client/petstore/flash"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
31
bin/html-petstore.sh
Executable file
31
bin/html-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l html -o samples/html"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/java-inflector-petstore-server.sh
Executable file
31
bin/java-inflector-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaInflector -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l inflector -o samples/server/petstore/java-inflector"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=src/test/resources/petstore "
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
|
||||||
4
bin/java-petstore-jersey2.json
Normal file
4
bin/java-petstore-jersey2.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"library": "jersey2",
|
||||||
|
"artifactId": "swagger-petstore-jersey2"
|
||||||
|
}
|
||||||
31
bin/java-petstore-jersey2.sh
Executable file
31
bin/java-petstore-jersey2.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -c bin/java-petstore-jersey2.json -o samples/client/petstore/java/jersey2"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java/default"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/wordnik-api/java/JavaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l java -o samples/client/wordnik/java"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
31
bin/jaxrs-petstore-server.sh
Executable file
31
bin/jaxrs-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaJaxRS -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l jaxrs -o samples/server/petstore/jaxrs -Dswagger.codegen.jaxrs.impl.source=src/main/java"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/nodejs-petstore-server.sh
Executable file
31
bin/nodejs-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l nodejs -o samples/server/petstore/nodejs"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -Dservice -jar $executable $ags
|
||||||
@@ -1,5 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
export CLASSPATH="$DIR/../target/*:$DIR/../target/lib/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/objc/ObjcPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/objc -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc"
|
||||||
|
|
||||||
|
java -DappName=PetstoreClient $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/wordnik-api/objc/ObjcWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l objc -o samples/client/wordnik/objc"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
31
bin/perl-petstore.sh
Executable file
31
bin/perl-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l perl -o samples/client/petstore/perl"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/php/PHPPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/php -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l php -o samples/client/petstore/php"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/python/PythonPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/python -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l python -o samples/client/petstore/python"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/python3/Python3PetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/python3 -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l python3 -o samples/client/petstore/python3"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
31
bin/qt5-petstore.sh
Executable file
31
bin/qt5-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/qt5cpp -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l qt5cpp -o samples/client/petstore/qt5cpp"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/retrofit-petstore.sh
Executable file
31
bin/retrofit-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/retrofit -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l retrofit -o samples/client/petstore/retrofit"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
5
bin/ruby-petstore.json
Normal file
5
bin/ruby-petstore.json
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"gemName": "petstore",
|
||||||
|
"moduleName": "Petstore",
|
||||||
|
"gemVersion": "1.0.0"
|
||||||
|
}
|
||||||
@@ -1,19 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
echo "" > classpath.txt
|
SCRIPT="$0"
|
||||||
for file in `ls target/lib`;
|
|
||||||
do echo -n 'target/lib/' >> classpath.txt;
|
while [ -h "$SCRIPT" ] ; do
|
||||||
echo -n $file >> classpath.txt;
|
ls=`ls -ld "$SCRIPT"`
|
||||||
echo -n ':' >> classpath.txt;
|
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||||
|
if expr "$link" : '/.*' > /dev/null; then
|
||||||
|
SCRIPT="$link"
|
||||||
|
else
|
||||||
|
SCRIPT=`dirname "$SCRIPT"`/"$link"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
for file in `ls target/*.jar`;
|
if [ ! -d "${APP_DIR}" ]; then
|
||||||
do echo -n '' >> classpath.txt;
|
APP_DIR=`dirname "$SCRIPT"`/..
|
||||||
echo -n $file >> classpath.txt;
|
APP_DIR=`cd "${APP_DIR}"; pwd`
|
||||||
echo -n ':' >> classpath.txt;
|
fi
|
||||||
done
|
|
||||||
export CLASSPATH=$(cat classpath.txt)
|
|
||||||
|
|
||||||
|
executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"
|
||||||
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
if [ ! -f "$executable" ]
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/ruby/RubyPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
then
|
||||||
|
mvn clean package
|
||||||
|
fi
|
||||||
|
|
||||||
|
# if you've executed sbt assembly previously it will use that instead.
|
||||||
|
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/ruby -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l ruby -c bin/ruby-petstore.json -o samples/client/petstore/ruby"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -DXmx4096M"
|
|
||||||
scala $WORDNIK_OPTS -cp $CLASSPATH "$@"
|
|
||||||
|
|
||||||
31
bin/scala-async-petstore.sh
Executable file
31
bin/scala-async-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/asyncscala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l async-scala -o samples/client/petstore/async-scala"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/petstore/scala/ScalaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/resources.json special-key
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scala -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scala -o samples/client/petstore/scala"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
@@ -1,6 +1,31 @@
|
|||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
SCRIPT="$0"
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties -DfileMap=samples/client/wordnik-api/spec-files"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH "$@" samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json
|
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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l scala -o samples/client/wordnik/scala"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
|
|||||||
31
bin/scalatra-petstore-server.sh
Executable file
31
bin/scalatra-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/scalatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scalatra -o samples/server/petstore/scalatra"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/silex-petstore-server.sh
Executable file
31
bin/silex-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/silex -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l silex -o samples/server/petstore/silex"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/sinatra-petstore-server.sh
Executable file
31
bin/sinatra-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/sinatra -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l sinatra -o samples/server/petstore/sinatra"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/spring-mvc-petstore-server.sh
Executable file
31
bin/spring-mvc-petstore-server.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaSpringMVC -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l spring-mvc -o samples/server/petstore/spring-mvc"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
4
bin/swift-petstore.json
Normal file
4
bin/swift-petstore.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"projectName": "PetstoreClient",
|
||||||
|
"responseAs": "PromiseKit"
|
||||||
|
}
|
||||||
31
bin/swift-petstore.sh
Executable file
31
bin/swift-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/swift -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l swift -c ./bin/swift-petstore.json -o samples/client/petstore/swift"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/tizen-petstore.sh
Executable file
31
bin/tizen-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -t modules/swagger-codegen/src/main/resources/tizen -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l tizen -o samples/client/petstore/tizen"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/typescript-angular-petstore.sh
Executable file
31
bin/typescript-angular-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-angular -o samples/client/petstore/typescript-angular"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
31
bin/typescript-node-petstore.sh
Executable file
31
bin/typescript-node-petstore.sh
Executable file
@@ -0,0 +1,31 @@
|
|||||||
|
#!/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/swagger-codegen-cli/target/swagger-codegen-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} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
|
||||||
|
ags="$@ generate -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l typescript-node -o samples/client/petstore/typescript-node"
|
||||||
|
|
||||||
|
java $JAVA_OPTS -jar $executable $ags
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
export CLASSPATH="$DIR/../target/lib/*:$DIR/../target/*"
|
|
||||||
export JAVA_OPTS="${JAVA_OPTS} -Xmx1024M -DloggerPath=conf/log4j.properties"
|
|
||||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS -cp $CLASSPATH com.wordnik.swagger.codegen.spec.Validator "$@"
|
|
||||||
102
modules/swagger-codegen-cli/pom.xml
Normal file
102
modules/swagger-codegen-cli/pom.xml
Normal file
@@ -0,0 +1,102 @@
|
|||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-codegen-project</artifactId>
|
||||||
|
<version>2.1.3</version>
|
||||||
|
<relativePath>../..</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>swagger-codegen-cli</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
|
<name>swagger-codegen (executable)</name>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<finalName>swagger-codegen-cli</finalName>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>logback.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifest>
|
||||||
|
<mainClass>io.swagger.codegen.SwaggerCodegen</mainClass>
|
||||||
|
</manifest>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>process-resources</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>shade</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<minimizeJar>false</minimizeJar>
|
||||||
|
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||||
|
<dependencyReducedPomLocation>
|
||||||
|
${java.io.tmpdir}/dependency-reduced-pom.xml
|
||||||
|
</dependencyReducedPomLocation>
|
||||||
|
<transformers>
|
||||||
|
<transformer
|
||||||
|
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
||||||
|
</transformers>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-codegen</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!--https://github.com/airlift/airline-->
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.airlift</groupId>
|
||||||
|
<artifactId>airline</artifactId>
|
||||||
|
<version>0.7</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.googlecode.lambdaj</groupId>
|
||||||
|
<artifactId>lambdaj</artifactId>
|
||||||
|
<version>2.3.3</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-simple</artifactId>
|
||||||
|
<version>${slf4j-version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>${junit-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import io.airlift.airline.Cli;
|
||||||
|
import io.airlift.airline.Help;
|
||||||
|
import io.swagger.codegen.cmd.ConfigHelp;
|
||||||
|
import io.swagger.codegen.cmd.Generate;
|
||||||
|
import io.swagger.codegen.cmd.Langs;
|
||||||
|
import io.swagger.codegen.cmd.Meta;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: lanwen
|
||||||
|
* Date: 24.03.15
|
||||||
|
* Time: 17:56
|
||||||
|
* <p>
|
||||||
|
* Command line interface for swagger codegen
|
||||||
|
* use `swagger-codegen-cli.jar help` for more info
|
||||||
|
*
|
||||||
|
* @since 2.1.3-M1
|
||||||
|
*/
|
||||||
|
public class SwaggerCodegen {
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
Cli.CliBuilder<Runnable> builder = Cli.<Runnable>builder("swagger")
|
||||||
|
.withDescription("Swagger code generator CLI. More info on swagger.io")
|
||||||
|
.withDefaultCommand(Langs.class)
|
||||||
|
.withCommands(
|
||||||
|
Generate.class,
|
||||||
|
Meta.class,
|
||||||
|
Langs.class,
|
||||||
|
Help.class,
|
||||||
|
ConfigHelp.class
|
||||||
|
);
|
||||||
|
|
||||||
|
builder.build().parse(args).run();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package io.swagger.codegen.cmd;
|
||||||
|
|
||||||
|
import io.airlift.airline.Command;
|
||||||
|
import io.airlift.airline.Option;
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
import static java.util.ServiceLoader.load;
|
||||||
|
|
||||||
|
@Command(name = "config-help", description = "Config help for chosen lang")
|
||||||
|
public class ConfigHelp implements Runnable {
|
||||||
|
|
||||||
|
@Option(name = {"-l", "--lang"}, title = "language", required = true,
|
||||||
|
description = "language to get config help for")
|
||||||
|
private String lang;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to load config class with SPI first, then with class name directly from classpath
|
||||||
|
*
|
||||||
|
* @param name name of config, or full qualified class name in classpath
|
||||||
|
* @return config class
|
||||||
|
*/
|
||||||
|
private static CodegenConfig forName(String name) {
|
||||||
|
ServiceLoader<CodegenConfig> loader = load(CodegenConfig.class);
|
||||||
|
for (CodegenConfig config : loader) {
|
||||||
|
if (config.getName().equals(name)) {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// else try to load directly
|
||||||
|
try {
|
||||||
|
return (CodegenConfig) Class.forName(name).newInstance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Can't load config class with name ".concat(name), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
System.out.println();
|
||||||
|
CodegenConfig config = forName(lang);
|
||||||
|
System.out.println("CONFIG OPTIONS");
|
||||||
|
for (CliOption langCliOption : config.cliOptions()) {
|
||||||
|
System.out.println("\t" + langCliOption.getOpt());
|
||||||
|
System.out.println("\t " + langCliOption.getDescription().replaceAll("\n", "\n\t "));
|
||||||
|
System.out.println();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,168 @@
|
|||||||
|
package io.swagger.codegen.cmd;
|
||||||
|
|
||||||
|
import config.Config;
|
||||||
|
import config.ConfigParser;
|
||||||
|
import io.airlift.airline.Command;
|
||||||
|
import io.airlift.airline.Option;
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
import io.swagger.codegen.ClientOptInput;
|
||||||
|
import io.swagger.codegen.ClientOpts;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.DefaultGenerator;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import io.swagger.parser.SwaggerParser;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
import static java.util.ServiceLoader.load;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: lanwen
|
||||||
|
* Date: 24.03.15
|
||||||
|
* Time: 20:22
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Command(name = "generate", description = "Generate code with chosen lang")
|
||||||
|
public class Generate implements Runnable {
|
||||||
|
|
||||||
|
public static final Logger LOG = LoggerFactory.getLogger(Generate.class);
|
||||||
|
|
||||||
|
public static final String TEMPLATE_DIR_PARAM = "templateDir";
|
||||||
|
|
||||||
|
@Option(name = {"-v", "--verbose"}, description = "verbose mode")
|
||||||
|
private boolean verbose;
|
||||||
|
|
||||||
|
@Option(name = {"-l", "--lang"}, title = "language", required = true,
|
||||||
|
description = "client language to generate (maybe class name in classpath, required)")
|
||||||
|
private String lang;
|
||||||
|
|
||||||
|
@Option(name = {"-o", "--output"}, title = "output directory",
|
||||||
|
description = "where to write the generated files (current dir by default)")
|
||||||
|
private String output = "";
|
||||||
|
|
||||||
|
@Option(name = {"-i", "--input-spec"}, title = "spec file", required = true,
|
||||||
|
description = "location of the swagger spec, as URL or file (required)")
|
||||||
|
private String spec;
|
||||||
|
|
||||||
|
@Option(name = {"-t", "--template-dir"}, title = "template directory",
|
||||||
|
description = "folder containing the template files")
|
||||||
|
private String templateDir;
|
||||||
|
|
||||||
|
@Option(name = {"-a", "--auth"}, title = "authorization",
|
||||||
|
description = "adds authorization headers when fetching the swagger definitions remotely. " +
|
||||||
|
"Pass in a URL-encoded string of name:header with a comma separating multiple values")
|
||||||
|
private String auth;
|
||||||
|
|
||||||
|
@Option(name = {"-D"}, title = "system properties", description = "sets specified system properties in " +
|
||||||
|
"the format of name=value,name=value")
|
||||||
|
private String systemProperties;
|
||||||
|
|
||||||
|
@Option(name = {"-c", "--config"}, title = "configuration file", description = "Path to json configuration file. " +
|
||||||
|
"File content should be in a json format {\"optionKey\":\"optionValue\", \"optionKey1\":\"optionValue1\"...} " +
|
||||||
|
"Supported options can be different for each language. Run config-help -l {lang} command for language specific config options.")
|
||||||
|
private String configFile;
|
||||||
|
|
||||||
|
@Option(name = {"-s", "--skip-overwrite"}, title = "skip overwrite", description = "specifies if the existing files should be " +
|
||||||
|
"overwritten during the generation.")
|
||||||
|
private boolean skipOverwrite;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to load config class with SPI first, then with class name directly from classpath
|
||||||
|
*
|
||||||
|
* @param name name of config, or full qualified class name in classpath
|
||||||
|
* @return config class
|
||||||
|
*/
|
||||||
|
private static CodegenConfig forName(String name) {
|
||||||
|
ServiceLoader<CodegenConfig> loader = load(CodegenConfig.class);
|
||||||
|
for (CodegenConfig config : loader) {
|
||||||
|
if (config.getName().equals(name)) {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// else try to load directly
|
||||||
|
try {
|
||||||
|
return (CodegenConfig) Class.forName(name).newInstance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Can't load config class with name ".concat(name), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
verbosed(verbose);
|
||||||
|
|
||||||
|
setSystemProperties();
|
||||||
|
|
||||||
|
ClientOptInput input = new ClientOptInput();
|
||||||
|
|
||||||
|
if (isNotEmpty(auth)) {
|
||||||
|
input.setAuth(auth);
|
||||||
|
}
|
||||||
|
|
||||||
|
CodegenConfig config = forName(lang);
|
||||||
|
config.setOutputDir(new File(output).getAbsolutePath());
|
||||||
|
|
||||||
|
if (null != templateDir) {
|
||||||
|
config.additionalProperties().put(TEMPLATE_DIR_PARAM, new File(templateDir).getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != configFile) {
|
||||||
|
Config genConfig = ConfigParser.read(configFile);
|
||||||
|
if (null != genConfig) {
|
||||||
|
for (CliOption langCliOption : config.cliOptions()) {
|
||||||
|
String opt = langCliOption.getOpt();
|
||||||
|
if (genConfig.hasOption(opt)) {
|
||||||
|
config.additionalProperties().put(opt, genConfig.getOption(opt));
|
||||||
|
// the "library" config option is for library template (sub-template)
|
||||||
|
if ("library".equals(opt)) {
|
||||||
|
config.setLibrary(genConfig.getOption(opt));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.setSkipOverwrite(skipOverwrite);
|
||||||
|
input.setConfig(config);
|
||||||
|
|
||||||
|
Swagger swagger = new SwaggerParser().read(spec, input.getAuthorizationValues(), true);
|
||||||
|
new DefaultGenerator().opts(input.opts(new ClientOpts()).swagger(swagger)).generate();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setSystemProperties() {
|
||||||
|
if (systemProperties != null && systemProperties.length() > 0) {
|
||||||
|
for (String property : systemProperties.split(",")) {
|
||||||
|
int ix = property.indexOf('=');
|
||||||
|
if (ix > 0 && ix < property.length() - 1) {
|
||||||
|
System.setProperty(property.substring(0, ix), property.substring(ix + 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true parameter, adds system properties which enables debug mode in generator
|
||||||
|
*
|
||||||
|
* @param verbose - if true, enables debug mode
|
||||||
|
*/
|
||||||
|
private void verbosed(boolean verbose) {
|
||||||
|
if (!verbose) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
LOG.info("\nVERBOSE MODE: ON. Additional debug options are injected" +
|
||||||
|
"\n - [debugSwagger] prints the swagger specification as interpreted by the codegen" +
|
||||||
|
"\n - [debugModels] prints models passed to the template engine" +
|
||||||
|
"\n - [debugOperations] prints operations passed to the template engine" +
|
||||||
|
"\n - [debugSupportingFiles] prints additional data passed to the template engine");
|
||||||
|
|
||||||
|
System.setProperty("debugSwagger", "");
|
||||||
|
System.setProperty("debugModels", "");
|
||||||
|
System.setProperty("debugOperations", "");
|
||||||
|
System.setProperty("debugSupportingFiles", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package io.swagger.codegen.cmd;
|
||||||
|
|
||||||
|
import ch.lambdaj.collection.LambdaIterable;
|
||||||
|
import io.airlift.airline.Command;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
|
||||||
|
import static ch.lambdaj.Lambda.on;
|
||||||
|
import static ch.lambdaj.collection.LambdaCollections.with;
|
||||||
|
import static java.util.ServiceLoader.load;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: lanwen
|
||||||
|
* Date: 24.03.15
|
||||||
|
* Time: 20:25
|
||||||
|
*/
|
||||||
|
@Command(name = "langs", description = "Shows available langs")
|
||||||
|
public class Langs implements Runnable {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
LambdaIterable<String> langs = with(load(CodegenConfig.class)).extract(on(CodegenConfig.class).getName());
|
||||||
|
System.out.printf("Available languages: %s%n", langs);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,147 @@
|
|||||||
|
package io.swagger.codegen.cmd;
|
||||||
|
|
||||||
|
import ch.lambdaj.function.convert.Converter;
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
import com.samskivert.mustache.Mustache;
|
||||||
|
import io.airlift.airline.Command;
|
||||||
|
import io.airlift.airline.Option;
|
||||||
|
import io.swagger.codegen.DefaultGenerator;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static ch.lambdaj.collection.LambdaCollections.with;
|
||||||
|
import static com.google.common.base.Joiner.on;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: lanwen
|
||||||
|
* Date: 24.03.15
|
||||||
|
* Time: 20:22
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Command(name = "meta", description = "MetaGenerator. Generator for creating a new template set " +
|
||||||
|
"and configuration for Codegen. The output will be based on the language you " +
|
||||||
|
"specify, and includes default templates to include.")
|
||||||
|
public class Meta implements Runnable {
|
||||||
|
|
||||||
|
private static final Logger LOG = LoggerFactory.getLogger(Meta.class);
|
||||||
|
|
||||||
|
private static final String TEMPLATE_DIR_CLASSPATH = "codegen";
|
||||||
|
private static final String MUSTACHE_EXTENSION = ".mustache";
|
||||||
|
|
||||||
|
@Option(name = {"-o", "--output"}, title = "output directory",
|
||||||
|
description = "where to write the generated files (current dir by default)")
|
||||||
|
private String outputFolder = "";
|
||||||
|
|
||||||
|
@Option(name = {"-n", "--name"}, title = "name",
|
||||||
|
description = "the human-readable name of the generator")
|
||||||
|
private String name = "default";
|
||||||
|
|
||||||
|
@Option(name = {"-p", "--package"}, title = "package",
|
||||||
|
description = "the package to put the main class into (defaults to io.swagger.codegen)")
|
||||||
|
private String targetPackage = "io.swagger.codegen";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
final File targetDir = new File(outputFolder);
|
||||||
|
LOG.info("writing to folder [{}]", targetDir.getAbsolutePath());
|
||||||
|
|
||||||
|
String mainClass = StringUtils.capitalize(name) + "Generator";
|
||||||
|
|
||||||
|
List<SupportingFile> supportingFiles = ImmutableList.of(
|
||||||
|
new SupportingFile("pom.mustache", "", "pom.xml"),
|
||||||
|
new SupportingFile("generatorClass.mustache",
|
||||||
|
on(File.separator).join("src/main/java", asPath(targetPackage)), mainClass.concat(".java")),
|
||||||
|
new SupportingFile("README.mustache", "", "README.md"),
|
||||||
|
new SupportingFile("api.template", "src/main/resources" + File.separator + name, "api.mustache"),
|
||||||
|
new SupportingFile("model.template", "src/main/resources" + File.separator + name, "model.mustache"),
|
||||||
|
new SupportingFile("services.mustache",
|
||||||
|
"src/main/resources/META-INF/services", "io.swagger.codegen.CodegenConfig")
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, Object> data = new ImmutableMap.Builder<String, Object>()
|
||||||
|
.put("generatorPackage", targetPackage)
|
||||||
|
.put("generatorClass", mainClass)
|
||||||
|
.put("name", name)
|
||||||
|
.put("fullyQualifiedGeneratorClass", targetPackage + "." + mainClass).build();
|
||||||
|
|
||||||
|
|
||||||
|
with(supportingFiles).convert(processFiles(targetDir, data));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converter method to process supporting files: execute with mustache,
|
||||||
|
* or simply copy to destination directory
|
||||||
|
*
|
||||||
|
* @param targetDir - destination directory
|
||||||
|
* @param data - map with additional params needed to process templates
|
||||||
|
* @return converter object to pass to lambdaj
|
||||||
|
*/
|
||||||
|
private Converter<SupportingFile, File> processFiles(final File targetDir, final Map<String, Object> data) {
|
||||||
|
return new Converter<SupportingFile, File>() {
|
||||||
|
private DefaultGenerator generator = new DefaultGenerator();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File convert(SupportingFile support) {
|
||||||
|
try {
|
||||||
|
File destinationFolder = new File(new File(targetDir.getAbsolutePath()), support.folder);
|
||||||
|
File outputFile = new File(destinationFolder, support.destinationFilename);
|
||||||
|
|
||||||
|
String template = generator
|
||||||
|
.readTemplate(new File(TEMPLATE_DIR_CLASSPATH, support.templateFile).getPath());
|
||||||
|
String formatted = template;
|
||||||
|
|
||||||
|
if (support.templateFile.endsWith(MUSTACHE_EXTENSION)) {
|
||||||
|
LOG.info("writing file to {}", outputFile.getAbsolutePath());
|
||||||
|
formatted = Mustache.compiler().withLoader(loader(generator))
|
||||||
|
.defaultValue("")
|
||||||
|
.compile(template)
|
||||||
|
.execute(data);
|
||||||
|
} else {
|
||||||
|
LOG.info("copying file to {}", outputFile.getAbsolutePath());
|
||||||
|
}
|
||||||
|
|
||||||
|
FileUtils.writeStringToFile(outputFile, formatted);
|
||||||
|
return outputFile;
|
||||||
|
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new RuntimeException("Can't generate project", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates mustache loader for template using classpath loader
|
||||||
|
*
|
||||||
|
* @param generator - class with reader getter
|
||||||
|
* @return loader for template
|
||||||
|
*/
|
||||||
|
private Mustache.TemplateLoader loader(final DefaultGenerator generator) {
|
||||||
|
return new Mustache.TemplateLoader() {
|
||||||
|
public Reader getTemplate(String name) {
|
||||||
|
return generator.getTemplateReader(TEMPLATE_DIR_CLASSPATH
|
||||||
|
+ File.separator + name.concat(MUSTACHE_EXTENSION));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts package name to path on file system
|
||||||
|
*
|
||||||
|
* @param packageName - package name to convert
|
||||||
|
* @return relative path
|
||||||
|
*/
|
||||||
|
private String asPath(String packageName) {
|
||||||
|
return packageName.replace(".", File.separator);
|
||||||
|
}
|
||||||
|
}
|
||||||
12
modules/swagger-codegen-cli/src/main/resources/logback.xml
Normal file
12
modules/swagger-codegen-cli/src/main/resources/logback.xml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<configuration>
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<layout class="ch.qos.logback.classic.PatternLayout">
|
||||||
|
<Pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</Pattern>
|
||||||
|
</layout>
|
||||||
|
</appender>
|
||||||
|
<logger name="io.swagger" level="debug"/>
|
||||||
|
<root level="error">
|
||||||
|
<appender-ref ref="STDOUT"/>
|
||||||
|
</root>
|
||||||
|
</configuration>
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.junit.Rule;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.rules.TemporaryFolder;
|
||||||
|
|
||||||
|
import static java.nio.charset.StandardCharsets.UTF_8;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
public class GenerateTest {
|
||||||
|
|
||||||
|
private static final String TEST_SKIP_OVERWRITE = "testSkipOverwrite";
|
||||||
|
private static final String POM_FILE = "pom.xml";
|
||||||
|
private static final String MODEL_ORDER_FILE = "/src/main/java/io/swagger/client/model/Order.java";
|
||||||
|
|
||||||
|
@Rule
|
||||||
|
public TemporaryFolder folder = new TemporaryFolder();
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSkipOverwrite() throws IOException {
|
||||||
|
final File output = folder.getRoot();
|
||||||
|
|
||||||
|
String[] args = {"generate", "-i", "src/test/resources/petstore.json", "-l", "java", "-o", output.getAbsolutePath()};
|
||||||
|
String[] argsWithSparam = Arrays.copyOf(args, args.length + 1);
|
||||||
|
argsWithSparam[args.length] = "-s";
|
||||||
|
|
||||||
|
//generate content first time without -s flag, so all generated files should be recorded
|
||||||
|
SwaggerCodegen.main(args);
|
||||||
|
final File order = new File(output, MODEL_ORDER_FILE);
|
||||||
|
assertTrue(order.exists());
|
||||||
|
|
||||||
|
//change content of one file
|
||||||
|
changeContent(order);
|
||||||
|
|
||||||
|
//generate content second time without -s flag, so changed file should be rewritten
|
||||||
|
SwaggerCodegen.main(args);
|
||||||
|
//order = new File(output, MODEL_ORDER_FILE);
|
||||||
|
assertTrue(!TEST_SKIP_OVERWRITE.equals(FileUtils.readFileToString(order, StandardCharsets.UTF_8)));
|
||||||
|
|
||||||
|
//change content again
|
||||||
|
changeContent(order);
|
||||||
|
//delete file
|
||||||
|
final File pom = new File(output, POM_FILE);
|
||||||
|
if (!pom.delete()) {
|
||||||
|
fail();
|
||||||
|
}
|
||||||
|
|
||||||
|
//generate content third time with -s flag, so changed file should not be rewritten
|
||||||
|
//and deleted file should be recorded
|
||||||
|
SwaggerCodegen.main(argsWithSparam);
|
||||||
|
assertEquals(FileUtils.readFileToString(order, StandardCharsets.UTF_8), TEST_SKIP_OVERWRITE);
|
||||||
|
assertTrue(pom.exists());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void changeContent(File file) throws IOException {
|
||||||
|
Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), UTF_8));
|
||||||
|
out.write(TEST_SKIP_OVERWRITE);
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
977
modules/swagger-codegen-cli/src/test/resources/petstore.json
Normal file
977
modules/swagger-codegen-cli/src/test/resources/petstore.json
Normal file
@@ -0,0 +1,977 @@
|
|||||||
|
{
|
||||||
|
"swagger": "2.0",
|
||||||
|
"info": {
|
||||||
|
"description": "This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"title": "Swagger Petstore",
|
||||||
|
"termsOfService": "http://swagger.io/terms/",
|
||||||
|
"contact": {
|
||||||
|
"email": "apiteam@swagger.io"
|
||||||
|
},
|
||||||
|
"license": {
|
||||||
|
"name": "Apache 2.0",
|
||||||
|
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"host": "petstore.swagger.io",
|
||||||
|
"basePath": "/v2",
|
||||||
|
"schemes": [
|
||||||
|
"http"
|
||||||
|
],
|
||||||
|
"paths": {
|
||||||
|
"/pet": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "Add a new pet to the store",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "addPet",
|
||||||
|
"consumes": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "Pet object that needs to be added to the store",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Pet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"405": {
|
||||||
|
"description": "Invalid input"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "Update an existing pet",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "updatePet",
|
||||||
|
"consumes": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "Pet object that needs to be added to the store",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Pet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"405": {
|
||||||
|
"description": "Validation exception"
|
||||||
|
},
|
||||||
|
"404": {
|
||||||
|
"description": "Pet not found"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid ID supplied"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/pet/findByStatus": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "Finds Pets by status",
|
||||||
|
"description": "Multiple status values can be provided with comma seperated strings",
|
||||||
|
"operationId": "findPetsByStatus",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "status",
|
||||||
|
"in": "query",
|
||||||
|
"description": "Status values that need to be considered for filter",
|
||||||
|
"required": false,
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"collectionFormat": "multi",
|
||||||
|
"default": "available"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/Pet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid status value"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/pet/findByTags": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "Finds Pets by tags",
|
||||||
|
"description": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
|
||||||
|
"operationId": "findPetsByTags",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "tags",
|
||||||
|
"in": "query",
|
||||||
|
"description": "Tags to filter by",
|
||||||
|
"required": false,
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"collectionFormat": "multi"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/Pet"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid tag value"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/pet/{petId}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "Find pet by ID",
|
||||||
|
"description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
|
||||||
|
"operationId": "getPetById",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "petId",
|
||||||
|
"in": "path",
|
||||||
|
"description": "ID of pet that needs to be fetched",
|
||||||
|
"required": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"404": {
|
||||||
|
"description": "Pet not found"
|
||||||
|
},
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Pet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid ID supplied"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"api_key": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "Updates a pet in the store with form data",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "updatePetWithForm",
|
||||||
|
"consumes": [
|
||||||
|
"application/x-www-form-urlencoded"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "petId",
|
||||||
|
"in": "path",
|
||||||
|
"description": "ID of pet that needs to be updated",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "name",
|
||||||
|
"in": "formData",
|
||||||
|
"description": "Updated name of the pet",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "status",
|
||||||
|
"in": "formData",
|
||||||
|
"description": "Updated status of the pet",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"405": {
|
||||||
|
"description": "Invalid input"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "Deletes a pet",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "deletePet",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "api_key",
|
||||||
|
"in": "header",
|
||||||
|
"description": "",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "petId",
|
||||||
|
"in": "path",
|
||||||
|
"description": "Pet id to delete",
|
||||||
|
"required": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid pet value"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/pet/{petId}/uploadImage": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"pet"
|
||||||
|
],
|
||||||
|
"summary": "uploads an image",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "uploadFile",
|
||||||
|
"consumes": [
|
||||||
|
"multipart/form-data"
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "petId",
|
||||||
|
"in": "path",
|
||||||
|
"description": "ID of pet to update",
|
||||||
|
"required": true,
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "additionalMetadata",
|
||||||
|
"in": "formData",
|
||||||
|
"description": "Additional data to pass to server",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "file",
|
||||||
|
"in": "formData",
|
||||||
|
"description": "file to upload",
|
||||||
|
"required": false,
|
||||||
|
"type": "file"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"default": {
|
||||||
|
"description": "successful operation"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"petstore_auth": [
|
||||||
|
"write:pets",
|
||||||
|
"read:pets"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/store/inventory": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"store"
|
||||||
|
],
|
||||||
|
"summary": "Returns pet inventories by status",
|
||||||
|
"description": "Returns a map of status codes to quantities",
|
||||||
|
"operationId": "getInventory",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"api_key": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/store/order": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"store"
|
||||||
|
],
|
||||||
|
"summary": "Place an order for a pet",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "placeOrder",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "order placed for purchasing the pet",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Order"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Order"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid Order"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/store/order/{orderId}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"store"
|
||||||
|
],
|
||||||
|
"summary": "Find purchase order by ID",
|
||||||
|
"description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
|
||||||
|
"operationId": "getOrderById",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "orderId",
|
||||||
|
"in": "path",
|
||||||
|
"description": "ID of pet that needs to be fetched",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"404": {
|
||||||
|
"description": "Order not found"
|
||||||
|
},
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/Order"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid ID supplied"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"store"
|
||||||
|
],
|
||||||
|
"summary": "Delete purchase order by ID",
|
||||||
|
"description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
|
||||||
|
"operationId": "deleteOrder",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "orderId",
|
||||||
|
"in": "path",
|
||||||
|
"description": "ID of the order that needs to be deleted",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"404": {
|
||||||
|
"description": "Order not found"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid ID supplied"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/user": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Create user",
|
||||||
|
"description": "This can only be done by the logged in user.",
|
||||||
|
"operationId": "createUser",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "Created user object",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"default": {
|
||||||
|
"description": "successful operation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/user/createWithArray": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Creates list of users with given input array",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "createUsersWithArrayInput",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "List of user object",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"default": {
|
||||||
|
"description": "successful operation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/user/createWithList": {
|
||||||
|
"post": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Creates list of users with given input array",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "createUsersWithListInput",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "List of user object",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"default": {
|
||||||
|
"description": "successful operation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/user/login": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Logs user into the system",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "loginUser",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "username",
|
||||||
|
"in": "query",
|
||||||
|
"description": "The user name for login",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "password",
|
||||||
|
"in": "query",
|
||||||
|
"description": "The password for login in clear text",
|
||||||
|
"required": false,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid username/password supplied"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/user/logout": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Logs out current logged in user session",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "logoutUser",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"default": {
|
||||||
|
"description": "successful operation"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/user/{username}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Get user by user name",
|
||||||
|
"description": "",
|
||||||
|
"operationId": "getUserByName",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "username",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The name that needs to be fetched. Use user1 for testing. ",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"404": {
|
||||||
|
"description": "User not found"
|
||||||
|
},
|
||||||
|
"200": {
|
||||||
|
"description": "successful operation",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/User"
|
||||||
|
},
|
||||||
|
"examples": {
|
||||||
|
"application/json": {
|
||||||
|
"id": 1,
|
||||||
|
"username": "johnp",
|
||||||
|
"firstName": "John",
|
||||||
|
"lastName": "Public",
|
||||||
|
"email": "johnp@swagger.io",
|
||||||
|
"password": "-secret-",
|
||||||
|
"phone": "0123456789",
|
||||||
|
"userStatus": 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid username supplied"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"put": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Updated user",
|
||||||
|
"description": "This can only be done by the logged in user.",
|
||||||
|
"operationId": "updateUser",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "username",
|
||||||
|
"in": "path",
|
||||||
|
"description": "name that need to be deleted",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"in": "body",
|
||||||
|
"name": "body",
|
||||||
|
"description": "Updated user object",
|
||||||
|
"required": false,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/User"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"404": {
|
||||||
|
"description": "User not found"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid user supplied"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"delete": {
|
||||||
|
"tags": [
|
||||||
|
"user"
|
||||||
|
],
|
||||||
|
"summary": "Delete user",
|
||||||
|
"description": "This can only be done by the logged in user.",
|
||||||
|
"operationId": "deleteUser",
|
||||||
|
"produces": [
|
||||||
|
"application/json",
|
||||||
|
"application/xml"
|
||||||
|
],
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "username",
|
||||||
|
"in": "path",
|
||||||
|
"description": "The name that needs to be deleted",
|
||||||
|
"required": true,
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"404": {
|
||||||
|
"description": "User not found"
|
||||||
|
},
|
||||||
|
"400": {
|
||||||
|
"description": "Invalid username supplied"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"securityDefinitions": {
|
||||||
|
"api_key": {
|
||||||
|
"type": "apiKey",
|
||||||
|
"name": "api_key",
|
||||||
|
"in": "header"
|
||||||
|
},
|
||||||
|
"petstore_auth": {
|
||||||
|
"type": "oauth2",
|
||||||
|
"authorizationUrl": "http://petstore.swagger.io/api/oauth/dialog",
|
||||||
|
"flow": "implicit",
|
||||||
|
"scopes": {
|
||||||
|
"write:pets": "modify pets in your account",
|
||||||
|
"read:pets": "read your pets"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"definitions": {
|
||||||
|
"User": {
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"username": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"firstName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"lastName": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"email": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"password": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"phone": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"userStatus": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32",
|
||||||
|
"description": "User Status"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml": {
|
||||||
|
"name": "User"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Category": {
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml": {
|
||||||
|
"name": "Category"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Pet": {
|
||||||
|
"required": [
|
||||||
|
"name",
|
||||||
|
"photoUrls"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"category": {
|
||||||
|
"$ref": "#/definitions/Category"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"example": "doggie"
|
||||||
|
},
|
||||||
|
"photoUrls": {
|
||||||
|
"type": "array",
|
||||||
|
"xml": {
|
||||||
|
"name": "photoUrl",
|
||||||
|
"wrapped": true
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"type": "array",
|
||||||
|
"xml": {
|
||||||
|
"name": "tag",
|
||||||
|
"wrapped": true
|
||||||
|
},
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/Tag"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "pet status in the store",
|
||||||
|
"enum": [
|
||||||
|
"available",
|
||||||
|
"pending",
|
||||||
|
"sold"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml": {
|
||||||
|
"name": "Pet"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Tag": {
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml": {
|
||||||
|
"name": "Tag"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Order": {
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"petId": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int64"
|
||||||
|
},
|
||||||
|
"quantity": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"shipDate": {
|
||||||
|
"type": "string",
|
||||||
|
"format": "date-time"
|
||||||
|
},
|
||||||
|
"status": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Order Status",
|
||||||
|
"enum": [
|
||||||
|
"placed",
|
||||||
|
"approved",
|
||||||
|
"delivered"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"complete": {
|
||||||
|
"type": "boolean"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"xml": {
|
||||||
|
"name": "Order"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
55
modules/swagger-codegen-maven-plugin/README.md
Normal file
55
modules/swagger-codegen-maven-plugin/README.md
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
swagger-codegen-maven-plugin
|
||||||
|
============================
|
||||||
|
|
||||||
|
A Maven plugin to support the [swagger](http://swagger.io) code generation project
|
||||||
|
|
||||||
|
Usage
|
||||||
|
============================
|
||||||
|
|
||||||
|
Add to your `build->plugins` section (default phase is `generate-sources` phase)
|
||||||
|
```xml
|
||||||
|
<plugin>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-codegen-maven-plugin</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>generate</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<inputSpec>src/main/resources/api.yaml</inputSpec>
|
||||||
|
<language>java</language>
|
||||||
|
<configOptions>
|
||||||
|
<sourceFolder>src/gen/java/main</sourceFolder>
|
||||||
|
</configOptions>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
```
|
||||||
|
|
||||||
|
Followed by:
|
||||||
|
|
||||||
|
```
|
||||||
|
mvn clean compile
|
||||||
|
```
|
||||||
|
|
||||||
|
### General Configuration parameters
|
||||||
|
|
||||||
|
- `inputSpec` - swagger spec file path
|
||||||
|
- `language` - target generation language
|
||||||
|
- `output` - target output path (default is `${project.build.directory}/generated-sources/swagger`)
|
||||||
|
- `templateDirectory` - directory with mustache templates
|
||||||
|
- `addCompileSourceRoot` - add the output directory to the project as a source root (`true` by default)
|
||||||
|
- `modelPackage` - the package to use for generated model objects/classes
|
||||||
|
- `apiPackage` - the package to use for generated api objects/classes
|
||||||
|
- `invokerPackage` - the package to use for the generated invoker objects
|
||||||
|
- `configOptions` - a map of language-specific parameters (see below)
|
||||||
|
|
||||||
|
### Java-specific parameters (under configOptions)
|
||||||
|
|
||||||
|
- `sourceFolder` - the folder to use for generated sources under the output folder
|
||||||
|
- `groupId` - groupId in generated pom.xml
|
||||||
|
- `artifactId` - artifactId in generated pom.xml
|
||||||
|
- `artifactVersion` - artifact version in generated pom.xml
|
||||||
87
modules/swagger-codegen-maven-plugin/pom.xml
Normal file
87
modules/swagger-codegen-maven-plugin/pom.xml
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-codegen-project</artifactId>
|
||||||
|
<version>2.1.3</version>
|
||||||
|
<relativePath>../..</relativePath>
|
||||||
|
</parent>
|
||||||
|
<artifactId>swagger-codegen-maven-plugin</artifactId>
|
||||||
|
<name>swagger-codegen (maven-plugin)</name>
|
||||||
|
<packaging>maven-plugin</packaging>
|
||||||
|
<description>maven plugin to build modules from swagger codegen</description>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-core</artifactId>
|
||||||
|
<version>3.2.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-artifact</artifactId>
|
||||||
|
<version>3.2.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-compat</artifactId>
|
||||||
|
<version>3.2.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-api</artifactId>
|
||||||
|
<version>3.2.5</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven.plugin-tools</groupId>
|
||||||
|
<artifactId>maven-plugin-annotations</artifactId>
|
||||||
|
<version>3.4</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-codegen</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>4.12</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-plugin-plugin</artifactId>
|
||||||
|
<version>3.4</version>
|
||||||
|
<configuration>
|
||||||
|
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>mojo-descriptor</id>
|
||||||
|
<phase>process-classes</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>descriptor</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
<execution>
|
||||||
|
<id>help-goal</id>
|
||||||
|
<goals>
|
||||||
|
<goal>helpmojo</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
</project>
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package io.swagger.codegen.plugin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* User: lanwen
|
||||||
|
* Date: 24.03.15
|
||||||
|
* Time: 14:47
|
||||||
|
*/
|
||||||
|
public final class AdditionalParams {
|
||||||
|
public static final String TEMPLATE_DIR_PARAM = "templateDir";
|
||||||
|
public static final String MODEL_PACKAGE_PARAM = "modelPackage";
|
||||||
|
public static final String API_PACKAGE_PARAM = "apiPackage";
|
||||||
|
public static final String INVOKER_PACKAGE_PARAM = "invokerPackage";
|
||||||
|
|
||||||
|
private AdditionalParams() {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,186 @@
|
|||||||
|
package io.swagger.codegen.plugin;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright 2001-2005 The Apache Software Foundation.
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
import io.swagger.codegen.ClientOptInput;
|
||||||
|
import io.swagger.codegen.ClientOpts;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.DefaultGenerator;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import io.swagger.parser.SwaggerParser;
|
||||||
|
|
||||||
|
import org.apache.maven.plugin.AbstractMojo;
|
||||||
|
import org.apache.maven.plugin.MojoExecutionException;
|
||||||
|
import org.apache.maven.plugins.annotations.LifecyclePhase;
|
||||||
|
import org.apache.maven.plugins.annotations.Mojo;
|
||||||
|
import org.apache.maven.plugins.annotations.Parameter;
|
||||||
|
import org.apache.maven.project.MavenProject;
|
||||||
|
|
||||||
|
import config.Config;
|
||||||
|
import config.ConfigParser;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
import static io.swagger.codegen.plugin.AdditionalParams.API_PACKAGE_PARAM;
|
||||||
|
import static io.swagger.codegen.plugin.AdditionalParams.INVOKER_PACKAGE_PARAM;
|
||||||
|
import static io.swagger.codegen.plugin.AdditionalParams.MODEL_PACKAGE_PARAM;
|
||||||
|
import static io.swagger.codegen.plugin.AdditionalParams.TEMPLATE_DIR_PARAM;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Goal which generates client/server code from a swagger json/yaml definition.
|
||||||
|
*/
|
||||||
|
@Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES)
|
||||||
|
public class CodeGenMojo extends AbstractMojo {
|
||||||
|
/**
|
||||||
|
* Location of the output directory.
|
||||||
|
*/
|
||||||
|
@Parameter(name = "output",
|
||||||
|
property = "swagger.codegen.maven.plugin.output",
|
||||||
|
defaultValue = "${project.build.directory}/generated-sources/swagger")
|
||||||
|
private File output;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location of the swagger spec, as URL or file.
|
||||||
|
*/
|
||||||
|
@Parameter(name = "inputSpec", required = true)
|
||||||
|
private String inputSpec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Folder containing the template files.
|
||||||
|
*/
|
||||||
|
@Parameter(name = "templateDirectory")
|
||||||
|
private File templateDirectory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The package to use for generated model objects/classes
|
||||||
|
*/
|
||||||
|
@Parameter(name = "modelPackage")
|
||||||
|
private String modelPackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The package to use for generated api objects/classes
|
||||||
|
*/
|
||||||
|
@Parameter(name = "apiPackage")
|
||||||
|
private String apiPackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The package to use for the generated invoker objects
|
||||||
|
*/
|
||||||
|
@Parameter(name = "invokerPackage")
|
||||||
|
private String invokerPackage;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Client language to generate.
|
||||||
|
*/
|
||||||
|
@Parameter(name = "language", required = true)
|
||||||
|
private String language;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Path to separate json configuration file.
|
||||||
|
*/
|
||||||
|
@Parameter(name = "configurationFile", required = false)
|
||||||
|
private String configurationFile;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of language-specific parameters as passed with the -c option to the command line
|
||||||
|
*/
|
||||||
|
@Parameter(name = "configOptions")
|
||||||
|
private Map configOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the output directory to the project as a source root, so that the
|
||||||
|
* generated java types are compiled and included in the project artifact.
|
||||||
|
*/
|
||||||
|
@Parameter(defaultValue = "true")
|
||||||
|
private boolean addCompileSourceRoot = true;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The project being built.
|
||||||
|
*/
|
||||||
|
@Parameter(readonly = true, required = true, defaultValue = "${project}")
|
||||||
|
private MavenProject project;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void execute() throws MojoExecutionException {
|
||||||
|
Swagger swagger = new SwaggerParser().read(inputSpec);
|
||||||
|
|
||||||
|
CodegenConfig config = forName(language);
|
||||||
|
config.setOutputDir(output.getAbsolutePath());
|
||||||
|
|
||||||
|
if (null != templateDirectory) {
|
||||||
|
config.additionalProperties().put(TEMPLATE_DIR_PARAM, templateDirectory.getAbsolutePath());
|
||||||
|
}
|
||||||
|
if (null != modelPackage) {
|
||||||
|
config.additionalProperties().put(MODEL_PACKAGE_PARAM, modelPackage);
|
||||||
|
}
|
||||||
|
if (null != apiPackage) {
|
||||||
|
config.additionalProperties().put(API_PACKAGE_PARAM, apiPackage);
|
||||||
|
}
|
||||||
|
if (null != invokerPackage) {
|
||||||
|
config.additionalProperties().put(INVOKER_PACKAGE_PARAM, invokerPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (configOptions != null) {
|
||||||
|
for (CliOption langCliOption : config.cliOptions()) {
|
||||||
|
if (configOptions.containsKey(langCliOption.getOpt())) {
|
||||||
|
config.additionalProperties().put(langCliOption.getOpt(),
|
||||||
|
configOptions.get(langCliOption.getOpt()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != configurationFile) {
|
||||||
|
Config genConfig = ConfigParser.read(configurationFile);
|
||||||
|
if (null != genConfig) {
|
||||||
|
for (CliOption langCliOption : config.cliOptions()) {
|
||||||
|
if (genConfig.hasOption(langCliOption.getOpt())) {
|
||||||
|
config.additionalProperties().put(langCliOption.getOpt(), genConfig.getOption(langCliOption.getOpt()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException("Unable to read configuration file");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ClientOptInput input = new ClientOptInput().opts(new ClientOpts()).swagger(swagger);
|
||||||
|
input.setConfig(config);
|
||||||
|
new DefaultGenerator().opts(input).generate();
|
||||||
|
|
||||||
|
if (addCompileSourceRoot) {
|
||||||
|
project.addCompileSourceRoot(output.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private CodegenConfig forName(String name) {
|
||||||
|
ServiceLoader<CodegenConfig> loader = ServiceLoader.load(CodegenConfig.class);
|
||||||
|
for (CodegenConfig config : loader) {
|
||||||
|
if (config.getName().equals(name)) {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// else try to load directly
|
||||||
|
try {
|
||||||
|
return (CodegenConfig) Class.forName(name).newInstance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("Can't load config class with name ".concat(name), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
347
modules/swagger-codegen/pom.xml
Normal file
347
modules/swagger-codegen/pom.xml
Normal file
@@ -0,0 +1,347 @@
|
|||||||
|
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
<parent>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-codegen-project</artifactId>
|
||||||
|
<version>2.1.3</version>
|
||||||
|
<relativePath>../..</relativePath>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>swagger-codegen</artifactId>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<name>swagger-codegen (core library)</name>
|
||||||
|
<build>
|
||||||
|
<sourceDirectory>src/main/java</sourceDirectory>
|
||||||
|
<defaultGoal>install</defaultGoal>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>logback.xml</exclude>
|
||||||
|
</excludes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<extensions>
|
||||||
|
<extension>
|
||||||
|
<groupId>org.jvnet.wagon-svn</groupId>
|
||||||
|
<artifactId>wagon-svn</artifactId>
|
||||||
|
<version>1.8</version>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<groupId>org.apache.maven.wagon</groupId>
|
||||||
|
<artifactId>wagon-ssh-external</artifactId>
|
||||||
|
<version>1.0-alpha-6</version>
|
||||||
|
</extension>
|
||||||
|
<extension>
|
||||||
|
<groupId>org.apache.maven.wagon</groupId>
|
||||||
|
<artifactId>wagon-webdav</artifactId>
|
||||||
|
<version>1.0-beta-1</version>
|
||||||
|
</extension>
|
||||||
|
</extensions>
|
||||||
|
<directory>target</directory>
|
||||||
|
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>exec-maven-plugin</artifactId>
|
||||||
|
<version>1.3.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>java</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<mainClass>io.swagger.codegen.Codegen</mainClass>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-dependencies</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>${project.build.directory}/lib</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.alchim31.maven</groupId>
|
||||||
|
<artifactId>scala-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
<goal>compile</goal>
|
||||||
|
<goal>testCompile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<recompileMode>incremental</recompileMode>
|
||||||
|
<jvmArgs>
|
||||||
|
<jvmArg>-Xmx384m</jvmArg>
|
||||||
|
</jvmArgs>
|
||||||
|
<args>
|
||||||
|
<arg>-target:jvm-1.6</arg>
|
||||||
|
<arg>-deprecation</arg>
|
||||||
|
</args>
|
||||||
|
<launchers>
|
||||||
|
<launcher>
|
||||||
|
<id>run-scalatest</id>
|
||||||
|
<mainClass>org.scalatest.tools.Runner</mainClass>
|
||||||
|
<args>
|
||||||
|
<arg>-p</arg>
|
||||||
|
<arg>${project.build.testOutputDirectory}</arg>
|
||||||
|
</args>
|
||||||
|
<jvmArgs>
|
||||||
|
<jvmArg>-Xmx512m</jvmArg>
|
||||||
|
</jvmArgs>
|
||||||
|
</launcher>
|
||||||
|
</launchers>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<version>3.0</version>
|
||||||
|
<configuration>
|
||||||
|
<source>1.6</source>
|
||||||
|
<target>1.6</target>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.4</version>
|
||||||
|
<configuration>
|
||||||
|
<archive>
|
||||||
|
<manifestEntries>
|
||||||
|
<mode>development</mode>
|
||||||
|
<url>${project.url}</url>
|
||||||
|
<implementation-version>${project.version}</implementation-version>
|
||||||
|
<package>io.swagger</package>
|
||||||
|
</manifestEntries>
|
||||||
|
</archive>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-release-plugin</artifactId>
|
||||||
|
<version>2.1</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.alchim31.maven</groupId>
|
||||||
|
<artifactId>scala-maven-plugin</artifactId>
|
||||||
|
<version>${scala-maven-plugin-version}</version>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>release-profile</id>
|
||||||
|
<properties>
|
||||||
|
<skipTests>true</skipTests>
|
||||||
|
</properties>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.alchim31.maven</groupId>
|
||||||
|
<artifactId>scala-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>compile</goal>
|
||||||
|
<goal>testCompile</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
<configuration>
|
||||||
|
<scalaVersion>${scala-version}</scalaVersion>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>add-source</id>
|
||||||
|
<phase>prepare-package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>src/main/scala</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>release-sign-artifacts</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>performRelease</name>
|
||||||
|
<value>true</value>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-gpg-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>sign-artifacts</id>
|
||||||
|
<phase>verify</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>sign</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
<reporting>
|
||||||
|
<outputDirectory>target/site</outputDirectory>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-javadoc-plugin</artifactId>
|
||||||
|
<version>2.9</version>
|
||||||
|
<configuration>
|
||||||
|
<aggregate>true</aggregate>
|
||||||
|
<debug>true</debug>
|
||||||
|
<links>
|
||||||
|
<link>http://java.sun.com/javaee/5/docs/api</link>
|
||||||
|
<link>http://java.sun.com/j2se/1.5.0/docs/api</link>
|
||||||
|
</links>
|
||||||
|
<excludePackageNames/>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>net.alchim31.maven</groupId>
|
||||||
|
<artifactId>scala-maven-plugin</artifactId>
|
||||||
|
<version>${scala-maven-plugin-version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jxr-plugin</artifactId>
|
||||||
|
<version>2.3</version>
|
||||||
|
<configuration>
|
||||||
|
<aggregate>true</aggregate>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-project-info-reports-plugin</artifactId>
|
||||||
|
<version>2.6</version>
|
||||||
|
<reportSets>
|
||||||
|
<reportSet>
|
||||||
|
<reports>
|
||||||
|
<report>project-team</report>
|
||||||
|
</reports>
|
||||||
|
</reportSet>
|
||||||
|
</reportSets>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</reporting>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-parser</artifactId>
|
||||||
|
<version>${swagger-parser-version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.swagger</groupId>
|
||||||
|
<artifactId>swagger-compat-spec-parser</artifactId>
|
||||||
|
<version>${swagger-parser-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${project.groupId}</groupId>
|
||||||
|
<artifactId>swagger-core</artifactId>
|
||||||
|
<version>${swagger-core-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.samskivert</groupId>
|
||||||
|
<artifactId>jmustache</artifactId>
|
||||||
|
<version>${jmustache-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-io</groupId>
|
||||||
|
<artifactId>commons-io</artifactId>
|
||||||
|
<version>${commons-io-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.maven</groupId>
|
||||||
|
<artifactId>maven-plugin-tools-api</artifactId>
|
||||||
|
<version>2.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<version>${felix-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-ext</artifactId>
|
||||||
|
<version>${slf4j-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-api</artifactId>
|
||||||
|
<version>${slf4j-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-lang</groupId>
|
||||||
|
<artifactId>commons-lang</artifactId>
|
||||||
|
<version>${commons-lang-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>commons-cli</groupId>
|
||||||
|
<artifactId>commons-cli</artifactId>
|
||||||
|
<version>${commons-cli-version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.scalatest</groupId>
|
||||||
|
<artifactId>scalatest_2.11</artifactId>
|
||||||
|
<version>${scala-test-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.scala-lang</groupId>
|
||||||
|
<artifactId>scala-library</artifactId>
|
||||||
|
<version>${scala-version}</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<id>sonatype-snapshots</id>
|
||||||
|
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||||
|
<snapshots>
|
||||||
|
<enabled>true</enabled>
|
||||||
|
</snapshots>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
</project>
|
||||||
34
modules/swagger-codegen/src/main/java/config/Config.java
Normal file
34
modules/swagger-codegen/src/main/java/config/Config.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package config;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class Config {
|
||||||
|
private Map<String, String> options;
|
||||||
|
|
||||||
|
public Config() {
|
||||||
|
this.options = new HashMap<String, String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Config(Map<String, String> properties) {
|
||||||
|
this.options = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getOptions() {
|
||||||
|
return ImmutableMap.copyOf(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasOption(String opt) {
|
||||||
|
return options.containsKey(opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOption(String opt) {
|
||||||
|
return options.get(opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOption(String opt, String value) {
|
||||||
|
options.put(opt, value);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package config;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ConfigParser {
|
||||||
|
|
||||||
|
public static Config read(String location) {
|
||||||
|
|
||||||
|
System.out.println("reading config from " + location);
|
||||||
|
|
||||||
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
|
Config config = new Config();
|
||||||
|
|
||||||
|
try {
|
||||||
|
JsonNode rootNode = mapper.readTree(new File(location));
|
||||||
|
Iterator<Map.Entry<String, JsonNode>> optionNodes = rootNode.fields();
|
||||||
|
|
||||||
|
while (optionNodes.hasNext()) {
|
||||||
|
Map.Entry<String, JsonNode> optionNode = (Map.Entry<String, JsonNode>) optionNodes.next();
|
||||||
|
|
||||||
|
if (optionNode.getValue().isValueNode()) {
|
||||||
|
config.setOption(optionNode.getKey(), optionNode.getValue().asText());
|
||||||
|
} else {
|
||||||
|
System.out.println("omitting non-value node " + optionNode.getKey());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
System.out.println(e.getMessage());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public abstract class AbstractGenerator {
|
||||||
|
|
||||||
|
public File writeToFile(String filename, String contents) throws IOException {
|
||||||
|
System.out.println("writing file " + filename);
|
||||||
|
File output = new File(filename);
|
||||||
|
|
||||||
|
if (output.getParent() != null && !new File(output.getParent()).exists()) {
|
||||||
|
File parent = new File(output.getParent());
|
||||||
|
parent.mkdirs();
|
||||||
|
}
|
||||||
|
Writer out = new BufferedWriter(new OutputStreamWriter(
|
||||||
|
new FileOutputStream(output), "UTF-8"));
|
||||||
|
|
||||||
|
out.write(contents);
|
||||||
|
out.close();
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String readTemplate(String name) {
|
||||||
|
try {
|
||||||
|
Reader reader = getTemplateReader(name);
|
||||||
|
if (reader == null) {
|
||||||
|
throw new RuntimeException("no file found");
|
||||||
|
}
|
||||||
|
java.util.Scanner s = new java.util.Scanner(reader).useDelimiter("\\A");
|
||||||
|
return s.hasNext() ? s.next() : "";
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
throw new RuntimeException("can't load template " + name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Reader getTemplateReader(String name) {
|
||||||
|
try {
|
||||||
|
InputStream is = this.getClass().getClassLoader().getResourceAsStream(getCPResourcePath(name));
|
||||||
|
if (is == null) {
|
||||||
|
is = new FileInputStream(new File(name));
|
||||||
|
}
|
||||||
|
if (is == null) {
|
||||||
|
throw new RuntimeException("no file found");
|
||||||
|
}
|
||||||
|
return new InputStreamReader(is);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
throw new RuntimeException("can't load template " + name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the template file path with template dir prepended, and use the
|
||||||
|
* library template if exists.
|
||||||
|
*/
|
||||||
|
public String getFullTemplateFile(CodegenConfig config, String templateFile) {
|
||||||
|
String library = config.getLibrary();
|
||||||
|
if (library != null && !"".equals(library)) {
|
||||||
|
String libTemplateFile = config.templateDir() + File.separator +
|
||||||
|
"libraries" + File.separator + library + File.separator +
|
||||||
|
templateFile;
|
||||||
|
if (templateExists(libTemplateFile)) {
|
||||||
|
return libTemplateFile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return config.templateDir() + File.separator + templateFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean templateExists(String name) {
|
||||||
|
return this.getClass().getClassLoader().getResource(getCPResourcePath(name)) != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCPResourcePath(String name) {
|
||||||
|
if (!"/".equals(File.separator)) {
|
||||||
|
return name.replaceAll(Pattern.quote(File.separator), "/");
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
public class CliOption {
|
||||||
|
private final String opt;
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
public CliOption(String opt, String description) {
|
||||||
|
this.opt = opt;
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOpt() {
|
||||||
|
return opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,92 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import io.swagger.models.auth.AuthorizationValue;
|
||||||
|
|
||||||
|
import java.net.URLDecoder;
|
||||||
|
import java.net.URLEncoder;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class ClientOptInput {
|
||||||
|
protected CodegenConfig config;
|
||||||
|
private ClientOpts opts;
|
||||||
|
private Swagger swagger;
|
||||||
|
private List<AuthorizationValue> auths;
|
||||||
|
|
||||||
|
public ClientOptInput swagger(Swagger swagger) {
|
||||||
|
this.setSwagger(swagger);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientOptInput opts(ClientOpts opts) {
|
||||||
|
this.setOpts(opts);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getAuth() {
|
||||||
|
if (auths != null) {
|
||||||
|
StringBuilder b = new StringBuilder();
|
||||||
|
for (AuthorizationValue v : auths) {
|
||||||
|
try {
|
||||||
|
if (b.toString().length() > 0) {
|
||||||
|
b.append(",");
|
||||||
|
}
|
||||||
|
b.append(URLEncoder.encode(v.getKeyName(), "UTF-8"))
|
||||||
|
.append(":")
|
||||||
|
.append(URLEncoder.encode(v.getValue(), "UTF-8"));
|
||||||
|
} catch (Exception e) {
|
||||||
|
// continue
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return b.toString();
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAuth(String urlEncodedAuthString) {
|
||||||
|
List<AuthorizationValue> auths = new ArrayList<AuthorizationValue>();
|
||||||
|
if (urlEncodedAuthString != null && !"".equals(urlEncodedAuthString)) {
|
||||||
|
String[] parts = urlEncodedAuthString.split(",");
|
||||||
|
for (String part : parts) {
|
||||||
|
String[] kvPair = part.split(":");
|
||||||
|
if (kvPair.length == 2) {
|
||||||
|
auths.add(new AuthorizationValue(URLDecoder.decode(kvPair[0]), URLDecoder.decode(kvPair[1]), "header"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.auths = auths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<AuthorizationValue> getAuthorizationValues() {
|
||||||
|
return auths;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenConfig getConfig() {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfig(CodegenConfig config) {
|
||||||
|
this.config = config;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ClientOpts getOpts() {
|
||||||
|
return opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOpts(ClientOpts opts) {
|
||||||
|
this.opts = opts;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(dataType = "Object")
|
||||||
|
public Swagger getSwagger() {
|
||||||
|
return swagger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSwagger(Swagger swagger) {
|
||||||
|
this.swagger = swagger;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import io.swagger.codegen.auth.AuthMethod;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class ClientOpts {
|
||||||
|
protected String uri;
|
||||||
|
protected String target;
|
||||||
|
protected AuthMethod auth;
|
||||||
|
protected Map<String, String> properties = new HashMap<String, String>();
|
||||||
|
protected String outputDirectory;
|
||||||
|
|
||||||
|
public String getUri() {
|
||||||
|
return uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUri(String uri) {
|
||||||
|
this.uri = uri;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTarget() {
|
||||||
|
return target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTarget(String target) {
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, String> getProperties() {
|
||||||
|
return properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setProperties(Map<String, String> properties) {
|
||||||
|
this.properties = properties;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOutputDirectory() {
|
||||||
|
return outputDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOutputDirectory(String outputDirectory) {
|
||||||
|
this.outputDirectory = outputDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append("ClientOpts: {\n");
|
||||||
|
sb.append(" uri: ").append(uri).append(",");
|
||||||
|
sb.append(" auth: ").append(auth).append(",");
|
||||||
|
sb.append(properties);
|
||||||
|
sb.append("}");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import io.swagger.parser.SwaggerParser;
|
||||||
|
import org.apache.commons.cli.BasicParser;
|
||||||
|
import org.apache.commons.cli.CommandLine;
|
||||||
|
import org.apache.commons.cli.CommandLineParser;
|
||||||
|
import org.apache.commons.cli.HelpFormatter;
|
||||||
|
import org.apache.commons.cli.Options;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use instead {@link io.swagger.codegen.DefaultGenerator}
|
||||||
|
* or cli interface from https://github.com/swagger-api/swagger-codegen/pull/547
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class Codegen extends DefaultGenerator {
|
||||||
|
static Map<String, CodegenConfig> configs = new HashMap<String, CodegenConfig>();
|
||||||
|
static String configString;
|
||||||
|
static String debugInfoOptions = "\nThe following additional debug options are available for all codegen targets:" +
|
||||||
|
"\n -DdebugSwagger prints the swagger specification as interpreted by the codegen" +
|
||||||
|
"\n -DdebugModels prints models passed to the template engine" +
|
||||||
|
"\n -DdebugOperations prints operations passed to the template engine" +
|
||||||
|
"\n -DdebugSupportingFiles prints additional data passed to the template engine";
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
Options options = new Options();
|
||||||
|
options.addOption("h", "help", false, "shows this message");
|
||||||
|
options.addOption("l", "lang", true, "client language to generate.\nAvailable languages include:\n\t[" + configString + "]");
|
||||||
|
options.addOption("o", "output", true, "where to write the generated files");
|
||||||
|
options.addOption("i", "input-spec", true, "location of the swagger spec, as URL or file");
|
||||||
|
options.addOption("t", "template-dir", true, "folder containing the template files");
|
||||||
|
options.addOption("d", "debug-info", false, "prints additional info for debugging");
|
||||||
|
options.addOption("a", "auth", true, "adds authorization headers when fetching the swagger definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values");
|
||||||
|
|
||||||
|
ClientOptInput clientOptInput = new ClientOptInput();
|
||||||
|
ClientOpts clientOpts = new ClientOpts();
|
||||||
|
Swagger swagger = null;
|
||||||
|
|
||||||
|
CommandLine cmd = null;
|
||||||
|
try {
|
||||||
|
CommandLineParser parser = new BasicParser();
|
||||||
|
CodegenConfig config = null;
|
||||||
|
|
||||||
|
cmd = parser.parse(options, args);
|
||||||
|
if (cmd.hasOption("d")) {
|
||||||
|
usage(options);
|
||||||
|
System.out.println(debugInfoOptions);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("a")) {
|
||||||
|
clientOptInput.setAuth(cmd.getOptionValue("a"));
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("l")) {
|
||||||
|
clientOptInput.setConfig(getConfig(cmd.getOptionValue("l")));
|
||||||
|
} else {
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("o")) {
|
||||||
|
clientOptInput.getConfig().setOutputDir(cmd.getOptionValue("o"));
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("h")) {
|
||||||
|
if (cmd.hasOption("l")) {
|
||||||
|
config = getConfig(String.valueOf(cmd.getOptionValue("l")));
|
||||||
|
if (config != null) {
|
||||||
|
options.addOption("h", "help", true, config.getHelp());
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("i")) {
|
||||||
|
swagger = new SwaggerParser().read(cmd.getOptionValue("i"), clientOptInput.getAuthorizationValues(), true);
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("t")) {
|
||||||
|
clientOpts.getProperties().put("templateDir", String.valueOf(cmd.getOptionValue("t")));
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
clientOptInput
|
||||||
|
.opts(clientOpts)
|
||||||
|
.swagger(swagger);
|
||||||
|
new Codegen().opts(clientOptInput).generate();
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<CodegenConfig> getExtensions() {
|
||||||
|
ServiceLoader<CodegenConfig> loader = ServiceLoader.load(CodegenConfig.class);
|
||||||
|
List<CodegenConfig> output = new ArrayList<CodegenConfig>();
|
||||||
|
Iterator<CodegenConfig> itr = loader.iterator();
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
output.add(itr.next());
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void usage(Options options) {
|
||||||
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
|
formatter.printHelp("Codegen", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CodegenConfig getConfig(String name) {
|
||||||
|
if (configs.containsKey(name)) {
|
||||||
|
return configs.get(name);
|
||||||
|
} else {
|
||||||
|
// see if it's a class
|
||||||
|
try {
|
||||||
|
System.out.println("loading class " + name);
|
||||||
|
Class customClass = Class.forName(name);
|
||||||
|
System.out.println("loaded");
|
||||||
|
return (CodegenConfig) customClass.newInstance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new RuntimeException("can't load class " + name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
List<CodegenConfig> extensions = getExtensions();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
for (CodegenConfig config : extensions) {
|
||||||
|
if (sb.toString().length() != 0) {
|
||||||
|
sb.append(", ");
|
||||||
|
}
|
||||||
|
sb.append(config.getName());
|
||||||
|
configs.put(config.getName(), config);
|
||||||
|
configString = sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import io.swagger.models.Model;
|
||||||
|
import io.swagger.models.Operation;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import io.swagger.models.auth.SecuritySchemeDefinition;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public interface CodegenConfig {
|
||||||
|
CodegenType getTag();
|
||||||
|
|
||||||
|
String getName();
|
||||||
|
|
||||||
|
String getHelp();
|
||||||
|
|
||||||
|
Map<String, Object> additionalProperties();
|
||||||
|
|
||||||
|
String apiPackage();
|
||||||
|
|
||||||
|
String apiFileFolder();
|
||||||
|
|
||||||
|
String fileSuffix();
|
||||||
|
|
||||||
|
String outputFolder();
|
||||||
|
|
||||||
|
String templateDir();
|
||||||
|
|
||||||
|
String modelFileFolder();
|
||||||
|
|
||||||
|
String modelPackage();
|
||||||
|
|
||||||
|
String toApiName(String name);
|
||||||
|
|
||||||
|
String toApiVarName(String name);
|
||||||
|
|
||||||
|
String toModelName(String name);
|
||||||
|
|
||||||
|
String toParamName(String name);
|
||||||
|
|
||||||
|
String escapeText(String text);
|
||||||
|
|
||||||
|
String escapeReservedWord(String name);
|
||||||
|
|
||||||
|
String getTypeDeclaration(Property p);
|
||||||
|
|
||||||
|
String getTypeDeclaration(String name);
|
||||||
|
|
||||||
|
void processOpts();
|
||||||
|
|
||||||
|
List<CliOption> cliOptions();
|
||||||
|
|
||||||
|
String generateExamplePath(String path, Operation operation);
|
||||||
|
|
||||||
|
Set<String> reservedWords();
|
||||||
|
|
||||||
|
List<SupportingFile> supportingFiles();
|
||||||
|
|
||||||
|
String getOutputDir();
|
||||||
|
|
||||||
|
void setOutputDir(String dir);
|
||||||
|
|
||||||
|
CodegenModel fromModel(String name, Model model);
|
||||||
|
|
||||||
|
CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions);
|
||||||
|
|
||||||
|
CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation, Map<String, Model> definitions);
|
||||||
|
|
||||||
|
List<CodegenSecurity> fromSecurity(Map<String, SecuritySchemeDefinition> schemes);
|
||||||
|
|
||||||
|
Set<String> defaultIncludes();
|
||||||
|
|
||||||
|
Map<String, String> typeMapping();
|
||||||
|
|
||||||
|
Map<String, String> instantiationTypes();
|
||||||
|
|
||||||
|
Map<String, String> importMapping();
|
||||||
|
|
||||||
|
Map<String, String> apiTemplateFiles();
|
||||||
|
|
||||||
|
Map<String, String> modelTemplateFiles();
|
||||||
|
|
||||||
|
void processSwagger(Swagger swagger);
|
||||||
|
|
||||||
|
String toApiFilename(String name);
|
||||||
|
|
||||||
|
String toModelFilename(String name);
|
||||||
|
|
||||||
|
String toModelImport(String name);
|
||||||
|
|
||||||
|
String toApiImport(String name);
|
||||||
|
|
||||||
|
void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations);
|
||||||
|
|
||||||
|
Map<String, Object> postProcessModels(Map<String, Object> objs);
|
||||||
|
|
||||||
|
Map<String, Object> postProcessOperations(Map<String, Object> objs);
|
||||||
|
|
||||||
|
Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs);
|
||||||
|
|
||||||
|
String apiFilename(String templateName, String tag);
|
||||||
|
|
||||||
|
boolean shouldOverwrite(String filename);
|
||||||
|
|
||||||
|
boolean isSkipOverwrite();
|
||||||
|
|
||||||
|
void setSkipOverwrite(boolean skipOverwrite);
|
||||||
|
|
||||||
|
Map<String, String> supportedLibraries();
|
||||||
|
|
||||||
|
void setLibrary(String library);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Library template (sub-template).
|
||||||
|
*/
|
||||||
|
String getLibrary();
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import io.swagger.models.ExternalDocs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class CodegenModel {
|
||||||
|
public String parent;
|
||||||
|
public String name, classname, description, classVarName, modelJson;
|
||||||
|
public String defaultValue;
|
||||||
|
public List<CodegenProperty> vars = new ArrayList<CodegenProperty>();
|
||||||
|
public Set<String> imports = new HashSet<String>();
|
||||||
|
public Boolean hasVars, emptyVars, hasMoreModels, hasEnums;
|
||||||
|
public ExternalDocs externalDocs;
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public final class CodegenModelFactory {
|
||||||
|
|
||||||
|
private static final Map<CodegenModelType, Class<?>> typeMapping = new HashMap<CodegenModelType, Class<?>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configure a different implementation class.
|
||||||
|
*
|
||||||
|
* @param type the type that shall be replaced
|
||||||
|
* @param implementation the implementation class must extend the default class and must provide a public no-arg constructor
|
||||||
|
*/
|
||||||
|
public static void setTypeMapping(CodegenModelType type, Class<?> implementation) {
|
||||||
|
if (!type.getDefaultImplementation().isAssignableFrom(implementation)) {
|
||||||
|
throw new IllegalArgumentException(implementation.getSimpleName() + " doesn't extend " + type.getDefaultImplementation().getSimpleName());
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
implementation.newInstance();
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new IllegalArgumentException(e);
|
||||||
|
}
|
||||||
|
typeMapping.put(type, implementation);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public static <T> T newInstance(CodegenModelType type) {
|
||||||
|
Class<?> classType = typeMapping.get(type);
|
||||||
|
try {
|
||||||
|
return (T) (classType != null ? classType : type.getDefaultImplementation()).newInstance();
|
||||||
|
} catch (InstantiationException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
public enum CodegenModelType {
|
||||||
|
|
||||||
|
MODEL(CodegenModel.class),
|
||||||
|
OPERATION(CodegenOperation.class),
|
||||||
|
PARAMETER(CodegenParameter.class),
|
||||||
|
PROPERTY(CodegenProperty.class),
|
||||||
|
RESPONSE(CodegenResponse.class),
|
||||||
|
SECURITY(CodegenSecurity.class);
|
||||||
|
|
||||||
|
private final Class<?> defaultImplementation;
|
||||||
|
|
||||||
|
private CodegenModelType(Class<?> defaultImplementation) {
|
||||||
|
this.defaultImplementation = defaultImplementation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Class<?> getDefaultImplementation() {
|
||||||
|
return defaultImplementation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import io.swagger.models.ExternalDocs;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class CodegenOperation {
|
||||||
|
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||||
|
public Boolean hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
|
||||||
|
returnSimpleType, subresourceOperation, isMapContainer, isListContainer,
|
||||||
|
hasMore = Boolean.TRUE, isMultipart;
|
||||||
|
public String path, operationId, returnType, httpMethod, returnBaseType,
|
||||||
|
returnContainer, summary, notes, baseName, defaultResponse;
|
||||||
|
public List<Map<String, String>> consumes, produces;
|
||||||
|
public CodegenParameter bodyParam;
|
||||||
|
public List<CodegenParameter> allParams = new ArrayList<CodegenParameter>();
|
||||||
|
public List<CodegenParameter> bodyParams = new ArrayList<CodegenParameter>();
|
||||||
|
public List<CodegenParameter> pathParams = new ArrayList<CodegenParameter>();
|
||||||
|
public List<CodegenParameter> queryParams = new ArrayList<CodegenParameter>();
|
||||||
|
public List<CodegenParameter> headerParams = new ArrayList<CodegenParameter>();
|
||||||
|
public List<CodegenParameter> formParams = new ArrayList<CodegenParameter>();
|
||||||
|
public List<CodegenSecurity> authMethods;
|
||||||
|
public List<String> tags;
|
||||||
|
public List<CodegenResponse> responses = new ArrayList<CodegenResponse>();
|
||||||
|
public Set<String> imports = new HashSet<String>();
|
||||||
|
public List<Map<String, String>> examples;
|
||||||
|
public ExternalDocs externalDocs;
|
||||||
|
|
||||||
|
private boolean nonempty(List<CodegenParameter> params)
|
||||||
|
{
|
||||||
|
return params != null && params.size() > 0;
|
||||||
|
}
|
||||||
|
public boolean getHasBodyParam() {
|
||||||
|
return nonempty(bodyParams);
|
||||||
|
}
|
||||||
|
public boolean getHasQueryParams() {
|
||||||
|
return nonempty(bodyParams);
|
||||||
|
}
|
||||||
|
public boolean getHasHeaderParams() {
|
||||||
|
return nonempty(bodyParams);
|
||||||
|
}
|
||||||
|
public boolean getHasPathParams() {
|
||||||
|
return nonempty(bodyParams);
|
||||||
|
}
|
||||||
|
|
||||||
|
// legacy support
|
||||||
|
public String nickname;
|
||||||
|
}
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class CodegenParameter {
|
||||||
|
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||||
|
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer, secondaryParam;
|
||||||
|
public String baseName, paramName, dataType, collectionFormat, description, baseType, defaultValue;
|
||||||
|
public String jsonSchema;
|
||||||
|
public boolean isEnum;
|
||||||
|
public List<String> _enum;
|
||||||
|
public Map<String, Object> allowableValues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Determines whether this parameter is mandatory. If the parameter is in "path",
|
||||||
|
* this property is required and its value MUST be true. Otherwise, the property
|
||||||
|
* MAY be included and its default value is false.
|
||||||
|
*/
|
||||||
|
public Boolean required;
|
||||||
|
|
||||||
|
public CodegenParameter copy() {
|
||||||
|
CodegenParameter output = new CodegenParameter();
|
||||||
|
output.isFile = this.isFile;
|
||||||
|
output.notFile = this.notFile;
|
||||||
|
output.hasMore = this.hasMore;
|
||||||
|
output.isContainer = this.isContainer;
|
||||||
|
output.secondaryParam = this.secondaryParam;
|
||||||
|
output.baseName = this.baseName;
|
||||||
|
output.paramName = this.paramName;
|
||||||
|
output.dataType = this.dataType;
|
||||||
|
output.collectionFormat = this.collectionFormat;
|
||||||
|
output.description = this.description;
|
||||||
|
output.baseType = this.baseType;
|
||||||
|
output.isFormParam = this.isFormParam;
|
||||||
|
output.isQueryParam = this.isQueryParam;
|
||||||
|
output.isPathParam = this.isPathParam;
|
||||||
|
output.isHeaderParam = this.isHeaderParam;
|
||||||
|
output.isCookieParam = this.isCookieParam;
|
||||||
|
output.isBodyParam = this.isBodyParam;
|
||||||
|
output.required = this.required;
|
||||||
|
output.jsonSchema = this.jsonSchema;
|
||||||
|
output.defaultValue = this.defaultValue;
|
||||||
|
output.isEnum = this.isEnum;
|
||||||
|
if (this._enum != null) {
|
||||||
|
output._enum = new ArrayList<String>(this._enum);
|
||||||
|
}
|
||||||
|
if (this.allowableValues != null) {
|
||||||
|
output.allowableValues = new HashMap<String, Object>(this.allowableValues);
|
||||||
|
}
|
||||||
|
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CodegenProperty {
|
||||||
|
public String baseName, complexType, getter, setter, description, datatype, datatypeWithEnum,
|
||||||
|
name, min, max, defaultValue, baseType, containerType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* maxLength validation for strings, see http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.2.1
|
||||||
|
*/
|
||||||
|
public Integer maxLength;
|
||||||
|
/**
|
||||||
|
* minLength validation for strings, see http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.2.2
|
||||||
|
*/
|
||||||
|
public Integer minLength;
|
||||||
|
/**
|
||||||
|
* pattern validation for strings, see http://json-schema.org/latest/json-schema-validation.html#rfc.section.5.2.3
|
||||||
|
*/
|
||||||
|
public String pattern;
|
||||||
|
/**
|
||||||
|
* A free-form property to include an example of an instance for this schema.
|
||||||
|
*/
|
||||||
|
public String example;
|
||||||
|
|
||||||
|
public String jsonSchema;
|
||||||
|
public Double minimum;
|
||||||
|
public Double maximum;
|
||||||
|
public Boolean exclusiveMinimum;
|
||||||
|
public Boolean exclusiveMaximum;
|
||||||
|
public Boolean hasMore = null, required = null, secondaryParam = null;
|
||||||
|
public Boolean isPrimitiveType, isContainer, isNotContainer;
|
||||||
|
public boolean isEnum;
|
||||||
|
public List<String> _enum;
|
||||||
|
public Map<String, Object> allowableValues;
|
||||||
|
public CodegenProperty items;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (obj == null) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (getClass() != obj.getClass()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
final CodegenProperty other = (CodegenProperty) obj;
|
||||||
|
if ((this.baseName == null) ? (other.baseName != null) : !this.baseName.equals(other.baseName)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.complexType == null) ? (other.complexType != null) : !this.complexType.equals(other.complexType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.getter == null) ? (other.getter != null) : !this.getter.equals(other.getter)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.setter == null) ? (other.setter != null) : !this.setter.equals(other.setter)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.description == null) ? (other.description != null) : !this.description.equals(other.description)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.datatype == null) ? (other.datatype != null) : !this.datatype.equals(other.datatype)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.datatypeWithEnum == null) ? (other.datatypeWithEnum != null) : !this.datatypeWithEnum.equals(other.datatypeWithEnum)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.name == null) ? (other.name != null) : !this.name.equals(other.name)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.min == null) ? (other.min != null) : !this.min.equals(other.min)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.max == null) ? (other.max != null) : !this.max.equals(other.max)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.defaultValue == null) ? (other.defaultValue != null) : !this.defaultValue.equals(other.defaultValue)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.baseType == null) ? (other.baseType != null) : !this.baseType.equals(other.baseType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.containerType == null) ? (other.containerType != null) : !this.containerType.equals(other.containerType)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.maxLength != other.maxLength && (this.maxLength == null || !this.maxLength.equals(other.maxLength))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.minLength != other.minLength && (this.minLength == null || !this.minLength.equals(other.minLength))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.pattern == null) ? (other.pattern != null) : !this.pattern.equals(other.pattern)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.example == null) ? (other.example != null) : !this.example.equals(other.example)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if ((this.jsonSchema == null) ? (other.jsonSchema != null) : !this.jsonSchema.equals(other.jsonSchema)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.minimum != other.minimum && (this.minimum == null || !this.minimum.equals(other.minimum))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.maximum != other.maximum && (this.maximum == null || !this.maximum.equals(other.maximum))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.exclusiveMinimum != other.exclusiveMinimum && (this.exclusiveMinimum == null || !this.exclusiveMinimum.equals(other.exclusiveMinimum))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.exclusiveMaximum != other.exclusiveMaximum && (this.exclusiveMaximum == null || !this.exclusiveMaximum.equals(other.exclusiveMaximum))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.required != other.required && (this.required == null || !this.required.equals(other.required))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.secondaryParam != other.secondaryParam && (this.secondaryParam == null || !this.secondaryParam.equals(other.secondaryParam))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.isPrimitiveType != other.isPrimitiveType && (this.isPrimitiveType == null || !this.isPrimitiveType.equals(other.isPrimitiveType))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.isContainer != other.isContainer && (this.isContainer == null || !this.isContainer.equals(other.isContainer))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.isNotContainer != other.isNotContainer && (this.isNotContainer == null || !this.isNotContainer.equals(other.isNotContainer))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.isEnum != other.isEnum) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this._enum != other._enum && (this._enum == null || !this._enum.equals(other._enum))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (this.allowableValues != other.allowableValues && (this.allowableValues == null || !this.allowableValues.equals(other.allowableValues))) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class CodegenResponse {
|
||||||
|
public final List<CodegenProperty> headers = new ArrayList<CodegenProperty>();
|
||||||
|
public String code, message;
|
||||||
|
public Boolean hasMore;
|
||||||
|
public List<Map<String, Object>> examples;
|
||||||
|
public String dataType, baseType, containerType;
|
||||||
|
public Boolean isDefault;
|
||||||
|
public Boolean simpleType;
|
||||||
|
public Boolean primitiveType;
|
||||||
|
public Boolean isMapContainer;
|
||||||
|
public Boolean isListContainer;
|
||||||
|
public Object schema;
|
||||||
|
public String jsonSchema;
|
||||||
|
|
||||||
|
public boolean isWildcard() {
|
||||||
|
return "0".equals(code) || "default".equals(code);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class CodegenSecurity {
|
||||||
|
public String name;
|
||||||
|
public String type;
|
||||||
|
public Boolean hasMore, isBasic, isOAuth, isApiKey;
|
||||||
|
// ApiKey specific
|
||||||
|
public String keyParamName;
|
||||||
|
public Boolean isKeyInQuery, isKeyInHeader;
|
||||||
|
// Oauth specific
|
||||||
|
public String flow, authorizationUrl, tokenUrl;
|
||||||
|
public Set<String> scopes;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonValue;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public enum CodegenType {
|
||||||
|
CLIENT, SERVER, DOCUMENTATION, OTHER;
|
||||||
|
|
||||||
|
private static Map<String, CodegenType> names = new HashMap<String, CodegenType>();
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public static CodegenType forValue(String value) {
|
||||||
|
return names.get(value.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String toValue() {
|
||||||
|
for (Map.Entry<String, CodegenType> entry : names.entrySet()) {
|
||||||
|
if (entry.getValue() == this) {
|
||||||
|
return entry.getKey();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null; // or fail
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
names.put("client", CLIENT);
|
||||||
|
names.put("server", SERVER);
|
||||||
|
names.put("documentation", DOCUMENTATION);
|
||||||
|
names.put("other", OTHER);
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,607 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import static org.apache.commons.lang3.StringUtils.capitalize;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.isNotEmpty;
|
||||||
|
|
||||||
|
import com.samskivert.mustache.Mustache;
|
||||||
|
import com.samskivert.mustache.Template;
|
||||||
|
import io.swagger.codegen.languages.CodeGenStatus;
|
||||||
|
import io.swagger.models.ComposedModel;
|
||||||
|
import io.swagger.models.Contact;
|
||||||
|
import io.swagger.models.Info;
|
||||||
|
import io.swagger.models.License;
|
||||||
|
import io.swagger.models.Model;
|
||||||
|
import io.swagger.models.Operation;
|
||||||
|
import io.swagger.models.Path;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import io.swagger.models.auth.OAuth2Definition;
|
||||||
|
import io.swagger.models.auth.SecuritySchemeDefinition;
|
||||||
|
import io.swagger.models.parameters.Parameter;
|
||||||
|
import io.swagger.util.Json;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class DefaultGenerator extends AbstractGenerator implements Generator {
|
||||||
|
protected CodegenConfig config;
|
||||||
|
protected ClientOptInput opts = null;
|
||||||
|
protected Swagger swagger = null;
|
||||||
|
|
||||||
|
public CodeGenStatus status = CodeGenStatus.UNRUN;
|
||||||
|
|
||||||
|
public Generator opts(ClientOptInput opts) {
|
||||||
|
this.opts = opts;
|
||||||
|
|
||||||
|
this.swagger = opts.getSwagger();
|
||||||
|
this.config = opts.getConfig();
|
||||||
|
this.config.additionalProperties().putAll(opts.getOpts().getProperties());
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<File> generate() {
|
||||||
|
if (swagger == null || config == null) {
|
||||||
|
throw new RuntimeException("missing swagger input or config!");
|
||||||
|
}
|
||||||
|
if (System.getProperty("debugSwagger") != null) {
|
||||||
|
Json.prettyPrint(swagger);
|
||||||
|
}
|
||||||
|
List<File> files = new ArrayList<File>();
|
||||||
|
try {
|
||||||
|
config.processOpts();
|
||||||
|
|
||||||
|
config.additionalProperties().put("generatedDate", DateTime.now().toString());
|
||||||
|
config.additionalProperties().put("generatorClass", config.getClass().toString());
|
||||||
|
|
||||||
|
if (swagger.getInfo() != null) {
|
||||||
|
Info info = swagger.getInfo();
|
||||||
|
if (info.getTitle() != null) {
|
||||||
|
config.additionalProperties().put("appName", info.getTitle());
|
||||||
|
}
|
||||||
|
if (info.getVersion() != null) {
|
||||||
|
config.additionalProperties().put("appVersion", info.getVersion());
|
||||||
|
}
|
||||||
|
if (info.getDescription() != null) {
|
||||||
|
config.additionalProperties().put("appDescription",
|
||||||
|
config.escapeText(info.getDescription()));
|
||||||
|
}
|
||||||
|
if (info.getContact() != null) {
|
||||||
|
Contact contact = info.getContact();
|
||||||
|
config.additionalProperties().put("infoUrl", contact.getUrl());
|
||||||
|
if (contact.getEmail() != null) {
|
||||||
|
config.additionalProperties().put("infoEmail", contact.getEmail());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info.getLicense() != null) {
|
||||||
|
License license = info.getLicense();
|
||||||
|
if (license.getName() != null) {
|
||||||
|
config.additionalProperties().put("licenseInfo", license.getName());
|
||||||
|
}
|
||||||
|
if (license.getUrl() != null) {
|
||||||
|
config.additionalProperties().put("licenseUrl", license.getUrl());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (info.getVersion() != null) {
|
||||||
|
config.additionalProperties().put("version", info.getVersion());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder hostBuilder = new StringBuilder();
|
||||||
|
String scheme;
|
||||||
|
if (swagger.getSchemes() != null && swagger.getSchemes().size() > 0) {
|
||||||
|
scheme = swagger.getSchemes().get(0).toValue();
|
||||||
|
} else {
|
||||||
|
scheme = "https";
|
||||||
|
}
|
||||||
|
hostBuilder.append(scheme);
|
||||||
|
hostBuilder.append("://");
|
||||||
|
if (swagger.getHost() != null) {
|
||||||
|
hostBuilder.append(swagger.getHost());
|
||||||
|
} else {
|
||||||
|
hostBuilder.append("localhost");
|
||||||
|
}
|
||||||
|
if (swagger.getBasePath() != null) {
|
||||||
|
hostBuilder.append(swagger.getBasePath());
|
||||||
|
}
|
||||||
|
String contextPath = swagger.getBasePath() == null ? "" : swagger.getBasePath();
|
||||||
|
String basePath = hostBuilder.toString();
|
||||||
|
|
||||||
|
|
||||||
|
List<Object> allOperations = new ArrayList<Object>();
|
||||||
|
List<Object> allModels = new ArrayList<Object>();
|
||||||
|
|
||||||
|
// models
|
||||||
|
Map<String, Model> definitions = swagger.getDefinitions();
|
||||||
|
if (definitions != null) {
|
||||||
|
List<String> sortedModelKeys = sortModelsByInheritance(definitions);
|
||||||
|
|
||||||
|
for (String name : sortedModelKeys) {
|
||||||
|
Model model = definitions.get(name);
|
||||||
|
Map<String, Model> modelMap = new HashMap<String, Model>();
|
||||||
|
modelMap.put(name, model);
|
||||||
|
Map<String, Object> models = processModels(config, modelMap, definitions);
|
||||||
|
models.putAll(config.additionalProperties());
|
||||||
|
|
||||||
|
allModels.add(((List<Object>) models.get("models")).get(0));
|
||||||
|
|
||||||
|
for (String templateName : config.modelTemplateFiles().keySet()) {
|
||||||
|
String suffix = config.modelTemplateFiles().get(templateName);
|
||||||
|
String filename = config.modelFileFolder() + File.separator + config.toModelFilename(name) + suffix;
|
||||||
|
if (!config.shouldOverwrite(filename)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String templateFile = getFullTemplateFile(config, templateName);
|
||||||
|
String template = readTemplate(templateFile);
|
||||||
|
Template tmpl = Mustache.compiler()
|
||||||
|
.withLoader(new Mustache.TemplateLoader() {
|
||||||
|
public Reader getTemplate(String name) {
|
||||||
|
return getTemplateReader(config.templateDir() + File.separator + name + ".mustache");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.defaultValue("")
|
||||||
|
.compile(template);
|
||||||
|
writeToFile(filename, tmpl.execute(models));
|
||||||
|
files.add(new File(filename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (System.getProperty("debugModels") != null) {
|
||||||
|
System.out.println("############ Model info ############");
|
||||||
|
Json.prettyPrint(allModels);
|
||||||
|
}
|
||||||
|
|
||||||
|
// apis
|
||||||
|
Map<String, List<CodegenOperation>> paths = processPaths(swagger.getPaths());
|
||||||
|
for (String tag : paths.keySet()) {
|
||||||
|
List<CodegenOperation> ops = paths.get(tag);
|
||||||
|
Map<String, Object> operation = processOperations(config, tag, ops);
|
||||||
|
|
||||||
|
operation.put("basePath", basePath);
|
||||||
|
operation.put("contextPath", contextPath);
|
||||||
|
operation.put("baseName", tag);
|
||||||
|
operation.put("modelPackage", config.modelPackage());
|
||||||
|
operation.putAll(config.additionalProperties());
|
||||||
|
operation.put("classname", config.toApiName(tag));
|
||||||
|
operation.put("classVarName", config.toApiVarName(tag));
|
||||||
|
operation.put("importPath", config.toApiImport(tag));
|
||||||
|
|
||||||
|
processMimeTypes(swagger.getConsumes(), operation, "consumes");
|
||||||
|
processMimeTypes(swagger.getProduces(), operation, "produces");
|
||||||
|
|
||||||
|
allOperations.add(new HashMap<String, Object>(operation));
|
||||||
|
for (int i = 0; i < allOperations.size(); i++) {
|
||||||
|
Map<String, Object> oo = (Map<String, Object>) allOperations.get(i);
|
||||||
|
if (i < (allOperations.size() - 1)) {
|
||||||
|
oo.put("hasMore", "true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String templateName : config.apiTemplateFiles().keySet()) {
|
||||||
|
|
||||||
|
String filename = config.apiFilename(templateName, tag);
|
||||||
|
if (!config.shouldOverwrite(filename) && new File(filename).exists()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String templateFile = getFullTemplateFile(config, templateName);
|
||||||
|
String template = readTemplate(templateFile);
|
||||||
|
Template tmpl = Mustache.compiler()
|
||||||
|
.withLoader(new Mustache.TemplateLoader() {
|
||||||
|
public Reader getTemplate(String name) {
|
||||||
|
return getTemplateReader(config.templateDir() + File.separator + name + ".mustache");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.defaultValue("")
|
||||||
|
.compile(template);
|
||||||
|
|
||||||
|
writeToFile(filename, tmpl.execute(operation));
|
||||||
|
files.add(new File(filename));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (System.getProperty("debugOperations") != null) {
|
||||||
|
System.out.println("############ Operation info ############");
|
||||||
|
Json.prettyPrint(allOperations);
|
||||||
|
}
|
||||||
|
|
||||||
|
// supporting files
|
||||||
|
Map<String, Object> bundle = new HashMap<String, Object>();
|
||||||
|
bundle.putAll(config.additionalProperties());
|
||||||
|
bundle.put("apiPackage", config.apiPackage());
|
||||||
|
|
||||||
|
Map<String, Object> apis = new HashMap<String, Object>();
|
||||||
|
apis.put("apis", allOperations);
|
||||||
|
if (swagger.getHost() != null) {
|
||||||
|
bundle.put("host", swagger.getHost());
|
||||||
|
}
|
||||||
|
bundle.put("basePath", basePath);
|
||||||
|
bundle.put("scheme", scheme);
|
||||||
|
bundle.put("contextPath", contextPath);
|
||||||
|
bundle.put("apiInfo", apis);
|
||||||
|
bundle.put("models", allModels);
|
||||||
|
bundle.put("apiFolder", config.apiPackage().replace('.', File.separatorChar));
|
||||||
|
bundle.put("modelPackage", config.modelPackage());
|
||||||
|
List<CodegenSecurity> authMethods = config.fromSecurity(swagger.getSecurityDefinitions());
|
||||||
|
if (authMethods != null && !authMethods.isEmpty()) {
|
||||||
|
bundle.put("authMethods", authMethods);
|
||||||
|
bundle.put("hasAuthMethods", true);
|
||||||
|
}
|
||||||
|
if (swagger.getExternalDocs() != null) {
|
||||||
|
bundle.put("externalDocs", swagger.getExternalDocs());
|
||||||
|
}
|
||||||
|
for (int i = 0; i < allModels.size() - 1; i++) {
|
||||||
|
HashMap<String, CodegenModel> cm = (HashMap<String, CodegenModel>) allModels.get(i);
|
||||||
|
CodegenModel m = cm.get("model");
|
||||||
|
m.hasMoreModels = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
config.postProcessSupportingFileData(bundle);
|
||||||
|
|
||||||
|
if (System.getProperty("debugSupportingFiles") != null) {
|
||||||
|
System.out.println("############ Supporting file info ############");
|
||||||
|
Json.prettyPrint(bundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (SupportingFile support : config.supportingFiles()) {
|
||||||
|
String outputFolder = config.outputFolder();
|
||||||
|
if (isNotEmpty(support.folder)) {
|
||||||
|
outputFolder += File.separator + support.folder;
|
||||||
|
}
|
||||||
|
File of = new File(outputFolder);
|
||||||
|
if (!of.isDirectory()) {
|
||||||
|
of.mkdirs();
|
||||||
|
}
|
||||||
|
String outputFilename = outputFolder + File.separator + support.destinationFilename;
|
||||||
|
if (!config.shouldOverwrite(outputFilename)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String templateFile = getFullTemplateFile(config, support.templateFile);
|
||||||
|
|
||||||
|
if (templateFile.endsWith("mustache")) {
|
||||||
|
String template = readTemplate(templateFile);
|
||||||
|
Template tmpl = Mustache.compiler()
|
||||||
|
.withLoader(new Mustache.TemplateLoader() {
|
||||||
|
public Reader getTemplate(String name) {
|
||||||
|
return getTemplateReader(config.templateDir() + File.separator + name + ".mustache");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.defaultValue("")
|
||||||
|
.compile(template);
|
||||||
|
|
||||||
|
writeToFile(outputFilename, tmpl.execute(bundle));
|
||||||
|
files.add(new File(outputFilename));
|
||||||
|
} else {
|
||||||
|
InputStream in = null;
|
||||||
|
|
||||||
|
try {
|
||||||
|
in = new FileInputStream(templateFile);
|
||||||
|
} catch (Exception e) {
|
||||||
|
// continue
|
||||||
|
}
|
||||||
|
if (in == null) {
|
||||||
|
in = this.getClass().getClassLoader().getResourceAsStream(getCPResourcePath(templateFile));
|
||||||
|
}
|
||||||
|
File outputFile = new File(outputFilename);
|
||||||
|
OutputStream out = new FileOutputStream(outputFile, false);
|
||||||
|
if (in != null && out != null) {
|
||||||
|
System.out.println("writing file " + outputFile);
|
||||||
|
IOUtils.copy(in, out);
|
||||||
|
} else {
|
||||||
|
if (in == null) {
|
||||||
|
System.out.println("can't open " + templateFile + " for input");
|
||||||
|
}
|
||||||
|
if (out == null) {
|
||||||
|
System.out.println("can't open " + outputFile + " for output");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
files.add(outputFile);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
config.processSwagger(swagger);
|
||||||
|
|
||||||
|
status = CodeGenStatus.SUCCESSFUL;
|
||||||
|
} catch (Exception e) {
|
||||||
|
status = CodeGenStatus.FAILED;
|
||||||
|
}
|
||||||
|
return files;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processMimeTypes(List<String> mimeTypeList, Map<String, Object> operation, String source) {
|
||||||
|
if (mimeTypeList != null && mimeTypeList.size() > 0) {
|
||||||
|
List<Map<String, String>> c = new ArrayList<Map<String, String>>();
|
||||||
|
int count = 0;
|
||||||
|
for (String key : mimeTypeList) {
|
||||||
|
Map<String, String> mediaType = new HashMap<String, String>();
|
||||||
|
mediaType.put("mediaType", key);
|
||||||
|
count += 1;
|
||||||
|
if (count < mimeTypeList.size()) {
|
||||||
|
mediaType.put("hasMore", "true");
|
||||||
|
} else {
|
||||||
|
mediaType.put("hasMore", null);
|
||||||
|
}
|
||||||
|
c.add(mediaType);
|
||||||
|
}
|
||||||
|
operation.put(source, c);
|
||||||
|
String flagFieldName = "has" + source.substring(0, 1).toUpperCase() + source.substring(1);
|
||||||
|
operation.put(flagFieldName, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<String> sortModelsByInheritance(final Map<String, Model> definitions) {
|
||||||
|
List<String> sortedModelKeys = new ArrayList<String>(definitions.keySet());
|
||||||
|
Comparator<String> cmp = new Comparator<String>() {
|
||||||
|
@Override
|
||||||
|
public int compare(String o1, String o2) {
|
||||||
|
Model model1 = definitions.get(o1);
|
||||||
|
Model model2 = definitions.get(o2);
|
||||||
|
|
||||||
|
int model1InheritanceDepth = getInheritanceDepth(model1);
|
||||||
|
int model2InheritanceDepth = getInheritanceDepth(model2);
|
||||||
|
|
||||||
|
if (model1InheritanceDepth == model2InheritanceDepth) {
|
||||||
|
return 0;
|
||||||
|
} else if (model1InheritanceDepth > model2InheritanceDepth) {
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getInheritanceDepth(Model model) {
|
||||||
|
int inheritanceDepth = 0;
|
||||||
|
Model parent = getParent(model);
|
||||||
|
|
||||||
|
while (parent != null) {
|
||||||
|
inheritanceDepth++;
|
||||||
|
parent = getParent(parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
return inheritanceDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Model getParent(Model model) {
|
||||||
|
if (model instanceof ComposedModel) {
|
||||||
|
return definitions.get(((ComposedModel) model).getParent().getReference());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
Collections.sort(sortedModelKeys, cmp);
|
||||||
|
|
||||||
|
return sortedModelKeys;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, List<CodegenOperation>> processPaths(Map<String, Path> paths) {
|
||||||
|
Map<String, List<CodegenOperation>> ops = new HashMap<String, List<CodegenOperation>>();
|
||||||
|
|
||||||
|
for (String resourcePath : paths.keySet()) {
|
||||||
|
Path path = paths.get(resourcePath);
|
||||||
|
processOperation(resourcePath, "get", path.getGet(), ops, path);
|
||||||
|
processOperation(resourcePath, "put", path.getPut(), ops, path);
|
||||||
|
processOperation(resourcePath, "post", path.getPost(), ops, path);
|
||||||
|
processOperation(resourcePath, "delete", path.getDelete(), ops, path);
|
||||||
|
processOperation(resourcePath, "patch", path.getPatch(), ops, path);
|
||||||
|
processOperation(resourcePath, "options", path.getOptions(), ops, path);
|
||||||
|
}
|
||||||
|
return ops;
|
||||||
|
}
|
||||||
|
|
||||||
|
public SecuritySchemeDefinition fromSecurity(String name) {
|
||||||
|
Map<String, SecuritySchemeDefinition> map = swagger.getSecurityDefinitions();
|
||||||
|
if (map == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return map.get(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void processOperation(String resourcePath, String httpMethod, Operation operation, Map<String, List<CodegenOperation>> operations, Path path) {
|
||||||
|
if (operation != null) {
|
||||||
|
List<String> tags = operation.getTags();
|
||||||
|
if (tags == null) {
|
||||||
|
tags = new ArrayList<String>();
|
||||||
|
tags.add("default");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
build up a set of parameter "ids" defined at the operation level
|
||||||
|
per the swagger 2.0 spec "A unique parameter is defined by a combination of a name and location"
|
||||||
|
i'm assuming "location" == "in"
|
||||||
|
*/
|
||||||
|
Set<String> operationParameters = new HashSet<String>();
|
||||||
|
if (operation.getParameters() != null) {
|
||||||
|
for (Parameter parameter : operation.getParameters()) {
|
||||||
|
operationParameters.add(generateParameterId(parameter));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//need to propagate path level down to the operation
|
||||||
|
if(path.getParameters() != null) {
|
||||||
|
for (Parameter parameter : path.getParameters()) {
|
||||||
|
//skip propagation if a parameter with the same name is already defined at the operation level
|
||||||
|
if (!operationParameters.contains(generateParameterId(parameter))) {
|
||||||
|
operation.addParameter(parameter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String tag : tags) {
|
||||||
|
CodegenOperation co = config.fromOperation(resourcePath, httpMethod, operation, swagger.getDefinitions());
|
||||||
|
co.tags = new ArrayList<String>();
|
||||||
|
co.tags.add(sanitizeTag(tag));
|
||||||
|
config.addOperationToGroup(sanitizeTag(tag), resourcePath, operation, co, operations);
|
||||||
|
|
||||||
|
List<Map<String, List<String>>> securities = operation.getSecurity();
|
||||||
|
if (securities == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Map<String, SecuritySchemeDefinition> authMethods = new HashMap<String, SecuritySchemeDefinition>();
|
||||||
|
for (Map<String, List<String>> security : securities) {
|
||||||
|
if (security.size() != 1) {
|
||||||
|
//Not sure what to do
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String securityName = security.keySet().iterator().next();
|
||||||
|
SecuritySchemeDefinition securityDefinition = fromSecurity(securityName);
|
||||||
|
if (securityDefinition != null) {
|
||||||
|
if(securityDefinition instanceof OAuth2Definition) {
|
||||||
|
OAuth2Definition oauth2Definition = (OAuth2Definition) securityDefinition;
|
||||||
|
OAuth2Definition oauth2Operation = new OAuth2Definition();
|
||||||
|
oauth2Operation.setType(oauth2Definition.getType());
|
||||||
|
oauth2Operation.setAuthorizationUrl(oauth2Definition.getAuthorizationUrl());
|
||||||
|
oauth2Operation.setFlow(oauth2Definition.getFlow());
|
||||||
|
oauth2Operation.setTokenUrl(oauth2Definition.getTokenUrl());
|
||||||
|
for (String scope : security.values().iterator().next()) {
|
||||||
|
if (oauth2Definition.getScopes().containsKey(scope)) {
|
||||||
|
oauth2Operation.addScope(scope, oauth2Definition.getScopes().get(scope));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
authMethods.put(securityName, oauth2Operation);
|
||||||
|
} else {
|
||||||
|
authMethods.put(securityName, securityDefinition);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!authMethods.isEmpty()) {
|
||||||
|
co.authMethods = config.fromSecurity(authMethods);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String generateParameterId(Parameter parameter) {
|
||||||
|
return parameter.getName() + ":" + parameter.getIn();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String sanitizeTag(String tag) {
|
||||||
|
// remove spaces and make strong case
|
||||||
|
String[] parts = tag.split(" ");
|
||||||
|
StringBuilder buf = new StringBuilder();
|
||||||
|
for (String part : parts) {
|
||||||
|
if (isNotEmpty(part)) {
|
||||||
|
buf.append(capitalize(part));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return buf.toString().replaceAll("[^a-zA-Z ]", "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> processOperations(CodegenConfig config, String tag, List<CodegenOperation> ops) {
|
||||||
|
Map<String, Object> operations = new HashMap<String, Object>();
|
||||||
|
Map<String, Object> objs = new HashMap<String, Object>();
|
||||||
|
objs.put("classname", config.toApiName(tag));
|
||||||
|
objs.put("pathPrefix", config.toApiVarName(tag));
|
||||||
|
|
||||||
|
// check for operationId uniqueness
|
||||||
|
Set<String> opIds = new HashSet<String>();
|
||||||
|
int counter = 0;
|
||||||
|
for (CodegenOperation op : ops) {
|
||||||
|
String opId = op.nickname;
|
||||||
|
if (opIds.contains(opId)) {
|
||||||
|
counter++;
|
||||||
|
op.nickname += "_" + counter;
|
||||||
|
}
|
||||||
|
opIds.add(opId);
|
||||||
|
}
|
||||||
|
objs.put("operation", ops);
|
||||||
|
|
||||||
|
operations.put("operations", objs);
|
||||||
|
operations.put("package", config.apiPackage());
|
||||||
|
|
||||||
|
|
||||||
|
Set<String> allImports = new LinkedHashSet<String>();
|
||||||
|
for (CodegenOperation op : ops) {
|
||||||
|
allImports.addAll(op.imports);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, String>> imports = new ArrayList<Map<String, String>>();
|
||||||
|
for (String nextImport : allImports) {
|
||||||
|
Map<String, String> im = new LinkedHashMap<String, String>();
|
||||||
|
String mapping = config.importMapping().get(nextImport);
|
||||||
|
if (mapping == null) {
|
||||||
|
mapping = config.toModelImport(nextImport);
|
||||||
|
}
|
||||||
|
if (mapping != null) {
|
||||||
|
im.put("import", mapping);
|
||||||
|
imports.add(im);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
operations.put("imports", imports);
|
||||||
|
|
||||||
|
// add a flag to indicate whether there's any {{import}}
|
||||||
|
if (imports.size() > 0) {
|
||||||
|
operations.put("hasImport", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
config.postProcessOperations(operations);
|
||||||
|
if (objs.size() > 0) {
|
||||||
|
List<CodegenOperation> os = (List<CodegenOperation>) objs.get("operation");
|
||||||
|
|
||||||
|
if (os != null && os.size() > 0) {
|
||||||
|
CodegenOperation op = os.get(os.size() - 1);
|
||||||
|
op.hasMore = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return operations;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> processModels(CodegenConfig config, Map<String, Model> definitions, Map<String, Model> allDefinitions) {
|
||||||
|
Map<String, Object> objs = new HashMap<String, Object>();
|
||||||
|
objs.put("package", config.modelPackage());
|
||||||
|
List<Object> models = new ArrayList<Object>();
|
||||||
|
Set<String> allImports = new LinkedHashSet<String>();
|
||||||
|
for (String key : definitions.keySet()) {
|
||||||
|
Model mm = definitions.get(key);
|
||||||
|
CodegenModel cm = config.fromModel(key, mm, allDefinitions);
|
||||||
|
Map<String, Object> mo = new HashMap<String, Object>();
|
||||||
|
mo.put("model", cm);
|
||||||
|
mo.put("importPath", config.toModelImport(key));
|
||||||
|
models.add(mo);
|
||||||
|
allImports.addAll(cm.imports);
|
||||||
|
}
|
||||||
|
objs.put("models", models);
|
||||||
|
|
||||||
|
List<Map<String, String>> imports = new ArrayList<Map<String, String>>();
|
||||||
|
for (String nextImport : allImports) {
|
||||||
|
Map<String, String> im = new LinkedHashMap<String, String>();
|
||||||
|
String mapping = config.importMapping().get(nextImport);
|
||||||
|
if (mapping == null) {
|
||||||
|
mapping = config.toModelImport(nextImport);
|
||||||
|
}
|
||||||
|
if (mapping != null && !config.defaultIncludes().contains(mapping)) {
|
||||||
|
im.put("import", mapping);
|
||||||
|
imports.add(im);
|
||||||
|
}
|
||||||
|
// add instantiation types
|
||||||
|
mapping = config.instantiationTypes().get(nextImport);
|
||||||
|
if (mapping != null && !config.defaultIncludes().contains(mapping)) {
|
||||||
|
im.put("import", mapping);
|
||||||
|
imports.add(im);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
objs.put("imports", imports);
|
||||||
|
config.postProcessModels(objs);
|
||||||
|
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface Generator {
|
||||||
|
Generator opts(ClientOptInput opts);
|
||||||
|
|
||||||
|
List<File> generate();
|
||||||
|
}
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
import com.samskivert.mustache.Mustache;
|
||||||
|
import com.samskivert.mustache.Template;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import org.apache.commons.cli.BasicParser;
|
||||||
|
import org.apache.commons.cli.CommandLine;
|
||||||
|
import org.apache.commons.cli.CommandLineParser;
|
||||||
|
import org.apache.commons.cli.HelpFormatter;
|
||||||
|
import org.apache.commons.cli.Options;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.Reader;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated use instead {@link io.swagger.codegen.DefaultGenerator}
|
||||||
|
* or cli interface from https://github.com/swagger-api/swagger-codegen/pull/547
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
|
public class MetaGenerator extends AbstractGenerator {
|
||||||
|
static Map<String, CodegenConfig> configs = new HashMap<String, CodegenConfig>();
|
||||||
|
static String configString;
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
new MetaGenerator().generate(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<CodegenConfig> getExtensions() {
|
||||||
|
ServiceLoader<CodegenConfig> loader = ServiceLoader.load(CodegenConfig.class);
|
||||||
|
List<CodegenConfig> output = new ArrayList<CodegenConfig>();
|
||||||
|
Iterator<CodegenConfig> itr = loader.iterator();
|
||||||
|
while (itr.hasNext()) {
|
||||||
|
output.add(itr.next());
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void usage(Options options) {
|
||||||
|
HelpFormatter formatter = new HelpFormatter();
|
||||||
|
formatter.printHelp("MetaGenerator. Generator for creating a new template set " +
|
||||||
|
"and configuration for Codegen. The output will be based on the language you " +
|
||||||
|
"specify, and includes default templates to include.", options);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CodegenConfig getConfig(String name) {
|
||||||
|
if (configs.containsKey(name)) {
|
||||||
|
return configs.get(name);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void generate(String[] args) {
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
String targetLanguage = null;
|
||||||
|
String outputFolder = null;
|
||||||
|
String name = null;
|
||||||
|
String targetPackage = "io.swagger.codegen";
|
||||||
|
final String templateDir = "codegen";
|
||||||
|
|
||||||
|
Options options = new Options();
|
||||||
|
options.addOption("h", "help", false, "shows this message");
|
||||||
|
options.addOption("l", "lang", false, "client language to generate.\nAvailable languages include:\n\t[" + configString + "]");
|
||||||
|
options.addOption("o", "output", true, "where to write the generated files");
|
||||||
|
options.addOption("n", "name", true, "the human-readable name of the generator");
|
||||||
|
options.addOption("p", "package", true, "the package to put the main class into (defaults to io.swagger.codegen");
|
||||||
|
|
||||||
|
ClientOptInput clientOptInput = new ClientOptInput();
|
||||||
|
Swagger swagger = null;
|
||||||
|
CommandLine cmd = null;
|
||||||
|
try {
|
||||||
|
CommandLineParser parser = new BasicParser();
|
||||||
|
|
||||||
|
cmd = parser.parse(options, args);
|
||||||
|
if (cmd.hasOption("h")) {
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("n")) {
|
||||||
|
name = cmd.getOptionValue("n");
|
||||||
|
} else {
|
||||||
|
System.out.println("name is required");
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("l")) {
|
||||||
|
targetLanguage = cmd.getOptionValue("l");
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("p")) {
|
||||||
|
targetPackage = cmd.getOptionValue("p");
|
||||||
|
}
|
||||||
|
if (cmd.hasOption("o")) {
|
||||||
|
outputFolder = cmd.getOptionValue("o");
|
||||||
|
} else {
|
||||||
|
System.out.println("output folder is required");
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
usage(options);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
System.out.println("writing to folder " + outputFolder);
|
||||||
|
File outputFolderLocation = new File(outputFolder);
|
||||||
|
if (!outputFolderLocation.exists()) {
|
||||||
|
outputFolderLocation.mkdirs();
|
||||||
|
}
|
||||||
|
File sourceFolder = new File(outputFolder + File.separator + "src/main/java/" + targetPackage.replace('.', File.separatorChar));
|
||||||
|
if (!sourceFolder.exists()) {
|
||||||
|
sourceFolder.mkdirs();
|
||||||
|
}
|
||||||
|
File resourcesFolder = new File(outputFolder + File.separator + "src/main/resources/META-INF/services");
|
||||||
|
if (!resourcesFolder.exists()) {
|
||||||
|
resourcesFolder.mkdirs();
|
||||||
|
}
|
||||||
|
|
||||||
|
String mainClass = Character.toUpperCase(name.charAt(0)) + name.substring(1) + "Generator";
|
||||||
|
|
||||||
|
List<SupportingFile> supportingFiles = new ArrayList<SupportingFile>();
|
||||||
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("generatorClass.mustache",
|
||||||
|
"src/main/java/" + File.separator + targetPackage.replace('.', File.separatorChar),
|
||||||
|
mainClass + ".java"));
|
||||||
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
|
supportingFiles.add(new SupportingFile("api.template", "src/main/resources" + File.separator + name, "api.mustache"));
|
||||||
|
supportingFiles.add(new SupportingFile("model.template", "src/main/resources" + File.separator + name, "model.mustache"));
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("services.mustache", "src/main/resources/META-INF/services", "io.swagger.codegen.CodegenConfig"));
|
||||||
|
|
||||||
|
List<File> files = new ArrayList<File>();
|
||||||
|
|
||||||
|
Map<String, Object> data = new HashMap<String, Object>();
|
||||||
|
data.put("generatorPackage", targetPackage);
|
||||||
|
data.put("generatorClass", mainClass);
|
||||||
|
data.put("name", name);
|
||||||
|
data.put("fullyQualifiedGeneratorClass", targetPackage + "." + mainClass);
|
||||||
|
|
||||||
|
for (SupportingFile support : supportingFiles) {
|
||||||
|
try {
|
||||||
|
String destinationFolder = outputFolder;
|
||||||
|
if (support.folder != null && !"".equals(support.folder)) {
|
||||||
|
destinationFolder += File.separator + support.folder;
|
||||||
|
}
|
||||||
|
File of = new File(destinationFolder);
|
||||||
|
if (!of.isDirectory()) {
|
||||||
|
of.mkdirs();
|
||||||
|
}
|
||||||
|
String outputFilename = destinationFolder + File.separator + support.destinationFilename;
|
||||||
|
|
||||||
|
if (support.templateFile.endsWith("mustache")) {
|
||||||
|
String template = readTemplate(templateDir + File.separator + support.templateFile);
|
||||||
|
Template tmpl = Mustache.compiler()
|
||||||
|
.withLoader(new Mustache.TemplateLoader() {
|
||||||
|
public Reader getTemplate(String name) {
|
||||||
|
return getTemplateReader(templateDir + File.separator + name + ".mustache");
|
||||||
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
})
|
||||||
|
.defaultValue("")
|
||||||
|
.compile(template);
|
||||||
|
|
||||||
|
writeToFile(outputFilename, tmpl.execute(data));
|
||||||
|
files.add(new File(outputFilename));
|
||||||
|
} else {
|
||||||
|
String template = readTemplate(templateDir + File.separator + support.templateFile);
|
||||||
|
FileUtils.writeStringToFile(new File(outputFilename), template);
|
||||||
|
System.out.println("copying file to " + outputFilename);
|
||||||
|
files.add(new File(outputFilename));
|
||||||
|
}
|
||||||
|
} catch (java.io.IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static {
|
||||||
|
List<CodegenConfig> extensions = getExtensions();
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
for (CodegenConfig config : extensions) {
|
||||||
|
if (sb.toString().length() != 0) {
|
||||||
|
sb.append(", ");
|
||||||
|
}
|
||||||
|
sb.append(config.getName());
|
||||||
|
configs.put(config.getName(), config);
|
||||||
|
configString = sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package io.swagger.codegen;
|
||||||
|
|
||||||
|
public class SupportingFile {
|
||||||
|
public String templateFile;
|
||||||
|
public String folder;
|
||||||
|
public String destinationFilename;
|
||||||
|
|
||||||
|
public SupportingFile(String templateFile, String folder, String destinationFilename) {
|
||||||
|
this.templateFile = templateFile;
|
||||||
|
this.folder = folder;
|
||||||
|
this.destinationFilename = destinationFilename;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package io.swagger.codegen.auth;
|
||||||
|
|
||||||
|
public interface AuthMethod {
|
||||||
|
String getType();
|
||||||
|
|
||||||
|
void setType(String type);
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
package io.swagger.codegen.examples;
|
||||||
|
|
||||||
|
import io.swagger.models.Model;
|
||||||
|
import io.swagger.models.ModelImpl;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.BooleanProperty;
|
||||||
|
import io.swagger.models.properties.DateProperty;
|
||||||
|
import io.swagger.models.properties.DateTimeProperty;
|
||||||
|
import io.swagger.models.properties.DecimalProperty;
|
||||||
|
import io.swagger.models.properties.DoubleProperty;
|
||||||
|
import io.swagger.models.properties.FileProperty;
|
||||||
|
import io.swagger.models.properties.FloatProperty;
|
||||||
|
import io.swagger.models.properties.IntegerProperty;
|
||||||
|
import io.swagger.models.properties.LongProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.ObjectProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.properties.RefProperty;
|
||||||
|
import io.swagger.models.properties.StringProperty;
|
||||||
|
import io.swagger.models.properties.UUIDProperty;
|
||||||
|
import io.swagger.util.Json;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class ExampleGenerator {
|
||||||
|
protected Map<String, Model> examples;
|
||||||
|
|
||||||
|
public ExampleGenerator(Map<String, Model> examples) {
|
||||||
|
this.examples = examples;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Map<String, String>> generate(Map<String, Object> examples, List<String> mediaTypes, Property property) {
|
||||||
|
List<Map<String, String>> output = new ArrayList<Map<String, String>>();
|
||||||
|
Set<String> processedModels = new HashSet<String>();
|
||||||
|
if (examples == null) {
|
||||||
|
if (mediaTypes == null) {
|
||||||
|
// assume application/json for this
|
||||||
|
mediaTypes = Arrays.asList("application/json");
|
||||||
|
}
|
||||||
|
for (String mediaType : mediaTypes) {
|
||||||
|
Map<String, String> kv = new HashMap<String, String>();
|
||||||
|
kv.put("contentType", mediaType);
|
||||||
|
if (property != null && mediaType.startsWith("application/json")) {
|
||||||
|
String example = Json.pretty(resolvePropertyToExample(mediaType, property, processedModels));
|
||||||
|
|
||||||
|
if (example != null) {
|
||||||
|
kv.put("example", example);
|
||||||
|
output.add(kv);
|
||||||
|
}
|
||||||
|
} else if (property != null && mediaType.startsWith("application/xml")) {
|
||||||
|
String example = new XmlExampleGenerator(this.examples).toXml(property);
|
||||||
|
if (example != null) {
|
||||||
|
kv.put("example", example);
|
||||||
|
output.add(kv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (Map.Entry<String, Object> entry : examples.entrySet()) {
|
||||||
|
final Map<String, String> kv = new HashMap<String, String>();
|
||||||
|
kv.put("contentType", entry.getKey());
|
||||||
|
kv.put("example", Json.pretty(entry.getValue()));
|
||||||
|
output.add(kv);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (output.size() == 0) {
|
||||||
|
Map<String, String> kv = new HashMap<String, String>();
|
||||||
|
kv.put("output", "none");
|
||||||
|
output.add(kv);
|
||||||
|
}
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Object resolvePropertyToExample(String mediaType, Property property, Set<String> processedModels) {
|
||||||
|
if (property.getExample() != null) {
|
||||||
|
return property.getExample();
|
||||||
|
} else if (property instanceof StringProperty) {
|
||||||
|
return "aeiou";
|
||||||
|
} else if (property instanceof BooleanProperty) {
|
||||||
|
return Boolean.TRUE;
|
||||||
|
} else if (property instanceof ArrayProperty) {
|
||||||
|
Property innerType = ((ArrayProperty) property).getItems();
|
||||||
|
if (innerType != null) {
|
||||||
|
Object[] output = new Object[]{
|
||||||
|
resolvePropertyToExample(mediaType, innerType, processedModels)
|
||||||
|
};
|
||||||
|
return output;
|
||||||
|
}
|
||||||
|
} else if (property instanceof DateProperty) {
|
||||||
|
return new java.util.Date(System.currentTimeMillis());
|
||||||
|
} else if (property instanceof DateTimeProperty) {
|
||||||
|
return new java.util.Date(System.currentTimeMillis());
|
||||||
|
} else if (property instanceof DecimalProperty) {
|
||||||
|
return new BigDecimal(1.3579);
|
||||||
|
} else if (property instanceof DoubleProperty) {
|
||||||
|
return new Double(3.149);
|
||||||
|
} else if (property instanceof FileProperty) {
|
||||||
|
return ""; // TODO
|
||||||
|
} else if (property instanceof FloatProperty) {
|
||||||
|
return new Float(1.23);
|
||||||
|
} else if (property instanceof IntegerProperty) {
|
||||||
|
return new Integer(123);
|
||||||
|
} else if (property instanceof LongProperty) {
|
||||||
|
return new Long(123456789);
|
||||||
|
} else if (property instanceof MapProperty) {
|
||||||
|
Map<String, Object> mp = new HashMap<String, Object>();
|
||||||
|
if (property.getName() != null) {
|
||||||
|
mp.put(property.getName(),
|
||||||
|
resolvePropertyToExample(mediaType, ((MapProperty) property).getAdditionalProperties(), processedModels));
|
||||||
|
} else {
|
||||||
|
mp.put("key",
|
||||||
|
resolvePropertyToExample(mediaType, ((MapProperty) property).getAdditionalProperties(), processedModels));
|
||||||
|
}
|
||||||
|
return mp;
|
||||||
|
} else if (property instanceof ObjectProperty) {
|
||||||
|
return "{}";
|
||||||
|
} else if (property instanceof RefProperty) {
|
||||||
|
String simpleName = ((RefProperty) property).getSimpleRef();
|
||||||
|
Model model = examples.get(simpleName);
|
||||||
|
if (model != null) {
|
||||||
|
return resolveModelToExample(simpleName, mediaType, model, processedModels);
|
||||||
|
}
|
||||||
|
} else if (property instanceof UUIDProperty) {
|
||||||
|
return "046b6c7f-0b8a-43b9-b35d-6489e6daee91";
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object resolveModelToExample(String name, String mediaType, Model model, Set<String> processedModels) {
|
||||||
|
if (processedModels.contains(name)) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
if (model instanceof ModelImpl) {
|
||||||
|
processedModels.add(name);
|
||||||
|
ModelImpl impl = (ModelImpl) model;
|
||||||
|
Map<String, Object> values = new HashMap<String, Object>();
|
||||||
|
|
||||||
|
if (impl != null && impl.getProperties() != null) {
|
||||||
|
for (String propertyName : impl.getProperties().keySet()) {
|
||||||
|
Property property = impl.getProperties().get(propertyName);
|
||||||
|
values.put(propertyName, resolvePropertyToExample(mediaType, property, processedModels));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,226 @@
|
|||||||
|
package io.swagger.codegen.examples;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.models.Model;
|
||||||
|
import io.swagger.models.ModelImpl;
|
||||||
|
import io.swagger.models.RefModel;
|
||||||
|
import io.swagger.models.Xml;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.BooleanProperty;
|
||||||
|
import io.swagger.models.properties.DateProperty;
|
||||||
|
import io.swagger.models.properties.DateTimeProperty;
|
||||||
|
import io.swagger.models.properties.IntegerProperty;
|
||||||
|
import io.swagger.models.properties.LongProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.properties.RefProperty;
|
||||||
|
import io.swagger.models.properties.StringProperty;
|
||||||
|
import org.codehaus.plexus.util.StringUtils;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
public class XmlExampleGenerator {
|
||||||
|
public static String NEWLINE = "\n";
|
||||||
|
public static String TAG_START = "<";
|
||||||
|
public static String CLOSE_TAG = ">";
|
||||||
|
public static String TAG_END = "</";
|
||||||
|
private static String EMPTY = "";
|
||||||
|
protected Map<String, Model> examples;
|
||||||
|
protected SimpleDateFormat dtFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||||
|
protected SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
|
||||||
|
|
||||||
|
public XmlExampleGenerator(Map<String, Model> examples) {
|
||||||
|
this.examples = examples;
|
||||||
|
if (examples == null) {
|
||||||
|
examples = new HashMap<String, Model>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toXml(Property property) {
|
||||||
|
return toXml(null, property, 0, Collections.<String>emptySet());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String toXml(Model model, int indent, Collection<String> path) {
|
||||||
|
if (model instanceof RefModel) {
|
||||||
|
RefModel ref = (RefModel) model;
|
||||||
|
Model actualModel = examples.get(ref.getSimpleRef());
|
||||||
|
if (actualModel instanceof ModelImpl) {
|
||||||
|
return modelImplToXml((ModelImpl) actualModel, indent, path);
|
||||||
|
}
|
||||||
|
} else if (model instanceof ModelImpl) {
|
||||||
|
return modelImplToXml((ModelImpl) model, indent, path);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String modelImplToXml(ModelImpl model, int indent, Collection<String> path) {
|
||||||
|
final String modelName = model.getName();
|
||||||
|
if (path.contains(modelName)) {
|
||||||
|
return EMPTY;
|
||||||
|
}
|
||||||
|
final Set<String> selfPath = new HashSet<String>(path);
|
||||||
|
selfPath.add(modelName);
|
||||||
|
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
// attributes
|
||||||
|
Map<String, Property> attributes = new LinkedHashMap<String, Property>();
|
||||||
|
Map<String, Property> elements = new LinkedHashMap<String, Property>();
|
||||||
|
|
||||||
|
String name = modelName;
|
||||||
|
String namespace;
|
||||||
|
String prefix;
|
||||||
|
Boolean wrapped;
|
||||||
|
|
||||||
|
Xml xml = model.getXml();
|
||||||
|
if (xml != null) {
|
||||||
|
if (xml.getName() != null) {
|
||||||
|
name = xml.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (String pName : model.getProperties().keySet()) {
|
||||||
|
Property p = model.getProperties().get(pName);
|
||||||
|
if (p != null && p.getXml() != null && p.getXml().getAttribute() != null && p.getXml().getAttribute()) {
|
||||||
|
attributes.put(pName, p);
|
||||||
|
} else {
|
||||||
|
elements.put(pName, p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sb.append(indent(indent)).append(TAG_START);
|
||||||
|
sb.append(name);
|
||||||
|
for (String pName : attributes.keySet()) {
|
||||||
|
Property p = attributes.get(pName);
|
||||||
|
sb.append(" ").append(pName).append("=").append(quote(toXml(null, p, 0, selfPath)));
|
||||||
|
}
|
||||||
|
sb.append(CLOSE_TAG);
|
||||||
|
sb.append(NEWLINE);
|
||||||
|
for (String pName : elements.keySet()) {
|
||||||
|
Property p = elements.get(pName);
|
||||||
|
final String asXml = toXml(pName, p, indent + 1, selfPath);
|
||||||
|
if (StringUtils.isEmpty(asXml)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
sb.append(asXml);
|
||||||
|
sb.append(NEWLINE);
|
||||||
|
}
|
||||||
|
sb.append(indent(indent)).append(TAG_END).append(name).append(CLOSE_TAG);
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String quote(String string) {
|
||||||
|
return "\"" + string + "\"";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String toXml(String name, Property property, int indent, Collection<String> path) {
|
||||||
|
if (property == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
|
||||||
|
if (property instanceof ArrayProperty) {
|
||||||
|
ArrayProperty p = (ArrayProperty) property;
|
||||||
|
Property inner = p.getItems();
|
||||||
|
boolean wrapped = false;
|
||||||
|
if (property.getXml() != null && property.getXml().getWrapped()) {
|
||||||
|
wrapped = true;
|
||||||
|
}
|
||||||
|
if (wrapped) {
|
||||||
|
String prefix = EMPTY;
|
||||||
|
if (name != null) {
|
||||||
|
sb.append(indent(indent));
|
||||||
|
sb.append(openTag(name));
|
||||||
|
prefix = NEWLINE;
|
||||||
|
}
|
||||||
|
final String asXml = toXml(name, inner, indent + 1, path);
|
||||||
|
if (StringUtils.isNotEmpty(asXml)) {
|
||||||
|
sb.append(prefix).append(asXml);
|
||||||
|
}
|
||||||
|
if (name != null) {
|
||||||
|
sb.append(NEWLINE);
|
||||||
|
sb.append(indent(indent));
|
||||||
|
sb.append(closeTag(name));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
sb.append(toXml(name, inner, indent, path));
|
||||||
|
}
|
||||||
|
} else if (property instanceof RefProperty) {
|
||||||
|
RefProperty ref = (RefProperty) property;
|
||||||
|
Model actualModel = examples.get(ref.getSimpleRef());
|
||||||
|
sb.append(toXml(actualModel, indent, path));
|
||||||
|
} else {
|
||||||
|
if (name != null) {
|
||||||
|
sb.append(indent(indent));
|
||||||
|
sb.append(openTag(name));
|
||||||
|
}
|
||||||
|
sb.append(getExample(property));
|
||||||
|
if (name != null) {
|
||||||
|
sb.append(closeTag(name));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getExample(Property property) {
|
||||||
|
if (property instanceof DateTimeProperty) {
|
||||||
|
if (property.getExample() != null) {
|
||||||
|
return property.getExample();
|
||||||
|
} else {
|
||||||
|
return dtFormat.format(new Date());
|
||||||
|
}
|
||||||
|
} else if (property instanceof StringProperty) {
|
||||||
|
if (property.getExample() != null) {
|
||||||
|
return property.getExample();
|
||||||
|
} else {
|
||||||
|
return "string";
|
||||||
|
}
|
||||||
|
} else if (property instanceof DateProperty) {
|
||||||
|
if (property.getExample() != null) {
|
||||||
|
return property.getExample();
|
||||||
|
} else {
|
||||||
|
return dateFormat.format(new Date());
|
||||||
|
}
|
||||||
|
} else if (property instanceof IntegerProperty) {
|
||||||
|
if (property.getExample() != null) {
|
||||||
|
return property.getExample();
|
||||||
|
} else {
|
||||||
|
return "0";
|
||||||
|
}
|
||||||
|
} else if (property instanceof BooleanProperty) {
|
||||||
|
if (property.getExample() != null) {
|
||||||
|
return property.getExample();
|
||||||
|
} else {
|
||||||
|
return "true";
|
||||||
|
}
|
||||||
|
} else if (property instanceof LongProperty) {
|
||||||
|
if (property.getExample() != null) {
|
||||||
|
return property.getExample();
|
||||||
|
} else {
|
||||||
|
return "123456";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "not implemented " + property;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String openTag(String name) {
|
||||||
|
return "<" + name + ">";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String closeTag(String name) {
|
||||||
|
return "</" + name + ">";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String indent(int indent) {
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
for (int i = 0; i < indent; i++) {
|
||||||
|
sb.append(" ");
|
||||||
|
}
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.*;
|
||||||
|
import io.swagger.models.properties.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
public abstract class AbstractTypeScriptClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
@Override
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public AbstractTypeScriptClientCodegen() {
|
||||||
|
super();
|
||||||
|
supportsInheritance = true;
|
||||||
|
reservedWords = new HashSet<String>(Arrays.asList("abstract",
|
||||||
|
"continue", "for", "new", "switch", "assert", "default", "if",
|
||||||
|
"package", "synchronized", "do", "goto", "private",
|
||||||
|
"this", "break", "double", "implements", "protected", "throw",
|
||||||
|
"byte", "else", "import", "public", "throws", "case", "enum",
|
||||||
|
"instanceof", "return", "transient", "catch", "extends", "int",
|
||||||
|
"short", "try", "char", "final", "interface", "static", "void",
|
||||||
|
"class", "finally", "const", "super", "while"));
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"boolean",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Integer",
|
||||||
|
"Long",
|
||||||
|
"Float",
|
||||||
|
"Object"));
|
||||||
|
instantiationTypes.put("array", "Array");
|
||||||
|
|
||||||
|
typeMapping = new HashMap<String, String>();
|
||||||
|
typeMapping.put("Array", "Array");
|
||||||
|
typeMapping.put("array", "Array");
|
||||||
|
typeMapping.put("List", "Array");
|
||||||
|
typeMapping.put("boolean", "boolean");
|
||||||
|
typeMapping.put("string", "string");
|
||||||
|
typeMapping.put("int", "number");
|
||||||
|
typeMapping.put("float", "number");
|
||||||
|
typeMapping.put("number", "number");
|
||||||
|
typeMapping.put("long", "number");
|
||||||
|
typeMapping.put("short", "number");
|
||||||
|
typeMapping.put("char", "string");
|
||||||
|
typeMapping.put("double", "number");
|
||||||
|
typeMapping.put("object", "any");
|
||||||
|
typeMapping.put("integer", "number");
|
||||||
|
typeMapping.put("Map", "any");
|
||||||
|
typeMapping.put("DateTime", "Date");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return outputFolder + "/" + apiPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return outputFolder + "/" + modelPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// if it's all uppper case, do nothing
|
||||||
|
if (name.matches("^[A-Z_]*$"))
|
||||||
|
return name;
|
||||||
|
|
||||||
|
// camelize the variable name
|
||||||
|
// pet_id => PetId
|
||||||
|
name = camelize(name, true);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*"))
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
// should be the same as variable name
|
||||||
|
return toVarName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelName(String name) {
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(name))
|
||||||
|
throw new RuntimeException(name
|
||||||
|
+ " (reserved word) cannot be used as a model name");
|
||||||
|
|
||||||
|
// camelize the model name
|
||||||
|
// phone_number => PhoneNumber
|
||||||
|
return camelize(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
|
// should be the same as the model name
|
||||||
|
return toModelName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
return "{ [key: string]: "+ getTypeDeclaration(inner) + "; }";
|
||||||
|
} else if (p instanceof FileProperty) {
|
||||||
|
return "any";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType)) {
|
||||||
|
type = typeMapping.get(swaggerType);
|
||||||
|
if (languageSpecificPrimitives.contains(type))
|
||||||
|
return type;
|
||||||
|
} else
|
||||||
|
type = swaggerType;
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,404 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import com.google.common.base.CaseFormat;
|
||||||
|
import com.samskivert.mustache.Mustache;
|
||||||
|
import com.samskivert.mustache.Template;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenOperation;
|
||||||
|
import io.swagger.codegen.CodegenProperty;
|
||||||
|
import io.swagger.codegen.CodegenResponse;
|
||||||
|
import io.swagger.codegen.CodegenSecurity;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.auth.SecuritySchemeDefinition;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.BooleanProperty;
|
||||||
|
import io.swagger.models.properties.DateProperty;
|
||||||
|
import io.swagger.models.properties.DateTimeProperty;
|
||||||
|
import io.swagger.models.properties.DoubleProperty;
|
||||||
|
import io.swagger.models.properties.FloatProperty;
|
||||||
|
import io.swagger.models.properties.IntegerProperty;
|
||||||
|
import io.swagger.models.properties.LongProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.properties.StringProperty;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
import java.io.Writer;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class AkkaScalaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String mainPackage = "io.swagger.client";
|
||||||
|
protected String invokerPackage = mainPackage + ".core";
|
||||||
|
protected String groupId = "io.swagger";
|
||||||
|
protected String artifactId = "swagger-client";
|
||||||
|
protected String artifactVersion = "1.0.0";
|
||||||
|
protected String sourceFolder = "src/main/scala";
|
||||||
|
protected String resourcesFolder = "src/main/resources";
|
||||||
|
protected String configKey = "apiRequest";
|
||||||
|
protected int defaultTimeoutInMs = 5000;
|
||||||
|
protected String configKeyPath = mainPackage;
|
||||||
|
protected boolean registerNonStandardStatusCodes = true;
|
||||||
|
protected boolean renderJavadoc = true;
|
||||||
|
protected boolean removeOAuthSecurities = true;
|
||||||
|
/**
|
||||||
|
* If set to true, only the default response (the one with le lowest 2XX code) will be considered as a success, and all
|
||||||
|
* others as ApiErrors.
|
||||||
|
* If set to false, all responses defined in the model will be considered as a success upon reception. Only http errors,
|
||||||
|
* unmarshalling problems and any other RuntimeException will be considered as ApiErrors.
|
||||||
|
*/
|
||||||
|
protected boolean onlyOneSuccess = true;
|
||||||
|
Logger LOGGER = LoggerFactory.getLogger(AkkaScalaClientCodegen.class);
|
||||||
|
|
||||||
|
public AkkaScalaClientCodegen() {
|
||||||
|
super();
|
||||||
|
outputFolder = "generated-code/scala";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".scala");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".scala");
|
||||||
|
templateDir = "akka-scala";
|
||||||
|
apiPackage = mainPackage + ".api";
|
||||||
|
modelPackage = mainPackage + ".model";
|
||||||
|
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"abstract", "case", "catch", "class", "def", "do", "else", "extends",
|
||||||
|
"false", "final", "finally", "for", "forSome", "if", "implicit",
|
||||||
|
"import", "lazy", "match", "new", "null", "object", "override", "package",
|
||||||
|
"private", "protected", "return", "sealed", "super", "this", "throw",
|
||||||
|
"trait", "try", "true", "type", "val", "var", "while", "with", "yield")
|
||||||
|
);
|
||||||
|
|
||||||
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
additionalProperties.put("groupId", groupId);
|
||||||
|
additionalProperties.put("artifactId", artifactId);
|
||||||
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
additionalProperties.put("configKey", configKey);
|
||||||
|
additionalProperties.put("configKeyPath", configKeyPath);
|
||||||
|
additionalProperties.put("defaultTimeout", defaultTimeoutInMs);
|
||||||
|
if (renderJavadoc) {
|
||||||
|
additionalProperties.put("javadocRenderer", new JavadocLambda());
|
||||||
|
}
|
||||||
|
additionalProperties.put("fnCapitalize", new CapitalizeLambda());
|
||||||
|
additionalProperties.put("fnCamelize", new CamelizeLambda(false));
|
||||||
|
additionalProperties.put("fnEnumEntry", new EnumEntryLambda());
|
||||||
|
additionalProperties.put("onlyOneSuccess", onlyOneSuccess);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("reference.mustache", resourcesFolder, "reference.conf"));
|
||||||
|
final String invokerFolder = (sourceFolder + File.separator + invokerPackage).replace(".", File.separator);
|
||||||
|
supportingFiles.add(new SupportingFile("apiRequest.mustache", invokerFolder, "ApiRequest.scala"));
|
||||||
|
supportingFiles.add(new SupportingFile("apiInvoker.mustache", invokerFolder, "ApiInvoker.scala"));
|
||||||
|
supportingFiles.add(new SupportingFile("requests.mustache", invokerFolder, "requests.scala"));
|
||||||
|
supportingFiles.add(new SupportingFile("apiSettings.mustache", invokerFolder, "ApiSettings.scala"));
|
||||||
|
final String apiFolder = (sourceFolder + File.separator + apiPackage).replace(".", File.separator);
|
||||||
|
supportingFiles.add(new SupportingFile("enumsSerializers.mustache", apiFolder, "EnumsSerializers.scala"));
|
||||||
|
|
||||||
|
importMapping.remove("Seq");
|
||||||
|
importMapping.remove("List");
|
||||||
|
importMapping.remove("Set");
|
||||||
|
importMapping.remove("Map");
|
||||||
|
|
||||||
|
importMapping.put("DateTime", "org.joda.time.DateTime");
|
||||||
|
|
||||||
|
typeMapping = new HashMap<String, String>();
|
||||||
|
typeMapping.put("array", "Seq");
|
||||||
|
typeMapping.put("set", "Set");
|
||||||
|
typeMapping.put("boolean", "Boolean");
|
||||||
|
typeMapping.put("string", "String");
|
||||||
|
typeMapping.put("int", "Int");
|
||||||
|
typeMapping.put("integer", "Int");
|
||||||
|
typeMapping.put("long", "Long");
|
||||||
|
typeMapping.put("float", "Float");
|
||||||
|
typeMapping.put("byte", "Byte");
|
||||||
|
typeMapping.put("short", "Short");
|
||||||
|
typeMapping.put("char", "Char");
|
||||||
|
typeMapping.put("long", "Long");
|
||||||
|
typeMapping.put("double", "Double");
|
||||||
|
typeMapping.put("object", "Any");
|
||||||
|
typeMapping.put("file", "File");
|
||||||
|
typeMapping.put("number", "Double");
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"boolean",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Int",
|
||||||
|
"Long",
|
||||||
|
"Float",
|
||||||
|
"Object",
|
||||||
|
"List",
|
||||||
|
"Seq",
|
||||||
|
"Map")
|
||||||
|
);
|
||||||
|
instantiationTypes.put("array", "ListBuffer");
|
||||||
|
instantiationTypes.put("map", "Map");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "akka-scala";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a Scala client library base on Akka/Spray.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "`" + name + "`";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||||
|
if (registerNonStandardStatusCodes) {
|
||||||
|
try {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, ArrayList<CodegenOperation>> opsMap = (Map<String, ArrayList<CodegenOperation>>) objs.get("operations");
|
||||||
|
HashSet<Integer> unknownCodes = new HashSet<Integer>();
|
||||||
|
for (CodegenOperation operation : opsMap.get("operation")) {
|
||||||
|
for (CodegenResponse response : operation.responses) {
|
||||||
|
if ("default".equals(response.code)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
int code = Integer.parseInt(response.code);
|
||||||
|
if (code >= 600) {
|
||||||
|
unknownCodes.add(code);
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
LOGGER.error("Status code is not an integer : response.code", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!unknownCodes.isEmpty()) {
|
||||||
|
additionalProperties.put("unknownStatusCodes", unknownCodes);
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOGGER.error("Unable to find operations List", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return super.postProcessOperations(objs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "[" + getTypeDeclaration(inner) + "]";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSwaggerType(p) + "[String, " + getTypeDeclaration(inner) + "]";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CodegenSecurity> fromSecurity(Map<String, SecuritySchemeDefinition> schemes) {
|
||||||
|
final List<CodegenSecurity> codegenSecurities = super.fromSecurity(schemes);
|
||||||
|
if (!removeOAuthSecurities) {
|
||||||
|
return codegenSecurities;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove OAuth securities
|
||||||
|
Iterator<CodegenSecurity> it = codegenSecurities.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
final CodegenSecurity security = it.next();
|
||||||
|
if (security.isOAuth) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Adapt 'hasMore'
|
||||||
|
it = codegenSecurities.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
final CodegenSecurity security = it.next();
|
||||||
|
security.hasMore = it.hasNext();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (codegenSecurities.isEmpty()) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return codegenSecurities;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toOperationId(String operationId) {
|
||||||
|
// throw exception if method name is empty
|
||||||
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.toOperationId(CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, operationId));
|
||||||
|
}
|
||||||
|
|
||||||
|
private String formatIdentifier(String name, boolean capitalized) {
|
||||||
|
String identifier = camelize(name, true);
|
||||||
|
if (capitalized) {
|
||||||
|
identifier = StringUtils.capitalize(identifier);
|
||||||
|
}
|
||||||
|
if (identifier.matches("[a-zA-Z_$][\\w_$]+") && !reservedWords.contains(identifier)) {
|
||||||
|
return identifier;
|
||||||
|
}
|
||||||
|
return escapeReservedWord(identifier);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
return formatIdentifier(name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
return formatIdentifier(name, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toEnumName(CodegenProperty property) {
|
||||||
|
return formatIdentifier(property.baseName, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type;
|
||||||
|
if (typeMapping.containsKey(swaggerType)) {
|
||||||
|
type = typeMapping.get(swaggerType);
|
||||||
|
if (languageSpecificPrimitives.contains(type)) {
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toInstantiationType(Property p) {
|
||||||
|
if (p instanceof MapProperty) {
|
||||||
|
MapProperty ap = (MapProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||||
|
return instantiationTypes.get("map") + "[String, " + inner + "]";
|
||||||
|
} else if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getItems());
|
||||||
|
return instantiationTypes.get("array") + "[" + inner + "]";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toDefaultValue(Property p) {
|
||||||
|
if (!p.getRequired()) {
|
||||||
|
return "None";
|
||||||
|
}
|
||||||
|
if (p instanceof StringProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof BooleanProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DateProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DateTimeProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DoubleProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof FloatProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof IntegerProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof LongProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty ap = (MapProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||||
|
return "Map[String, " + inner + "].empty ";
|
||||||
|
} else if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getItems());
|
||||||
|
return "Seq[" + inner + "].empty ";
|
||||||
|
} else {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static abstract class CustomLambda implements Mustache.Lambda {
|
||||||
|
@Override
|
||||||
|
public void execute(Template.Fragment frag, Writer out) throws IOException {
|
||||||
|
final StringWriter tempWriter = new StringWriter();
|
||||||
|
frag.execute(tempWriter);
|
||||||
|
out.write(formatFragment(tempWriter.toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract String formatFragment(String fragment);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private static class JavadocLambda extends CustomLambda {
|
||||||
|
@Override
|
||||||
|
public String formatFragment(String fragment) {
|
||||||
|
final String[] lines = fragment.split("\\r?\\n");
|
||||||
|
final StringBuilder sb = new StringBuilder();
|
||||||
|
sb.append(" /**\n");
|
||||||
|
for (String line : lines) {
|
||||||
|
sb.append(" * ").append(line).append("\n");
|
||||||
|
}
|
||||||
|
sb.append(" */\n");
|
||||||
|
return sb.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class CapitalizeLambda extends CustomLambda {
|
||||||
|
@Override
|
||||||
|
public String formatFragment(String fragment) {
|
||||||
|
return StringUtils.capitalize(fragment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static class CamelizeLambda extends CustomLambda {
|
||||||
|
private final boolean capitalizeFirst;
|
||||||
|
|
||||||
|
public CamelizeLambda(boolean capitalizeFirst) {
|
||||||
|
this.capitalizeFirst = capitalizeFirst;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String formatFragment(String fragment) {
|
||||||
|
return camelize(fragment, !capitalizeFirst);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private class EnumEntryLambda extends CustomLambda {
|
||||||
|
@Override
|
||||||
|
public String formatFragment(String fragment) {
|
||||||
|
return formatIdentifier(fragment, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,274 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String invokerPackage = "io.swagger.client";
|
||||||
|
protected String groupId = "io.swagger";
|
||||||
|
protected String artifactId = "swagger-android-client";
|
||||||
|
protected String artifactVersion = "1.0.0";
|
||||||
|
protected String projectFolder = "src/main";
|
||||||
|
protected String sourceFolder = projectFolder + "/java";
|
||||||
|
protected Boolean useAndroidMavenGradlePlugin = true;
|
||||||
|
|
||||||
|
public AndroidClientCodegen() {
|
||||||
|
super();
|
||||||
|
outputFolder = "generated-code/android";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".java");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".java");
|
||||||
|
templateDir = "android-java";
|
||||||
|
apiPackage = "io.swagger.client.api";
|
||||||
|
modelPackage = "io.swagger.client.model";
|
||||||
|
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"abstract", "continue", "for", "new", "switch", "assert",
|
||||||
|
"default", "if", "package", "synchronized", "boolean", "do", "goto", "private",
|
||||||
|
"this", "break", "double", "implements", "protected", "throw", "byte", "else",
|
||||||
|
"import", "public", "throws", "case", "enum", "instanceof", "return", "transient",
|
||||||
|
"catch", "extends", "int", "short", "try", "char", "final", "interface", "static",
|
||||||
|
"void", "class", "finally", "long", "strictfp", "volatile", "const", "float",
|
||||||
|
"native", "super", "while")
|
||||||
|
);
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"boolean",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Integer",
|
||||||
|
"Long",
|
||||||
|
"Float",
|
||||||
|
"Object")
|
||||||
|
);
|
||||||
|
instantiationTypes.put("array", "ArrayList");
|
||||||
|
instantiationTypes.put("map", "HashMap");
|
||||||
|
|
||||||
|
cliOptions.add(new CliOption("invokerPackage", "root package to use for the generated code"));
|
||||||
|
cliOptions.add(new CliOption("groupId", "groupId for use in the generated build.gradle and pom.xml"));
|
||||||
|
cliOptions.add(new CliOption("artifactId", "artifactId for use in the generated build.gradle and pom.xml"));
|
||||||
|
cliOptions.add(new CliOption("artifactVersion", "artifact version for use in the generated build.gradle and pom.xml"));
|
||||||
|
cliOptions.add(new CliOption("sourceFolder", "source folder for generated code"));
|
||||||
|
cliOptions.add(new CliOption("useAndroidMavenGradlePlugin", "A flag to toggle android-maven gradle plugin. Default is true."));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "android";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates an Android client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSwaggerType(p) + "<String, " + getTypeDeclaration(inner) + ">";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType)) {
|
||||||
|
type = typeMapping.get(swaggerType);
|
||||||
|
if (languageSpecificPrimitives.contains(type)) {
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// if it's all uppper case, do nothing
|
||||||
|
if (name.matches("^[A-Z_]*$")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize (lower first character) the variable name
|
||||||
|
// pet_id => petId
|
||||||
|
name = camelize(name, true);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
// should be the same as variable name
|
||||||
|
return toVarName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelName(String name) {
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(name)) {
|
||||||
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize the model name
|
||||||
|
// phone_number => PhoneNumber
|
||||||
|
return camelize(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
|
// should be the same as the model name
|
||||||
|
return toModelName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toOperationId(String operationId) {
|
||||||
|
// throw exception if method name is empty
|
||||||
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// method name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(operationId)) {
|
||||||
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelize(operationId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("invokerPackage")) {
|
||||||
|
this.setInvokerPackage((String) additionalProperties.get("invokerPackage"));
|
||||||
|
} else {
|
||||||
|
//not set, use default to be passed to template
|
||||||
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("groupId")) {
|
||||||
|
this.setGroupId((String) additionalProperties.get("groupId"));
|
||||||
|
} else {
|
||||||
|
//not set, use to be passed to template
|
||||||
|
additionalProperties.put("groupId", groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("artifactId")) {
|
||||||
|
this.setArtifactId((String) additionalProperties.get("artifactId"));
|
||||||
|
} else {
|
||||||
|
//not set, use to be passed to template
|
||||||
|
additionalProperties.put("artifactId", artifactId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("artifactVersion")) {
|
||||||
|
this.setArtifactVersion((String) additionalProperties.get("artifactVersion"));
|
||||||
|
} else {
|
||||||
|
//not set, use to be passed to template
|
||||||
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("sourceFolder")) {
|
||||||
|
this.setSourceFolder((String) additionalProperties.get("sourceFolder"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("useAndroidMavenGradlePlugin")) {
|
||||||
|
this.setUseAndroidMavenGradlePlugin((Boolean) additionalProperties.get("useAndroidMavenGradlePlugin"));
|
||||||
|
} else {
|
||||||
|
additionalProperties.put("useAndroidMavenGradlePlugin", useAndroidMavenGradlePlugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
|
additionalProperties.put("useAndroidMavenGradlePlugin", useAndroidMavenGradlePlugin);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("settings.gradle.mustache", "", "settings.gradle"));
|
||||||
|
supportingFiles.add(new SupportingFile("build.mustache", "", "build.gradle"));
|
||||||
|
supportingFiles.add(new SupportingFile("manifest.mustache", projectFolder, "AndroidManifest.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("apiInvoker.mustache",
|
||||||
|
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "ApiInvoker.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("httpPatch.mustache",
|
||||||
|
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "HttpPatch.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("jsonUtil.mustache",
|
||||||
|
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "JsonUtil.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("apiException.mustache",
|
||||||
|
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "ApiException.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("Pair.mustache",
|
||||||
|
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), "Pair.java"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getUseAndroidMavenGradlePlugin() {
|
||||||
|
return useAndroidMavenGradlePlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUseAndroidMavenGradlePlugin(Boolean useAndroidMavenGradlePlugin) {
|
||||||
|
this.useAndroidMavenGradlePlugin = useAndroidMavenGradlePlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvokerPackage(String invokerPackage) {
|
||||||
|
this.invokerPackage = invokerPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupId(String groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtifactId(String artifactId) {
|
||||||
|
this.artifactId = artifactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtifactVersion(String artifactVersion) {
|
||||||
|
this.artifactVersion = artifactVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceFolder(String sourceFolder) {
|
||||||
|
this.sourceFolder = sourceFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,209 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.BooleanProperty;
|
||||||
|
import io.swagger.models.properties.DateProperty;
|
||||||
|
import io.swagger.models.properties.DateTimeProperty;
|
||||||
|
import io.swagger.models.properties.DoubleProperty;
|
||||||
|
import io.swagger.models.properties.FloatProperty;
|
||||||
|
import io.swagger.models.properties.IntegerProperty;
|
||||||
|
import io.swagger.models.properties.LongProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.properties.StringProperty;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class AsyncScalaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String invokerPackage = "io.swagger.client";
|
||||||
|
protected String groupId = "io.swagger";
|
||||||
|
protected String artifactId = "swagger-async-scala-client";
|
||||||
|
protected String artifactVersion = "1.0.0";
|
||||||
|
protected String sourceFolder = "src/main/scala";
|
||||||
|
protected String clientName = "SwaggerClient";
|
||||||
|
protected String authScheme = "";
|
||||||
|
protected boolean authPreemptive = false;
|
||||||
|
protected boolean asyncHttpClient = !authScheme.isEmpty();
|
||||||
|
|
||||||
|
public AsyncScalaClientCodegen() {
|
||||||
|
super();
|
||||||
|
outputFolder = "generated-code/async-scala";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".scala");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".scala");
|
||||||
|
templateDir = "asyncscala";
|
||||||
|
apiPackage = "io.swagger.client.api";
|
||||||
|
modelPackage = "io.swagger.client.model";
|
||||||
|
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"abstract", "case", "catch", "class", "def", "do", "else", "extends",
|
||||||
|
"false", "final", "finally", "for", "forSome", "if", "implicit",
|
||||||
|
"import", "lazy", "match", "new", "null", "object", "override", "package",
|
||||||
|
"private", "protected", "return", "sealed", "super", "this", "throw",
|
||||||
|
"trait", "try", "true", "type", "val", "var", "while", "with", "yield")
|
||||||
|
);
|
||||||
|
|
||||||
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
additionalProperties.put("groupId", groupId);
|
||||||
|
additionalProperties.put("artifactId", artifactId);
|
||||||
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
additionalProperties.put("asyncHttpClient", asyncHttpClient);
|
||||||
|
additionalProperties.put("authScheme", authScheme);
|
||||||
|
additionalProperties.put("authPreemptive", authPreemptive);
|
||||||
|
additionalProperties.put("clientName", clientName);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("sbt.mustache", "", "build.sbt"));
|
||||||
|
supportingFiles.add(new SupportingFile("client.mustache",
|
||||||
|
(sourceFolder + File.separator + invokerPackage).replace(".", java.io.File.separator), clientName + ".scala"));
|
||||||
|
|
||||||
|
importMapping.remove("List");
|
||||||
|
importMapping.remove("Set");
|
||||||
|
importMapping.remove("Map");
|
||||||
|
|
||||||
|
importMapping.put("DateTime", "org.joda.time.DateTime");
|
||||||
|
importMapping.put("ListBuffer", "scala.collections.mutable.ListBuffer");
|
||||||
|
|
||||||
|
typeMapping = new HashMap<String, String>();
|
||||||
|
typeMapping.put("enum", "NSString");
|
||||||
|
typeMapping.put("array", "List");
|
||||||
|
typeMapping.put("set", "Set");
|
||||||
|
typeMapping.put("boolean", "Boolean");
|
||||||
|
typeMapping.put("string", "String");
|
||||||
|
typeMapping.put("int", "Int");
|
||||||
|
typeMapping.put("long", "Long");
|
||||||
|
typeMapping.put("float", "Float");
|
||||||
|
typeMapping.put("byte", "Byte");
|
||||||
|
typeMapping.put("short", "Short");
|
||||||
|
typeMapping.put("char", "Char");
|
||||||
|
typeMapping.put("long", "Long");
|
||||||
|
typeMapping.put("double", "Double");
|
||||||
|
typeMapping.put("object", "Any");
|
||||||
|
typeMapping.put("file", "File");
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"boolean",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Int",
|
||||||
|
"Long",
|
||||||
|
"Float",
|
||||||
|
"Object",
|
||||||
|
"List",
|
||||||
|
"Map")
|
||||||
|
);
|
||||||
|
instantiationTypes.put("array", "ListBuffer");
|
||||||
|
instantiationTypes.put("map", "HashMap");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "async-scala";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates an Asynchronous Scala client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "[" + getTypeDeclaration(inner) + "]";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSwaggerType(p) + "[String, " + getTypeDeclaration(inner) + "]";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType)) {
|
||||||
|
type = typeMapping.get(swaggerType);
|
||||||
|
if (languageSpecificPrimitives.contains(type)) {
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toInstantiationType(Property p) {
|
||||||
|
if (p instanceof MapProperty) {
|
||||||
|
MapProperty ap = (MapProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||||
|
return instantiationTypes.get("map") + "[String, " + inner + "]";
|
||||||
|
} else if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getItems());
|
||||||
|
return instantiationTypes.get("array") + "[" + inner + "]";
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toDefaultValue(Property p) {
|
||||||
|
if (p instanceof StringProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof BooleanProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DateProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DateTimeProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DoubleProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof FloatProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof IntegerProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof LongProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty ap = (MapProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||||
|
return "new HashMap[String, " + inner + "]() ";
|
||||||
|
} else if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getItems());
|
||||||
|
return "new ListBuffer[" + inner + "]() ";
|
||||||
|
} else {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class CSharpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String packageName = "IO.Swagger";
|
||||||
|
protected String packageVersion = "1.0.0";
|
||||||
|
protected String clientPackage = "IO.Swagger.Client";
|
||||||
|
protected String sourceFolder = "src" + File.separator + "main" + File.separator + "csharp";
|
||||||
|
|
||||||
|
public CSharpClientCodegen() {
|
||||||
|
super();
|
||||||
|
outputFolder = "generated-code" + File.separator + "csharp";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".cs");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".cs");
|
||||||
|
templateDir = "csharp";
|
||||||
|
apiPackage = "IO.Swagger.Api";
|
||||||
|
modelPackage = "IO.Swagger.Model";
|
||||||
|
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while")
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"string",
|
||||||
|
"bool?",
|
||||||
|
"double?",
|
||||||
|
"int?",
|
||||||
|
"long?",
|
||||||
|
"float?",
|
||||||
|
"byte[]",
|
||||||
|
"List",
|
||||||
|
"Dictionary",
|
||||||
|
"DateTime?",
|
||||||
|
"String",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Integer",
|
||||||
|
"Long",
|
||||||
|
"Float",
|
||||||
|
"Stream", // not really a primitive, we include it to avoid model import
|
||||||
|
"Object")
|
||||||
|
);
|
||||||
|
instantiationTypes.put("array", "List");
|
||||||
|
instantiationTypes.put("map", "Dictionary");
|
||||||
|
|
||||||
|
typeMapping = new HashMap<String, String>();
|
||||||
|
typeMapping.put("string", "string");
|
||||||
|
typeMapping.put("boolean", "bool?");
|
||||||
|
typeMapping.put("integer", "int?");
|
||||||
|
typeMapping.put("float", "float?");
|
||||||
|
typeMapping.put("long", "long?");
|
||||||
|
typeMapping.put("double", "double?");
|
||||||
|
typeMapping.put("number", "double?");
|
||||||
|
typeMapping.put("datetime", "DateTime?");
|
||||||
|
typeMapping.put("date", "DateTime?");
|
||||||
|
typeMapping.put("file", "Stream");
|
||||||
|
typeMapping.put("array", "List");
|
||||||
|
typeMapping.put("list", "List");
|
||||||
|
typeMapping.put("map", "Dictionary");
|
||||||
|
typeMapping.put("object", "Object");
|
||||||
|
|
||||||
|
cliOptions.clear();
|
||||||
|
cliOptions.add(new CliOption("packageName", "C# package name (convention: Camel.Case), default: IO.Swagger"));
|
||||||
|
cliOptions.add(new CliOption("packageVersion", "C# package version, default: 1.0.0"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("packageVersion")) {
|
||||||
|
packageVersion = (String) additionalProperties.get("packageVersion");
|
||||||
|
} else {
|
||||||
|
additionalProperties.put("packageVersion", packageVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("packageName")) {
|
||||||
|
packageName = (String) additionalProperties.get("packageName");
|
||||||
|
apiPackage = packageName + ".Api";
|
||||||
|
modelPackage = packageName + ".Model";
|
||||||
|
clientPackage = packageName + ".Client";
|
||||||
|
} else {
|
||||||
|
additionalProperties.put("packageName", packageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
additionalProperties.put("clientPackage", clientPackage);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("Configuration.mustache",
|
||||||
|
(sourceFolder + File.separator + clientPackage).replace(".", java.io.File.separator), "Configuration.cs"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiClient.mustache",
|
||||||
|
(sourceFolder + File.separator + clientPackage).replace(".", java.io.File.separator), "ApiClient.cs"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiException.mustache",
|
||||||
|
(sourceFolder + File.separator + clientPackage).replace(".", java.io.File.separator), "ApiException.cs"));
|
||||||
|
supportingFiles.add(new SupportingFile("Newtonsoft.Json.dll", "bin", "Newtonsoft.Json.dll"));
|
||||||
|
supportingFiles.add(new SupportingFile("RestSharp.dll", "bin", "RestSharp.dll"));
|
||||||
|
supportingFiles.add(new SupportingFile("compile.mustache", "", "compile.bat"));
|
||||||
|
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "csharp";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a CSharp client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return (outputFolder + File.separator + sourceFolder + File.separator + apiPackage()).replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return (outputFolder + File.separator + sourceFolder + File.separator + modelPackage()).replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// if it's all uppper case, do nothing
|
||||||
|
if (name.matches("^[A-Z_]*$")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize the variable name
|
||||||
|
// pet_id => PetId
|
||||||
|
name = camelize(name);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// if it's all uppper case, do nothing
|
||||||
|
if (name.matches("^[A-Z_]*$")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize(lower) the variable name
|
||||||
|
// pet_id => petId
|
||||||
|
name = camelize(name, true);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelName(String name) {
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(name)) {
|
||||||
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize the model name
|
||||||
|
// phone_number => PhoneNumber
|
||||||
|
return camelize(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
|
// should be the same as the model name
|
||||||
|
return toModelName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSwaggerType(p) + "<String, " + getTypeDeclaration(inner) + ">";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType.toLowerCase())) {
|
||||||
|
type = typeMapping.get(swaggerType.toLowerCase());
|
||||||
|
if (languageSpecificPrimitives.contains(type)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toOperationId(String operationId) {
|
||||||
|
// throw exception if method name is empty
|
||||||
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// method name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(operationId)) {
|
||||||
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelize(operationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
public enum CodeGenStatus {
|
||||||
|
UNRUN, SUCCESSFUL, FAILED
|
||||||
|
}
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
|
||||||
|
public class CsharpDotNet2ClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String packageName = "IO.Swagger";
|
||||||
|
protected String packageVersion = "1.0.0";
|
||||||
|
protected String clientPackage = "IO.Swagger.Client";
|
||||||
|
protected String sourceFolder = "src" + File.separator + "main" + File.separator + "CsharpDotNet2";
|
||||||
|
|
||||||
|
public CsharpDotNet2ClientCodegen() {
|
||||||
|
super();
|
||||||
|
outputFolder = "generated-code" + File.separator + "CsharpDotNet2";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".cs");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".cs");
|
||||||
|
templateDir = "CsharpDotNet2";
|
||||||
|
apiPackage = "IO.Swagger.Api";
|
||||||
|
modelPackage = "IO.Swagger.Model";
|
||||||
|
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"abstract", "as", "base", "bool", "break", "byte", "case", "catch", "char", "checked", "class", "const", "continue", "decimal", "default", "delegate", "do", "double", "else", "enum", "event", "explicit", "extern", "false", "finally", "fixed", "float", "for", "foreach", "goto", "if", "implicit", "in", "int", "interface", "internal", "is", "lock", "long", "namespace", "new", "null", "object", "operator", "out", "override", "params", "private", "protected", "public", "readonly", "ref", "return", "sbyte", "sealed", "short", "sizeof", "stackalloc", "static", "string", "struct", "switch", "this", "throw", "true", "try", "typeof", "uint", "ulong", "unchecked", "unsafe", "ushort", "using", "virtual", "void", "volatile", "while")
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"string",
|
||||||
|
"bool?",
|
||||||
|
"double?",
|
||||||
|
"int?",
|
||||||
|
"long?",
|
||||||
|
"float?",
|
||||||
|
"byte[]",
|
||||||
|
"List",
|
||||||
|
"Dictionary",
|
||||||
|
"DateTime?",
|
||||||
|
"String",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Integer",
|
||||||
|
"Long",
|
||||||
|
"Float",
|
||||||
|
"Stream", // not really a primitive, we include it to avoid model import
|
||||||
|
"Object")
|
||||||
|
);
|
||||||
|
instantiationTypes.put("array", "List");
|
||||||
|
instantiationTypes.put("map", "Dictionary");
|
||||||
|
|
||||||
|
typeMapping = new HashMap<String, String>();
|
||||||
|
typeMapping.put("string", "string");
|
||||||
|
typeMapping.put("boolean", "bool?");
|
||||||
|
typeMapping.put("integer", "int?");
|
||||||
|
typeMapping.put("float", "float?");
|
||||||
|
typeMapping.put("long", "long?");
|
||||||
|
typeMapping.put("double", "double?");
|
||||||
|
typeMapping.put("number", "double?");
|
||||||
|
typeMapping.put("datetime", "DateTime?");
|
||||||
|
typeMapping.put("date", "DateTime?");
|
||||||
|
typeMapping.put("file", "Stream");
|
||||||
|
typeMapping.put("array", "List");
|
||||||
|
typeMapping.put("list", "List");
|
||||||
|
typeMapping.put("map", "Dictionary");
|
||||||
|
typeMapping.put("object", "Object");
|
||||||
|
|
||||||
|
cliOptions.clear();
|
||||||
|
cliOptions.add(new CliOption("packageName", "C# package name (convention: Camel.Case), default: IO.Swagger"));
|
||||||
|
cliOptions.add(new CliOption("packageVersion", "C# package version, default: 1.0.0"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("packageVersion")) {
|
||||||
|
packageVersion = (String) additionalProperties.get("packageVersion");
|
||||||
|
} else {
|
||||||
|
additionalProperties.put("packageVersion", packageVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("packageName")) {
|
||||||
|
packageName = (String) additionalProperties.get("packageName");
|
||||||
|
apiPackage = packageName + ".Api";
|
||||||
|
modelPackage = packageName + ".Model";
|
||||||
|
clientPackage = packageName + ".Client";
|
||||||
|
} else {
|
||||||
|
additionalProperties.put("packageName", packageName);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("clientPackage")) {
|
||||||
|
this.setClientPackage((String) additionalProperties.get("clientPackage"));
|
||||||
|
} else {
|
||||||
|
additionalProperties.put("clientPackage", clientPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("Configuration.mustache",
|
||||||
|
(sourceFolder + File.separator + clientPackage).replace(".", java.io.File.separator), "Configuration.cs"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiClient.mustache",
|
||||||
|
(sourceFolder + File.separator + clientPackage).replace(".", java.io.File.separator), "ApiClient.cs"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiException.mustache",
|
||||||
|
(sourceFolder + File.separator + clientPackage).replace(".", java.io.File.separator), "ApiException.cs"));
|
||||||
|
supportingFiles.add(new SupportingFile("packages.config.mustache", "vendor", "packages.config"));
|
||||||
|
supportingFiles.add(new SupportingFile("compile-mono.sh.mustache", "", "compile-mono.sh"));
|
||||||
|
supportingFiles.add(new SupportingFile("README.md", "", "README.md"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClientPackage(String clientPackage) {
|
||||||
|
this.clientPackage = clientPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "CsharpDotNet2";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a C# .Net 2.0 client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return (outputFolder + File.separator + sourceFolder + File.separator + apiPackage()).replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return (outputFolder + File.separator + sourceFolder + File.separator + modelPackage()).replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// if it's all uppper case, do nothing
|
||||||
|
if (name.matches("^[A-Z_]*$")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize the variable name
|
||||||
|
// pet_id => PetId
|
||||||
|
name = camelize(name);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// if it's all uppper case, do nothing
|
||||||
|
if (name.matches("^[A-Z_]*$")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize(lower) the variable name
|
||||||
|
// pet_id => petId
|
||||||
|
name = camelize(name, true);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelName(String name) {
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(name)) {
|
||||||
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize the model name
|
||||||
|
// phone_number => PhoneNumber
|
||||||
|
return camelize(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
|
// should be the same as the model name
|
||||||
|
return toModelName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSwaggerType(p) + "<String, " + getTypeDeclaration(inner) + ">";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType.toLowerCase())) {
|
||||||
|
type = typeMapping.get(swaggerType.toLowerCase());
|
||||||
|
if (languageSpecificPrimitives.contains(type)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toOperationId(String operationId) {
|
||||||
|
// method name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(operationId)) {
|
||||||
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelize(operationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,367 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.properties.AbstractNumericProperty;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.BooleanProperty;
|
||||||
|
import io.swagger.models.properties.DateProperty;
|
||||||
|
import io.swagger.models.properties.DateTimeProperty;
|
||||||
|
import io.swagger.models.properties.DecimalProperty;
|
||||||
|
import io.swagger.models.properties.DoubleProperty;
|
||||||
|
import io.swagger.models.properties.FloatProperty;
|
||||||
|
import io.swagger.models.properties.IntegerProperty;
|
||||||
|
import io.swagger.models.properties.LongProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.properties.PropertyBuilder;
|
||||||
|
import io.swagger.models.properties.RefProperty;
|
||||||
|
import io.swagger.models.properties.StringProperty;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class FlashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String packageName = "io.swagger";
|
||||||
|
protected String packageVersion = null;
|
||||||
|
|
||||||
|
protected String invokerPackage = "io.swagger";
|
||||||
|
protected String sourceFolder = "src/main/flex";
|
||||||
|
|
||||||
|
public FlashClientCodegen() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
modelPackage = "io.swagger.client.model";
|
||||||
|
apiPackage = "io.swagger.client.api";
|
||||||
|
outputFolder = "generated-code" + File.separatorChar + "flash";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".as");
|
||||||
|
modelTemplateFiles.put("modelList.mustache", "List.as");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".as");
|
||||||
|
templateDir = "flash";
|
||||||
|
|
||||||
|
languageSpecificPrimitives.clear();
|
||||||
|
languageSpecificPrimitives.add("Number");
|
||||||
|
languageSpecificPrimitives.add("Boolean");
|
||||||
|
languageSpecificPrimitives.add("String");
|
||||||
|
languageSpecificPrimitives.add("Date");
|
||||||
|
languageSpecificPrimitives.add("Array");
|
||||||
|
languageSpecificPrimitives.add("Dictionary");
|
||||||
|
|
||||||
|
typeMapping.clear();
|
||||||
|
typeMapping.put("integer", "Number");
|
||||||
|
typeMapping.put("float", "Number");
|
||||||
|
typeMapping.put("long", "Number");
|
||||||
|
typeMapping.put("double", "Number");
|
||||||
|
typeMapping.put("array", "Array");
|
||||||
|
typeMapping.put("map", "Dictionary");
|
||||||
|
typeMapping.put("boolean", "Boolean");
|
||||||
|
typeMapping.put("string", "String");
|
||||||
|
typeMapping.put("date", "Date");
|
||||||
|
typeMapping.put("DateTime", "Date");
|
||||||
|
typeMapping.put("object", "Object");
|
||||||
|
typeMapping.put("file", "File");
|
||||||
|
|
||||||
|
importMapping = new HashMap<String, String>();
|
||||||
|
importMapping.put("File", "flash.filesystem.File");
|
||||||
|
|
||||||
|
// from
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"add", "for", "lt", "tellTarget", "and", "function", "ne", "this", "break", "ge", "new", "typeof", "continue", "gt", "not", "var", "delete", "if", "on", "void", "do", "ifFrameLoaded", "onClipEvent", "while", "else", "in", "or", "with", "eq", "le", "return"));
|
||||||
|
|
||||||
|
cliOptions.clear();
|
||||||
|
cliOptions.add(new CliOption("packageName", "flash package name (convention: package.name), default: io.swagger"));
|
||||||
|
cliOptions.add(new CliOption("packageVersion", "flash package version, default: 1.0.0"));
|
||||||
|
cliOptions.add(new CliOption("invokerPackage", "root package for generated code"));
|
||||||
|
cliOptions.add(new CliOption("sourceFolder", "source folder for generated code. e.g. src/main/flex"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("invokerPackage")) {
|
||||||
|
this.setInvokerPackage((String) additionalProperties.get("invokerPackage"));
|
||||||
|
} else {
|
||||||
|
//not set, use default to be passed to template
|
||||||
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("sourceFolder")) {
|
||||||
|
this.setSourceFolder((String) additionalProperties.get("sourceFolder"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("packageName")) {
|
||||||
|
setPackageName((String) additionalProperties.get("packageName"));
|
||||||
|
apiPackage = packageName + ".client.api";
|
||||||
|
modelPackage = packageName + ".client.model";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setPackageName("io.swagger");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("packageVersion")) {
|
||||||
|
setPackageVersion((String) additionalProperties.get("packageVersion"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
setPackageVersion("1.0.0");
|
||||||
|
}
|
||||||
|
|
||||||
|
additionalProperties.put("packageName", packageName);
|
||||||
|
additionalProperties.put("packageVersion", packageVersion);
|
||||||
|
|
||||||
|
//modelPackage = invokerPackage + File.separatorChar + "client" + File.separatorChar + "model";
|
||||||
|
//apiPackage = invokerPackage + File.separatorChar + "client" + File.separatorChar + "api";
|
||||||
|
|
||||||
|
final String invokerFolder = (sourceFolder + File.separator + invokerPackage + File.separator + "swagger" + File.separator).replace(".", File.separator).replace('.', File.separatorChar);
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("ApiInvoker.as", invokerFolder + "common", "ApiInvoker.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiUrlHelper.as", invokerFolder + "common", "ApiUrlHelper.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiUserCredentials.as", invokerFolder + "common", "ApiUserCredentials.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("ListWrapper.as", invokerFolder + "common", "ListWrapper.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("SwaggerApi.as", invokerFolder + "common", "SwaggerApi.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("XMLWriter.as", invokerFolder + "common", "XMLWriter.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiError.as", invokerFolder + "exception", "ApiErrors.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiErrorCodes.as", invokerFolder + "exception", "ApiErrorCodes.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiClientEvent.as", invokerFolder + "event", "ApiClientEvent.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("Response.as", invokerFolder + "event", "Response.as"));
|
||||||
|
supportingFiles.add(new SupportingFile("build.properties", sourceFolder, "build.properties"));
|
||||||
|
supportingFiles.add(new SupportingFile("build.xml", sourceFolder, "build.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("AirExecutorApp-app.xml", sourceFolder + File.separatorChar + "bin", "AirExecutorApp-app.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("ASAXB-0.1.1.swc", sourceFolder + File.separatorChar + "lib", "ASAXB-0.1.1.swc"));
|
||||||
|
supportingFiles.add(new SupportingFile("as3corelib.swc", sourceFolder + File.separatorChar + "lib", "as3corelib.swc"));
|
||||||
|
supportingFiles.add(new SupportingFile("flexunit-4.1.0_RC2-28-flex_3.5.0.12683.swc", sourceFolder + File.separator + "lib" + File.separator + "ext", "flexunit-4.1.0_RC2-28-flex_3.5.0.12683.swc"));
|
||||||
|
supportingFiles.add(new SupportingFile("flexunit-aircilistener-4.1.0_RC2-28-3.5.0.12683.swc", sourceFolder + File.separator + "lib" + File.separator + "ext", "flexunit-aircilistener-4.1.0_RC2-28-3.5.0.12683.swc"));
|
||||||
|
supportingFiles.add(new SupportingFile("flexunit-cilistener-4.1.0_RC2-28-3.5.0.12683.swc", sourceFolder + File.separator + "lib" + File.separator + "ext", "flexunit-cilistener-4.1.0_RC2-28-3.5.0.12683.swc"));
|
||||||
|
supportingFiles.add(new SupportingFile("flexunit-core-flex-4.0.0.2-sdk3.5.0.12683.swc", sourceFolder + File.separator + "lib" + File.separator + "ext", "flexunit-core-flex-4.0.0.2-sdk3.5.0.12683.swc"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String dropDots(String str) {
|
||||||
|
return str.replaceAll("\\.", "_");
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "flash";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a Flash client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return name + "_";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return (outputFolder + File.separatorChar + sourceFolder + File.separatorChar + apiPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return (outputFolder + File.separatorChar + sourceFolder + File.separatorChar + modelPackage().replace('.', File.separatorChar)).replace('/', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p);
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSwaggerType(p);
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType)) {
|
||||||
|
type = typeMapping.get(swaggerType);
|
||||||
|
if (languageSpecificPrimitives.contains(type)) {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = toModelName(swaggerType);
|
||||||
|
}
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toDefaultValue(Property p) {
|
||||||
|
if (p instanceof StringProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof BooleanProperty) {
|
||||||
|
return "false";
|
||||||
|
} else if (p instanceof DateProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DateTimeProperty) {
|
||||||
|
return "null";
|
||||||
|
} else if (p instanceof DoubleProperty) {
|
||||||
|
DoubleProperty dp = (DoubleProperty) p;
|
||||||
|
if (dp.getDefault() != null) {
|
||||||
|
return dp.getDefault().toString();
|
||||||
|
}
|
||||||
|
return "0.0";
|
||||||
|
} else if (p instanceof FloatProperty) {
|
||||||
|
FloatProperty dp = (FloatProperty) p;
|
||||||
|
if (dp.getDefault() != null) {
|
||||||
|
return dp.getDefault().toString();
|
||||||
|
}
|
||||||
|
return "0.0";
|
||||||
|
} else if (p instanceof IntegerProperty) {
|
||||||
|
IntegerProperty dp = (IntegerProperty) p;
|
||||||
|
if (dp.getDefault() != null) {
|
||||||
|
return dp.getDefault().toString();
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
} else if (p instanceof LongProperty) {
|
||||||
|
LongProperty dp = (LongProperty) p;
|
||||||
|
if (dp.getDefault() != null) {
|
||||||
|
return dp.getDefault().toString();
|
||||||
|
}
|
||||||
|
return "0";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty ap = (MapProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||||
|
return "new Dictionary()";
|
||||||
|
} else if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getItems());
|
||||||
|
return "new Array()";
|
||||||
|
} else {
|
||||||
|
return "null";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// if it's all uppper case, convert to lower case
|
||||||
|
if (name.matches("^[A-Z_]*$")) {
|
||||||
|
name = name.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
// underscore the variable name
|
||||||
|
// petId => pet_id
|
||||||
|
name = camelize(dropDots(name), true);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
// should be the same as variable name
|
||||||
|
return toVarName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelName(String name) {
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(name)) {
|
||||||
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize the model name
|
||||||
|
// phone_number => PhoneNumber
|
||||||
|
return camelize(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(name)) {
|
||||||
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// underscore the model file name
|
||||||
|
// PhoneNumber => phone_number
|
||||||
|
return camelize(dropDots(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiFilename(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
// e.g. PhoneNumberApi.rb => phone_number_api.rb
|
||||||
|
return camelize(name) + "Api";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiName(String name) {
|
||||||
|
if (name.length() == 0) {
|
||||||
|
return "DefaultApi";
|
||||||
|
}
|
||||||
|
// e.g. phone_number_api => PhoneNumberApi
|
||||||
|
return camelize(name) + "Api";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiVarName(String name) {
|
||||||
|
if (name.length() == 0) {
|
||||||
|
return "DefaultApi";
|
||||||
|
}
|
||||||
|
return camelize(name) + "Api";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toOperationId(String operationId) {
|
||||||
|
// throw exception if method name is empty
|
||||||
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// method name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(operationId)) {
|
||||||
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return underscore(operationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackageName(String packageName) {
|
||||||
|
this.packageName = packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPackageVersion(String packageVersion) {
|
||||||
|
this.packageVersion = packageVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvokerPackage(String invokerPackage) {
|
||||||
|
this.invokerPackage = invokerPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceFolder(String sourceFolder) {
|
||||||
|
this.sourceFolder = sourceFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,400 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenModel;
|
||||||
|
import io.swagger.codegen.CodegenProperty;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.ComposedModel;
|
||||||
|
import io.swagger.models.Model;
|
||||||
|
import io.swagger.models.ModelImpl;
|
||||||
|
import io.swagger.models.RefModel;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.models.properties.StringProperty;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String invokerPackage = "io.swagger.client";
|
||||||
|
protected String groupId = "io.swagger";
|
||||||
|
protected String artifactId = "swagger-java-client";
|
||||||
|
protected String artifactVersion = "1.0.0";
|
||||||
|
protected String sourceFolder = "src/main/java";
|
||||||
|
protected String localVariablePrefix = "";
|
||||||
|
protected Boolean serializableModel = false;
|
||||||
|
|
||||||
|
public JavaClientCodegen() {
|
||||||
|
super();
|
||||||
|
outputFolder = "generated-code/java";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".java");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".java");
|
||||||
|
templateDir = "Java";
|
||||||
|
apiPackage = "io.swagger.client.api";
|
||||||
|
modelPackage = "io.swagger.client.model";
|
||||||
|
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"abstract", "continue", "for", "new", "switch", "assert",
|
||||||
|
"default", "if", "package", "synchronized", "boolean", "do", "goto", "private",
|
||||||
|
"this", "break", "double", "implements", "protected", "throw", "byte", "else",
|
||||||
|
"import", "public", "throws", "case", "enum", "instanceof", "return", "transient",
|
||||||
|
"catch", "extends", "int", "short", "try", "char", "final", "interface", "static",
|
||||||
|
"void", "class", "finally", "long", "strictfp", "volatile", "const", "float",
|
||||||
|
"native", "super", "while")
|
||||||
|
);
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"boolean",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Integer",
|
||||||
|
"Long",
|
||||||
|
"Float",
|
||||||
|
"Object")
|
||||||
|
);
|
||||||
|
instantiationTypes.put("array", "ArrayList");
|
||||||
|
instantiationTypes.put("map", "HashMap");
|
||||||
|
|
||||||
|
cliOptions.add(new CliOption("invokerPackage", "root package for generated code"));
|
||||||
|
cliOptions.add(new CliOption("groupId", "groupId in generated pom.xml"));
|
||||||
|
cliOptions.add(new CliOption("artifactId", "artifactId in generated pom.xml"));
|
||||||
|
cliOptions.add(new CliOption("artifactVersion", "artifact version in generated pom.xml"));
|
||||||
|
cliOptions.add(new CliOption("sourceFolder", "source folder for generated code"));
|
||||||
|
cliOptions.add(new CliOption("localVariablePrefix", "prefix for generated code members and local variables"));
|
||||||
|
|
||||||
|
cliOptions.add(new CliOption("serializableModel", "boolean - toggle \"implements Serializable\" for generated models"));
|
||||||
|
|
||||||
|
supportedLibraries.put("<default>", "HTTP client: Jersey client 1.18. JSON processing: Jackson 2.4.2");
|
||||||
|
supportedLibraries.put("jersey2", "HTTP client: Jersey client 2.6");
|
||||||
|
cliOptions.add(buildLibraryCliOption(supportedLibraries));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "java";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a Java client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("invokerPackage")) {
|
||||||
|
this.setInvokerPackage((String) additionalProperties.get("invokerPackage"));
|
||||||
|
} else {
|
||||||
|
//not set, use default to be passed to template
|
||||||
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("groupId")) {
|
||||||
|
this.setGroupId((String) additionalProperties.get("groupId"));
|
||||||
|
} else {
|
||||||
|
//not set, use to be passed to template
|
||||||
|
additionalProperties.put("groupId", groupId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("artifactId")) {
|
||||||
|
this.setArtifactId((String) additionalProperties.get("artifactId"));
|
||||||
|
} else {
|
||||||
|
//not set, use to be passed to template
|
||||||
|
additionalProperties.put("artifactId", artifactId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("artifactVersion")) {
|
||||||
|
this.setArtifactVersion((String) additionalProperties.get("artifactVersion"));
|
||||||
|
} else {
|
||||||
|
//not set, use to be passed to template
|
||||||
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("sourceFolder")) {
|
||||||
|
this.setSourceFolder((String) additionalProperties.get("sourceFolder"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("localVariablePrefix")) {
|
||||||
|
this.setLocalVariablePrefix((String) additionalProperties.get("localVariablePrefix"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("serializableModel")) {
|
||||||
|
this.setSerializableModel(Boolean.valueOf((String)additionalProperties.get("serializableModel").toString()));
|
||||||
|
}
|
||||||
|
|
||||||
|
// need to put back serializableModel (boolean) into additionalProperties as value in additionalProperties is string
|
||||||
|
additionalProperties.put("serializableModel", serializableModel);
|
||||||
|
|
||||||
|
this.sanitizeConfig();
|
||||||
|
|
||||||
|
final String invokerFolder = (sourceFolder + File.separator + invokerPackage).replace(".", File.separator);
|
||||||
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiClient.mustache", invokerFolder, "ApiClient.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("apiException.mustache", invokerFolder, "ApiException.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("Configuration.mustache", invokerFolder, "Configuration.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("JSON.mustache", invokerFolder, "JSON.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("Pair.mustache", invokerFolder, "Pair.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("StringUtil.mustache", invokerFolder, "StringUtil.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("TypeRef.mustache", invokerFolder, "TypeRef.java"));
|
||||||
|
|
||||||
|
final String authFolder = (sourceFolder + File.separator + invokerPackage + ".auth").replace(".", File.separator);
|
||||||
|
supportingFiles.add(new SupportingFile("auth/Authentication.mustache", authFolder, "Authentication.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("auth/HttpBasicAuth.mustache", authFolder, "HttpBasicAuth.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("auth/ApiKeyAuth.mustache", authFolder, "ApiKeyAuth.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("auth/OAuth.mustache", authFolder, "OAuth.java"));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sanitizeConfig() {
|
||||||
|
// Sanitize any config options here. We also have to update the additionalProperties because
|
||||||
|
// the whole additionalProperties object is injected into the main object passed to the mustache layer
|
||||||
|
|
||||||
|
this.setApiPackage(sanitizePackageName(apiPackage));
|
||||||
|
if (additionalProperties.containsKey("apiPackage")) {
|
||||||
|
this.additionalProperties.put("apiPackage", apiPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setModelPackage(sanitizePackageName(modelPackage));
|
||||||
|
if (additionalProperties.containsKey("modelPackage")) {
|
||||||
|
this.additionalProperties.put("modelPackage", modelPackage);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.setInvokerPackage(sanitizePackageName(invokerPackage));
|
||||||
|
if (additionalProperties.containsKey("invokerPackage")) {
|
||||||
|
this.additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + apiPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return outputFolder + "/" + sourceFolder + "/" + modelPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
// replace - with _ e.g. created-at => created_at
|
||||||
|
name = name.replaceAll("-", "_");
|
||||||
|
|
||||||
|
if("_".equals(name)) {
|
||||||
|
name = "_u";
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it's all uppper case, do nothing
|
||||||
|
if (name.matches("^[A-Z_]*$")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize (lower first character) the variable name
|
||||||
|
// pet_id => petId
|
||||||
|
name = camelize(name, true);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, append _
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
// should be the same as variable name
|
||||||
|
return toVarName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelName(String name) {
|
||||||
|
// model name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(name)) {
|
||||||
|
throw new RuntimeException(name + " (reserved word) cannot be used as a model name");
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize the model name
|
||||||
|
// phone_number => PhoneNumber
|
||||||
|
return camelize(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
|
// should be the same as the model name
|
||||||
|
return toModelName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getSwaggerType(p) + "<String, " + getTypeDeclaration(inner) + ">";
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toDefaultValue(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
final ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
return String.format("new ArrayList<%s>()", getTypeDeclaration(ap.getItems()));
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
final MapProperty ap = (MapProperty) p;
|
||||||
|
return String.format("new HashMap<String, %s>()", getTypeDeclaration(ap.getAdditionalProperties()));
|
||||||
|
}
|
||||||
|
return super.toDefaultValue(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType)) {
|
||||||
|
type = typeMapping.get(swaggerType);
|
||||||
|
if (languageSpecificPrimitives.contains(type)) {
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toOperationId(String operationId) {
|
||||||
|
// throw exception if method name is empty
|
||||||
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// method name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(operationId)) {
|
||||||
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelize(operationId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CodegenModel fromModel(String name, Model model, Map<String, Model> allDefinitions) {
|
||||||
|
CodegenModel codegenModel = super.fromModel(name, model, allDefinitions);
|
||||||
|
|
||||||
|
if (allDefinitions != null && codegenModel != null && codegenModel.parent != null && codegenModel.hasEnums) {
|
||||||
|
final Model parentModel = allDefinitions.get(toModelName(codegenModel.parent));
|
||||||
|
final CodegenModel parentCodegenModel = super.fromModel(codegenModel.parent, parentModel);
|
||||||
|
codegenModel = this.reconcileInlineEnums(codegenModel, parentCodegenModel);
|
||||||
|
}
|
||||||
|
|
||||||
|
return codegenModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private CodegenModel reconcileInlineEnums(CodegenModel codegenModel, CodegenModel parentCodegenModel) {
|
||||||
|
// This generator uses inline classes to define enums, which breaks when
|
||||||
|
// dealing with models that have subTypes. To clean this up, we will analyze
|
||||||
|
// the parent and child models, look for enums that match, and remove
|
||||||
|
// them from the child models and leave them in the parent.
|
||||||
|
// Because the child models extend the parents, the enums will be available via the parent.
|
||||||
|
|
||||||
|
// Only bother with reconciliation if the parent model has enums.
|
||||||
|
if (parentCodegenModel.hasEnums) {
|
||||||
|
|
||||||
|
// Get the properties for the parent and child models
|
||||||
|
final List<CodegenProperty> parentModelCodegenProperties = parentCodegenModel.vars;
|
||||||
|
List<CodegenProperty> codegenProperties = codegenModel.vars;
|
||||||
|
|
||||||
|
// Iterate over all of the parent model properties
|
||||||
|
for (CodegenProperty parentModelCodegenPropery : parentModelCodegenProperties) {
|
||||||
|
// Look for enums
|
||||||
|
if (parentModelCodegenPropery.isEnum) {
|
||||||
|
// Now that we have found an enum in the parent class,
|
||||||
|
// and search the child class for the same enum.
|
||||||
|
Iterator<CodegenProperty> iterator = codegenProperties.iterator();
|
||||||
|
while (iterator.hasNext()) {
|
||||||
|
CodegenProperty codegenProperty = iterator.next();
|
||||||
|
if (codegenProperty.isEnum && codegenProperty.equals(parentModelCodegenPropery)) {
|
||||||
|
// We found an enum in the child class that is
|
||||||
|
// a duplicate of the one in the parent, so remove it.
|
||||||
|
iterator.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
codegenModel.vars = codegenProperties;
|
||||||
|
}
|
||||||
|
|
||||||
|
return codegenModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInvokerPackage(String invokerPackage) {
|
||||||
|
this.invokerPackage = invokerPackage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupId(String groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtifactId(String artifactId) {
|
||||||
|
this.artifactId = artifactId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtifactVersion(String artifactVersion) {
|
||||||
|
this.artifactVersion = artifactVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSourceFolder(String sourceFolder) {
|
||||||
|
this.sourceFolder = sourceFolder;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLocalVariablePrefix(String localVariablePrefix) {
|
||||||
|
this.localVariablePrefix = localVariablePrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getSerializableModel() {
|
||||||
|
return serializableModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSerializableModel(Boolean serializableModel) {
|
||||||
|
this.serializableModel = serializableModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String sanitizePackageName(String packageName) {
|
||||||
|
packageName = packageName.trim();
|
||||||
|
packageName = packageName.replaceAll("[^a-zA-Z0-9_\\.]", "_");
|
||||||
|
if(Strings.isNullOrEmpty(packageName)) {
|
||||||
|
return "invalidPackageName";
|
||||||
|
}
|
||||||
|
return packageName;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenOperation;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.Operation;
|
||||||
|
import io.swagger.models.Swagger;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
import io.swagger.util.Json;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class JavaInflectorServerCodegen extends JavaClientCodegen implements CodegenConfig {
|
||||||
|
protected String invokerPackage = "io.swagger.handler";
|
||||||
|
protected String groupId = "io.swagger";
|
||||||
|
protected String artifactId = "swagger-inflector-server";
|
||||||
|
protected String artifactVersion = "1.0.0";
|
||||||
|
protected String title = "Swagger Inflector";
|
||||||
|
|
||||||
|
public JavaInflectorServerCodegen() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
sourceFolder = "src/main/java";
|
||||||
|
modelTemplateFiles.put("model.mustache", ".java");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".java");
|
||||||
|
templateDir = "JavaInflector";
|
||||||
|
|
||||||
|
apiPackage = System.getProperty("swagger.codegen.inflector.apipackage", "io.swagger.handler");
|
||||||
|
modelPackage = System.getProperty("swagger.codegen.inflector.modelpackage", "io.swagger.model");
|
||||||
|
|
||||||
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
additionalProperties.put("groupId", groupId);
|
||||||
|
additionalProperties.put("artifactId", artifactId);
|
||||||
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
additionalProperties.put("title", title);
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"boolean",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Integer",
|
||||||
|
"Long",
|
||||||
|
"Float")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "inflector";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a Java Inflector Server application.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
supportingFiles.clear();
|
||||||
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
|
supportingFiles.add(new SupportingFile("web.mustache", "src/main/webapp/WEB-INF", "web.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("inflector.mustache", "", "inflector.yaml"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
return getSwaggerType(p) + "<" + getTypeDeclaration(inner) + ">";
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
return getTypeDeclaration(inner);
|
||||||
|
}
|
||||||
|
return super.getTypeDeclaration(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||||
|
String basePath = resourcePath;
|
||||||
|
if (basePath.startsWith("/")) {
|
||||||
|
basePath = basePath.substring(1);
|
||||||
|
}
|
||||||
|
int pos = basePath.indexOf("/");
|
||||||
|
if (pos > 0) {
|
||||||
|
basePath = basePath.substring(0, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (basePath == "") {
|
||||||
|
basePath = "default";
|
||||||
|
} else {
|
||||||
|
if (co.path.startsWith("/" + basePath)) {
|
||||||
|
co.path = co.path.substring(("/" + basePath).length());
|
||||||
|
}
|
||||||
|
co.subresourceOperation = !co.path.isEmpty();
|
||||||
|
}
|
||||||
|
List<CodegenOperation> opList = operations.get(basePath);
|
||||||
|
if (opList == null) {
|
||||||
|
opList = new ArrayList<CodegenOperation>();
|
||||||
|
operations.put(basePath, opList);
|
||||||
|
}
|
||||||
|
opList.add(co);
|
||||||
|
co.baseName = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||||
|
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||||
|
if (operations != null) {
|
||||||
|
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||||
|
for (CodegenOperation operation : ops) {
|
||||||
|
if (operation.returnType == null) {
|
||||||
|
operation.returnType = "Void";
|
||||||
|
} else if (operation.returnType.startsWith("List")) {
|
||||||
|
String rt = operation.returnType;
|
||||||
|
int end = rt.lastIndexOf(">");
|
||||||
|
if (end > 0) {
|
||||||
|
operation.returnType = rt.substring("List<".length(), end);
|
||||||
|
operation.returnContainer = "List";
|
||||||
|
}
|
||||||
|
} else if (operation.returnType.startsWith("Map")) {
|
||||||
|
String rt = operation.returnType;
|
||||||
|
int end = rt.lastIndexOf(">");
|
||||||
|
if (end > 0) {
|
||||||
|
operation.returnType = rt.substring("Map<".length(), end);
|
||||||
|
operation.returnContainer = "Map";
|
||||||
|
}
|
||||||
|
} else if (operation.returnType.startsWith("Set")) {
|
||||||
|
String rt = operation.returnType;
|
||||||
|
int end = rt.lastIndexOf(">");
|
||||||
|
if (end > 0) {
|
||||||
|
operation.returnType = rt.substring("Set<".length(), end);
|
||||||
|
operation.returnContainer = "Set";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processSwagger(Swagger swagger) {
|
||||||
|
super.processSwagger(swagger);
|
||||||
|
|
||||||
|
try {
|
||||||
|
File file = new File( outputFolder + "/src/main/swagger/swagger.json" );
|
||||||
|
file.getParentFile().mkdirs();
|
||||||
|
|
||||||
|
FileWriter swaggerFile = new FileWriter(file);
|
||||||
|
swaggerFile.write( Json.pretty( swagger ));
|
||||||
|
swaggerFile.flush();
|
||||||
|
swaggerFile.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiName(String name) {
|
||||||
|
if (name.length() == 0) {
|
||||||
|
return "DefaultController";
|
||||||
|
}
|
||||||
|
name = name.replaceAll("[^a-zA-Z0-9]+", "_");
|
||||||
|
return camelize(name)+ "Controller";
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldOverwrite(String filename) {
|
||||||
|
return super.shouldOverwrite(filename);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,208 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenResponse;
|
||||||
|
import io.swagger.codegen.CodegenOperation;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.Operation;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConfig {
|
||||||
|
protected String invokerPackage = "io.swagger.api";
|
||||||
|
protected String groupId = "io.swagger";
|
||||||
|
protected String artifactId = "swagger-jaxrs-server";
|
||||||
|
protected String artifactVersion = "1.0.0";
|
||||||
|
protected String title = "Swagger Server";
|
||||||
|
|
||||||
|
public JaxRSServerCodegen() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
sourceFolder = "src/gen/java";
|
||||||
|
|
||||||
|
outputFolder = System.getProperty("swagger.codegen.jaxrs.genfolder", "generated-code/javaJaxRS");
|
||||||
|
modelTemplateFiles.put("model.mustache", ".java");
|
||||||
|
apiTemplateFiles.put("api.mustache", ".java");
|
||||||
|
apiTemplateFiles.put("apiService.mustache", ".java");
|
||||||
|
apiTemplateFiles.put("apiServiceImpl.mustache", ".java");
|
||||||
|
apiTemplateFiles.put("apiServiceFactory.mustache", ".java");
|
||||||
|
templateDir = "JavaJaxRS";
|
||||||
|
apiPackage = System.getProperty("swagger.codegen.jaxrs.apipackage", "io.swagger.api");
|
||||||
|
modelPackage = System.getProperty("swagger.codegen.jaxrs.modelpackage", "io.swagger.model");
|
||||||
|
|
||||||
|
additionalProperties.put("invokerPackage", invokerPackage);
|
||||||
|
additionalProperties.put("groupId", groupId);
|
||||||
|
additionalProperties.put("artifactId", artifactId);
|
||||||
|
additionalProperties.put("artifactVersion", artifactVersion);
|
||||||
|
additionalProperties.put("title", title);
|
||||||
|
|
||||||
|
|
||||||
|
languageSpecificPrimitives = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"String",
|
||||||
|
"boolean",
|
||||||
|
"Boolean",
|
||||||
|
"Double",
|
||||||
|
"Integer",
|
||||||
|
"Long",
|
||||||
|
"Float")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "jaxrs";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a Java JAXRS Server application.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
supportingFiles.clear();
|
||||||
|
supportingFiles.add(new SupportingFile("pom.mustache", "", "pom.xml"));
|
||||||
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiException.mustache",
|
||||||
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiException.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiOriginFilter.mustache",
|
||||||
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiOriginFilter.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiResponseMessage.mustache",
|
||||||
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "ApiResponseMessage.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("NotFoundException.mustache",
|
||||||
|
(sourceFolder + File.separator + apiPackage).replace(".", java.io.File.separator), "NotFoundException.java"));
|
||||||
|
supportingFiles.add(new SupportingFile("web.mustache",
|
||||||
|
("src/main/webapp/WEB-INF"), "web.xml"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addOperationToGroup(String tag, String resourcePath, Operation operation, CodegenOperation co, Map<String, List<CodegenOperation>> operations) {
|
||||||
|
String basePath = resourcePath;
|
||||||
|
if (basePath.startsWith("/")) {
|
||||||
|
basePath = basePath.substring(1);
|
||||||
|
}
|
||||||
|
int pos = basePath.indexOf("/");
|
||||||
|
if (pos > 0) {
|
||||||
|
basePath = basePath.substring(0, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (basePath == "") {
|
||||||
|
basePath = "default";
|
||||||
|
} else {
|
||||||
|
if (co.path.startsWith("/" + basePath)) {
|
||||||
|
co.path = co.path.substring(("/" + basePath).length());
|
||||||
|
}
|
||||||
|
co.subresourceOperation = !co.path.isEmpty();
|
||||||
|
}
|
||||||
|
List<CodegenOperation> opList = operations.get(basePath);
|
||||||
|
if (opList == null) {
|
||||||
|
opList = new ArrayList<CodegenOperation>();
|
||||||
|
operations.put(basePath, opList);
|
||||||
|
}
|
||||||
|
opList.add(co);
|
||||||
|
co.baseName = basePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||||
|
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||||
|
if (operations != null) {
|
||||||
|
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||||
|
for (CodegenOperation operation : ops) {
|
||||||
|
List<CodegenResponse> responses = operation.responses;
|
||||||
|
if (responses != null) {
|
||||||
|
for (CodegenResponse resp : responses) {
|
||||||
|
if ("0".equals(resp.code)) {
|
||||||
|
resp.code = "200";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (operation.returnType == null) {
|
||||||
|
operation.returnType = "Void";
|
||||||
|
} else if (operation.returnType.startsWith("List")) {
|
||||||
|
String rt = operation.returnType;
|
||||||
|
int end = rt.lastIndexOf(">");
|
||||||
|
if (end > 0) {
|
||||||
|
operation.returnType = rt.substring("List<".length(), end).trim();
|
||||||
|
operation.returnContainer = "List";
|
||||||
|
}
|
||||||
|
} else if (operation.returnType.startsWith("Map")) {
|
||||||
|
String rt = operation.returnType;
|
||||||
|
int end = rt.lastIndexOf(">");
|
||||||
|
if (end > 0) {
|
||||||
|
operation.returnType = rt.substring("Map<".length(), end).split(",")[1].trim();
|
||||||
|
operation.returnContainer = "Map";
|
||||||
|
}
|
||||||
|
} else if (operation.returnType.startsWith("Set")) {
|
||||||
|
String rt = operation.returnType;
|
||||||
|
int end = rt.lastIndexOf(">");
|
||||||
|
if (end > 0) {
|
||||||
|
operation.returnType = rt.substring("Set<".length(), end).trim();
|
||||||
|
operation.returnContainer = "Set";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiName(String name) {
|
||||||
|
if (name.length() == 0) {
|
||||||
|
return "DefaultApi";
|
||||||
|
}
|
||||||
|
name = name.replaceAll("[^a-zA-Z0-9]+", "_");
|
||||||
|
return camelize(name) + "Api";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFilename(String templateName, String tag) {
|
||||||
|
|
||||||
|
String result = super.apiFilename(templateName, tag);
|
||||||
|
|
||||||
|
if (templateName.endsWith("Impl.mustache")) {
|
||||||
|
int ix = result.lastIndexOf('/');
|
||||||
|
result = result.substring(0, ix) + "/impl" + result.substring(ix, result.length() - 5) + "ServiceImpl.java";
|
||||||
|
|
||||||
|
String output = System.getProperty("swagger.codegen.jaxrs.impl.source");
|
||||||
|
if (output != null) {
|
||||||
|
result = result.replace(apiFileFolder(), implFileFolder(output));
|
||||||
|
}
|
||||||
|
} else if (templateName.endsWith("Factory.mustache")) {
|
||||||
|
int ix = result.lastIndexOf('/');
|
||||||
|
result = result.substring(0, ix) + "/factories" + result.substring(ix, result.length() - 5) + "ServiceFactory.java";
|
||||||
|
|
||||||
|
String output = System.getProperty("swagger.codegen.jaxrs.impl.source");
|
||||||
|
if (output != null) {
|
||||||
|
result = result.replace(apiFileFolder(), implFileFolder(output));
|
||||||
|
}
|
||||||
|
} else if (templateName.endsWith("Service.mustache")) {
|
||||||
|
int ix = result.lastIndexOf('.');
|
||||||
|
result = result.substring(0, ix) + "Service.java";
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
private String implFileFolder(String output) {
|
||||||
|
return outputFolder + "/" + output + "/" + apiPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean shouldOverwrite(String filename) {
|
||||||
|
return super.shouldOverwrite(filename) && !filename.endsWith("ServiceImpl.java") && !filename.endsWith("ServiceFactory.java");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,254 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenOperation;
|
||||||
|
import io.swagger.codegen.CodegenParameter;
|
||||||
|
import io.swagger.codegen.CodegenResponse;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
|
import com.google.common.collect.ArrayListMultimap;
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
|
public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected String apiVersion = "1.0.0";
|
||||||
|
protected int serverPort = 8080;
|
||||||
|
protected String projectName = "swagger-server";
|
||||||
|
|
||||||
|
public NodeJSServerCodegen() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
// set the output folder here
|
||||||
|
outputFolder = "generated-code/nodejs";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Models. You can write model files using the modelTemplateFiles map.
|
||||||
|
* if you want to create one template for file, you can do so here.
|
||||||
|
* for multiple files for model, just put another entry in the `modelTemplateFiles` with
|
||||||
|
* a different extension
|
||||||
|
*/
|
||||||
|
modelTemplateFiles.clear();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Api classes. You can write classes for each Api file with the apiTemplateFiles map.
|
||||||
|
* as with models, add multiple entries with different extensions for multiple files per
|
||||||
|
* class
|
||||||
|
*/
|
||||||
|
apiTemplateFiles.put(
|
||||||
|
"controller.mustache", // the template to use
|
||||||
|
".js"); // the extension for each file to write
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Template Location. This is the location which templates will be read from. The generator
|
||||||
|
* will use the resource stream to attempt to read the templates.
|
||||||
|
*/
|
||||||
|
templateDir = "nodejs";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reserved words. Override this with reserved words specific to your language
|
||||||
|
*/
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"break", "case", "class", "catch", "const", "continue", "debugger",
|
||||||
|
"default", "delete", "do", "else", "export", "extends", "finally",
|
||||||
|
"for", "function", "if", "import", "in", "instanceof", "let", "new",
|
||||||
|
"return", "super", "switch", "this", "throw", "try", "typeof", "var",
|
||||||
|
"void", "while", "with", "yield")
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Additional Properties. These values can be passed to the templates and
|
||||||
|
* are available in models, apis, and supporting files
|
||||||
|
*/
|
||||||
|
additionalProperties.put("apiVersion", apiVersion);
|
||||||
|
additionalProperties.put("serverPort", serverPort);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Supporting Files. You can write single files for the generator with the
|
||||||
|
* entire object tree available. If the input file has a suffix of `.mustache
|
||||||
|
* it will be processed by the template engine. Otherwise, it will be copied
|
||||||
|
*/
|
||||||
|
// supportingFiles.add(new SupportingFile("controller.mustache",
|
||||||
|
// "controllers",
|
||||||
|
// "controller.js")
|
||||||
|
// );
|
||||||
|
supportingFiles.add(new SupportingFile("swagger.mustache",
|
||||||
|
"api",
|
||||||
|
"swagger.json")
|
||||||
|
);
|
||||||
|
supportingFiles.add(new SupportingFile("index.mustache",
|
||||||
|
"",
|
||||||
|
"index.js")
|
||||||
|
);
|
||||||
|
supportingFiles.add(new SupportingFile("package.mustache",
|
||||||
|
"",
|
||||||
|
"package.json")
|
||||||
|
);
|
||||||
|
if (System.getProperty("noservice") == null) {
|
||||||
|
apiTemplateFiles.put(
|
||||||
|
"service.mustache", // the template to use
|
||||||
|
"Service.js"); // the extension for each file to write
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apiPackage() {
|
||||||
|
return "controllers";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the type of generator.
|
||||||
|
*
|
||||||
|
* @return the CodegenType for this generator
|
||||||
|
* @see io.swagger.codegen.CodegenType
|
||||||
|
*/
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures a friendly name for the generator. This will be used by the generator
|
||||||
|
* to select the library with the -l flag.
|
||||||
|
*
|
||||||
|
* @return the friendly name for the generator
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return "nodejs";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns human-friendly help for the generator. Provide the consumer with help
|
||||||
|
* tips, parameters here
|
||||||
|
*
|
||||||
|
* @return A string value for the help message
|
||||||
|
*/
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates a nodejs server library using the swagger-tools project. By default, " +
|
||||||
|
"it will also generate service classes--which you can disable with the `-Dnoservice` environment variable.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiName(String name) {
|
||||||
|
if (name.length() == 0) {
|
||||||
|
return "DefaultController";
|
||||||
|
}
|
||||||
|
return initialCaps(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiFilename(String name) {
|
||||||
|
return toApiName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Escapes a reserved word as defined in the `reservedWords` array. Handle escaping
|
||||||
|
* those terms here. This logic is only called if a variable matches the reseved words
|
||||||
|
*
|
||||||
|
* @return the escaped term
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name; // add an underscore to the name
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Location to write api files. You can use the apiPackage() as defined when the class is
|
||||||
|
* instantiated
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return outputFolder + File.separator + apiPackage().replace('.', File.separatorChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessOperations(Map<String, Object> objs) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Map<String, Object> objectMap = (Map<String, Object>) objs.get("operations");
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
List<CodegenOperation> operations = (List<CodegenOperation>) objectMap.get("operation");
|
||||||
|
for (CodegenOperation operation : operations) {
|
||||||
|
operation.httpMethod = operation.httpMethod.toLowerCase();
|
||||||
|
List<CodegenParameter> params = operation.allParams;
|
||||||
|
if (params != null && params.size() == 0) {
|
||||||
|
operation.allParams = null;
|
||||||
|
}
|
||||||
|
List<CodegenResponse> responses = operation.responses;
|
||||||
|
if (responses != null) {
|
||||||
|
for (CodegenResponse resp : responses) {
|
||||||
|
if ("0".equals(resp.code)) {
|
||||||
|
resp.code = "default";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (operation.examples != null && !operation.examples.isEmpty()) {
|
||||||
|
// Leave application/json* items only
|
||||||
|
for (Iterator<Map<String, String>> it = operation.examples.iterator(); it.hasNext(); ) {
|
||||||
|
final Map<String, String> example = it.next();
|
||||||
|
final String contentType = example.get("contentType");
|
||||||
|
if (contentType == null || !contentType.startsWith("application/json")) {
|
||||||
|
it.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return objs;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private Map<String, Object> getOperations(Map<String, Object> objs) {
|
||||||
|
Map<String, Object> apiInfo = (Map<String, Object>) objs.get("apiInfo");
|
||||||
|
List<Map<String, Object>> apis = (List<Map<String, Object>>) apiInfo.get("apis");
|
||||||
|
Map<String, Object> api = apis.get(0);
|
||||||
|
return (Map<String, Object>) api.get("operations");
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<Map<String, Object>> sortOperationsByPath(List<CodegenOperation> ops) {
|
||||||
|
Multimap<String, CodegenOperation> opsByPath = ArrayListMultimap.create();
|
||||||
|
|
||||||
|
for (CodegenOperation op : ops) {
|
||||||
|
opsByPath.put(op.path, op);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Map<String, Object>> opsByPathList = new ArrayList<Map<String, Object>>();
|
||||||
|
for (Entry<String, Collection<CodegenOperation>> entry : opsByPath.asMap().entrySet()) {
|
||||||
|
Map<String, Object> opsByPathEntry = new HashMap<String, Object>();
|
||||||
|
opsByPathList.add(opsByPathEntry);
|
||||||
|
opsByPathEntry.put("path", entry.getKey());
|
||||||
|
opsByPathEntry.put("operation", entry.getValue());
|
||||||
|
List<CodegenOperation> operationsForThisPath = Lists.newArrayList(entry.getValue());
|
||||||
|
operationsForThisPath.get(operationsForThisPath.size() - 1).hasMore = null;
|
||||||
|
if (opsByPathList.size() < opsByPath.asMap().size()) {
|
||||||
|
opsByPathEntry.put("hasMore", "true");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return opsByPathList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> postProcessSupportingFileData(Map<String, Object> objs) {
|
||||||
|
Map<String, Object> operations = getOperations(objs);
|
||||||
|
|
||||||
|
if (operations != null) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
List<CodegenOperation> ops = (List<CodegenOperation>) operations.get("operation");
|
||||||
|
|
||||||
|
List<Map<String, Object>> opsByPathList = sortOperationsByPath(ops);
|
||||||
|
operations.put("operationsByPath", opsByPathList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.postProcessSupportingFileData(objs);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,388 @@
|
|||||||
|
package io.swagger.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.codegen.CliOption;
|
||||||
|
import io.swagger.codegen.CodegenConfig;
|
||||||
|
import io.swagger.codegen.CodegenProperty;
|
||||||
|
import io.swagger.codegen.CodegenType;
|
||||||
|
import io.swagger.codegen.DefaultCodegen;
|
||||||
|
import io.swagger.codegen.SupportingFile;
|
||||||
|
import io.swagger.models.properties.ArrayProperty;
|
||||||
|
import io.swagger.models.properties.MapProperty;
|
||||||
|
import io.swagger.models.properties.Property;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
|
protected Set<String> foundationClasses = new HashSet<String>();
|
||||||
|
protected String podName = "SwaggerClient";
|
||||||
|
protected String podVersion = "1.0.0";
|
||||||
|
protected String classPrefix = "SWG";
|
||||||
|
|
||||||
|
public ObjcClientCodegen() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
outputFolder = "generated-code" + File.separator + "objc";
|
||||||
|
modelTemplateFiles.put("model-header.mustache", ".h");
|
||||||
|
modelTemplateFiles.put("model-body.mustache", ".m");
|
||||||
|
apiTemplateFiles.put("api-header.mustache", ".h");
|
||||||
|
apiTemplateFiles.put("api-body.mustache", ".m");
|
||||||
|
templateDir = "objc";
|
||||||
|
|
||||||
|
defaultIncludes.clear();
|
||||||
|
defaultIncludes.add("bool");
|
||||||
|
defaultIncludes.add("BOOL");
|
||||||
|
defaultIncludes.add("int");
|
||||||
|
defaultIncludes.add("NSURL");
|
||||||
|
defaultIncludes.add("NSString");
|
||||||
|
defaultIncludes.add("NSObject");
|
||||||
|
defaultIncludes.add("NSArray");
|
||||||
|
defaultIncludes.add("NSNumber");
|
||||||
|
defaultIncludes.add("NSDate");
|
||||||
|
defaultIncludes.add("NSDictionary");
|
||||||
|
defaultIncludes.add("NSMutableArray");
|
||||||
|
defaultIncludes.add("NSMutableDictionary");
|
||||||
|
|
||||||
|
languageSpecificPrimitives.clear();
|
||||||
|
languageSpecificPrimitives.add("NSNumber");
|
||||||
|
languageSpecificPrimitives.add("NSString");
|
||||||
|
languageSpecificPrimitives.add("NSObject");
|
||||||
|
languageSpecificPrimitives.add("NSDate");
|
||||||
|
languageSpecificPrimitives.add("NSURL");
|
||||||
|
languageSpecificPrimitives.add("bool");
|
||||||
|
languageSpecificPrimitives.add("BOOL");
|
||||||
|
|
||||||
|
typeMapping.clear();
|
||||||
|
typeMapping.put("enum", "NSString");
|
||||||
|
typeMapping.put("date", "NSDate");
|
||||||
|
typeMapping.put("DateTime", "NSDate");
|
||||||
|
typeMapping.put("boolean", "NSNumber");
|
||||||
|
typeMapping.put("string", "NSString");
|
||||||
|
typeMapping.put("integer", "NSNumber");
|
||||||
|
typeMapping.put("int", "NSNumber");
|
||||||
|
typeMapping.put("float", "NSNumber");
|
||||||
|
typeMapping.put("long", "NSNumber");
|
||||||
|
typeMapping.put("double", "NSNumber");
|
||||||
|
typeMapping.put("array", "NSArray");
|
||||||
|
typeMapping.put("map", "NSDictionary");
|
||||||
|
typeMapping.put("number", "NSNumber");
|
||||||
|
typeMapping.put("List", "NSArray");
|
||||||
|
typeMapping.put("object", "NSObject");
|
||||||
|
typeMapping.put("file", "NSURL");
|
||||||
|
|
||||||
|
// ref: http://www.tutorialspoint.com/objective_c/objective_c_basic_syntax.htm
|
||||||
|
reservedWords = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"auto", "else", "long", "switch",
|
||||||
|
"break", "enum", "register", "typedef",
|
||||||
|
"case", "extern", "return", "union",
|
||||||
|
"char", "float", "short", "unsigned",
|
||||||
|
"const", "for", "signed", "void",
|
||||||
|
"continue", "goto", "sizeof", "volatile",
|
||||||
|
"default", "if", "id", "static", "while",
|
||||||
|
"do", "int", "struct", "_Packed",
|
||||||
|
"double", "protocol", "interface", "implementation",
|
||||||
|
"NSObject", "NSInteger", "NSNumber", "CGFloat",
|
||||||
|
"property", "nonatomic", "retain", "strong",
|
||||||
|
"weak", "unsafe_unretained", "readwrite", "readonly",
|
||||||
|
"description"
|
||||||
|
));
|
||||||
|
|
||||||
|
importMapping = new HashMap<String, String>();
|
||||||
|
|
||||||
|
foundationClasses = new HashSet<String>(
|
||||||
|
Arrays.asList(
|
||||||
|
"NSNumber",
|
||||||
|
"NSObject",
|
||||||
|
"NSString",
|
||||||
|
"NSDate",
|
||||||
|
"NSURL",
|
||||||
|
"NSDictionary")
|
||||||
|
);
|
||||||
|
|
||||||
|
instantiationTypes.put("array", "NSMutableArray");
|
||||||
|
instantiationTypes.put("map", "NSMutableDictionary");
|
||||||
|
|
||||||
|
cliOptions.clear();
|
||||||
|
cliOptions.add(new CliOption("classPrefix", "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`), default: `SWG`"));
|
||||||
|
cliOptions.add(new CliOption("podName", "cocoapods package name (convention: CameCase), default: `SwaggerClient`"));
|
||||||
|
cliOptions.add(new CliOption("podVersion", "cocoapods package version, default: `1.0.0`"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return "objc";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getHelp() {
|
||||||
|
return "Generates an Objective-C client library.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processOpts() {
|
||||||
|
super.processOpts();
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("podName")) {
|
||||||
|
setPodName((String) additionalProperties.get("podName"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("podVersion")) {
|
||||||
|
setPodVersion((String) additionalProperties.get("podVersion"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (additionalProperties.containsKey("classPrefix")) {
|
||||||
|
setClassPrefix((String) additionalProperties.get("classPrefix"));
|
||||||
|
}
|
||||||
|
|
||||||
|
additionalProperties.put("podName", podName);
|
||||||
|
additionalProperties.put("podVersion", podVersion);
|
||||||
|
additionalProperties.put("classPrefix", classPrefix);
|
||||||
|
|
||||||
|
String swaggerFolder = podName;
|
||||||
|
|
||||||
|
modelPackage = swaggerFolder;
|
||||||
|
apiPackage = swaggerFolder;
|
||||||
|
|
||||||
|
supportingFiles.add(new SupportingFile("Object-header.mustache", swaggerFolder, classPrefix + "Object.h"));
|
||||||
|
supportingFiles.add(new SupportingFile("Object-body.mustache", swaggerFolder, classPrefix + "Object.m"));
|
||||||
|
supportingFiles.add(new SupportingFile("QueryParamCollection-header.mustache", swaggerFolder, classPrefix + "QueryParamCollection.h"));
|
||||||
|
supportingFiles.add(new SupportingFile("QueryParamCollection-body.mustache", swaggerFolder, classPrefix + "QueryParamCollection.m"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiClient-header.mustache", swaggerFolder, classPrefix + "ApiClient.h"));
|
||||||
|
supportingFiles.add(new SupportingFile("ApiClient-body.mustache", swaggerFolder, classPrefix + "ApiClient.m"));
|
||||||
|
supportingFiles.add(new SupportingFile("JSONResponseSerializer-header.mustache", swaggerFolder, classPrefix + "JSONResponseSerializer.h"));
|
||||||
|
supportingFiles.add(new SupportingFile("JSONResponseSerializer-body.mustache", swaggerFolder, classPrefix + "JSONResponseSerializer.m"));
|
||||||
|
supportingFiles.add(new SupportingFile("JSONRequestSerializer-body.mustache", swaggerFolder, classPrefix + "JSONRequestSerializer.m"));
|
||||||
|
supportingFiles.add(new SupportingFile("JSONRequestSerializer-header.mustache", swaggerFolder, classPrefix + "JSONRequestSerializer.h"));
|
||||||
|
supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.m", swaggerFolder, "JSONValueTransformer+ISO8601.m"));
|
||||||
|
supportingFiles.add(new SupportingFile("JSONValueTransformer+ISO8601.h", swaggerFolder, "JSONValueTransformer+ISO8601.h"));
|
||||||
|
supportingFiles.add(new SupportingFile("Configuration-body.mustache", swaggerFolder, classPrefix + "Configuration.m"));
|
||||||
|
supportingFiles.add(new SupportingFile("Configuration-header.mustache", swaggerFolder, classPrefix + "Configuration.h"));
|
||||||
|
supportingFiles.add(new SupportingFile("podspec.mustache", "", podName + ".podspec"));
|
||||||
|
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toInstantiationType(Property p) {
|
||||||
|
if (p instanceof MapProperty) {
|
||||||
|
MapProperty ap = (MapProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getAdditionalProperties());
|
||||||
|
return instantiationTypes.get("map");
|
||||||
|
} else if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
String inner = getSwaggerType(ap.getItems());
|
||||||
|
return instantiationTypes.get("array");
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(String name) {
|
||||||
|
if (languageSpecificPrimitives.contains(name) && !foundationClasses.contains(name)) {
|
||||||
|
return name;
|
||||||
|
} else {
|
||||||
|
return name + "*";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getSwaggerType(Property p) {
|
||||||
|
String swaggerType = super.getSwaggerType(p);
|
||||||
|
String type = null;
|
||||||
|
if (typeMapping.containsKey(swaggerType)) {
|
||||||
|
type = typeMapping.get(swaggerType);
|
||||||
|
if (languageSpecificPrimitives.contains(type) && !foundationClasses.contains(type)) {
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
type = swaggerType;
|
||||||
|
}
|
||||||
|
return toModelName(type);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getTypeDeclaration(Property p) {
|
||||||
|
if (p instanceof ArrayProperty) {
|
||||||
|
ArrayProperty ap = (ArrayProperty) p;
|
||||||
|
Property inner = ap.getItems();
|
||||||
|
String innerType = getSwaggerType(inner);
|
||||||
|
|
||||||
|
String innerTypeDeclaration = getTypeDeclaration(inner);
|
||||||
|
|
||||||
|
if (innerTypeDeclaration.endsWith("*")) {
|
||||||
|
innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this codition, type of property p is array of primitive,
|
||||||
|
// return container type with pointer, e.g. `NSArray* /* NSString */'
|
||||||
|
if (languageSpecificPrimitives.contains(innerType)) {
|
||||||
|
return getSwaggerType(p) + "*" + " /* " + innerTypeDeclaration + " */";
|
||||||
|
}
|
||||||
|
// In this codition, type of property p is array of model,
|
||||||
|
// return container type combine inner type with pointer, e.g. `NSArray<SWGTag>*'
|
||||||
|
else {
|
||||||
|
return getSwaggerType(p) + "<" + innerTypeDeclaration + ">*";
|
||||||
|
}
|
||||||
|
} else if (p instanceof MapProperty) {
|
||||||
|
MapProperty mp = (MapProperty) p;
|
||||||
|
Property inner = mp.getAdditionalProperties();
|
||||||
|
|
||||||
|
String innerTypeDeclaration = getTypeDeclaration(inner);
|
||||||
|
|
||||||
|
if (innerTypeDeclaration.endsWith("*")) {
|
||||||
|
innerTypeDeclaration = innerTypeDeclaration.substring(0, innerTypeDeclaration.length() - 1);
|
||||||
|
}
|
||||||
|
return getSwaggerType(p) + "* /* NSString, " + innerTypeDeclaration + " */";
|
||||||
|
} else {
|
||||||
|
String swaggerType = getSwaggerType(p);
|
||||||
|
|
||||||
|
// In this codition, type of p is objective-c primitive type, e.g. `NSSNumber',
|
||||||
|
// return type of p with pointer, e.g. `NSNumber*'
|
||||||
|
if (languageSpecificPrimitives.contains(swaggerType) &&
|
||||||
|
foundationClasses.contains(swaggerType)) {
|
||||||
|
return swaggerType + "*";
|
||||||
|
}
|
||||||
|
// In this codition, type of p is c primitive type, e.g. `bool',
|
||||||
|
// return type of p, e.g. `bool'
|
||||||
|
else if (languageSpecificPrimitives.contains(swaggerType)) {
|
||||||
|
return swaggerType;
|
||||||
|
}
|
||||||
|
// In this codition, type of p is objective-c object type, e.g. `SWGPet',
|
||||||
|
// return type of p with pointer, e.g. `SWGPet*'
|
||||||
|
else {
|
||||||
|
return swaggerType + "*";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelName(String type) {
|
||||||
|
type = type.replaceAll("[^0-9a-zA-Z_]", "_");
|
||||||
|
|
||||||
|
// language build-in classes
|
||||||
|
if (typeMapping.keySet().contains(type) ||
|
||||||
|
foundationClasses.contains(type) ||
|
||||||
|
importMapping.values().contains(type) ||
|
||||||
|
defaultIncludes.contains(type) ||
|
||||||
|
languageSpecificPrimitives.contains(type)) {
|
||||||
|
return camelize(type);
|
||||||
|
}
|
||||||
|
// custom classes
|
||||||
|
else {
|
||||||
|
return classPrefix + camelize(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelFilename(String name) {
|
||||||
|
// should be the same as the model name
|
||||||
|
return toModelName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void setNonArrayMapProperty(CodegenProperty property, String type) {
|
||||||
|
super.setNonArrayMapProperty(property, type);
|
||||||
|
if ("NSDictionary".equals(type)) {
|
||||||
|
property.setter = "initWithDictionary";
|
||||||
|
} else {
|
||||||
|
property.setter = "initWithValues";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toModelImport(String name) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toDefaultValue(Property p) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String apiFileFolder() {
|
||||||
|
return outputFolder + File.separatorChar + apiPackage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String modelFileFolder() {
|
||||||
|
return outputFolder + File.separatorChar + modelPackage();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toApiName(String name) {
|
||||||
|
return classPrefix + camelize(name) + "Api";
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toApiFilename(String name) {
|
||||||
|
return classPrefix + camelize(name) + "Api";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toVarName(String name) {
|
||||||
|
// replace non-word characters to `_`
|
||||||
|
// e.g. `created-at` to `created_at`
|
||||||
|
name = name.replaceAll("[^a-zA-Z0-9_]", "_");
|
||||||
|
|
||||||
|
// if it's all upper case, do noting
|
||||||
|
if (name.matches("^[A-Z_]$")) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// camelize (lower first character) the variable name
|
||||||
|
// e.g. `pet_id` to `petId`
|
||||||
|
name = camelize(name, true);
|
||||||
|
|
||||||
|
// for reserved word or word starting with number, prepend `_`
|
||||||
|
if (reservedWords.contains(name) || name.matches("^\\d.*")) {
|
||||||
|
name = escapeReservedWord(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toParamName(String name) {
|
||||||
|
// should be the same as variable name
|
||||||
|
return toVarName(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String escapeReservedWord(String name) {
|
||||||
|
return "_" + name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toOperationId(String operationId) {
|
||||||
|
// throw exception if method name is empty
|
||||||
|
if (StringUtils.isEmpty(operationId)) {
|
||||||
|
throw new RuntimeException("Empty method name (operationId) not allowed");
|
||||||
|
}
|
||||||
|
|
||||||
|
// method name cannot use reserved keyword, e.g. return
|
||||||
|
if (reservedWords.contains(operationId)) {
|
||||||
|
throw new RuntimeException(operationId + " (reserved word) cannot be used as method name");
|
||||||
|
}
|
||||||
|
|
||||||
|
return camelize(operationId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setClassPrefix(String classPrefix) {
|
||||||
|
this.classPrefix = classPrefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPodName(String podName) {
|
||||||
|
this.podName = podName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPodVersion(String podVersion) {
|
||||||
|
this.podVersion = podVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user