mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-08 21:26:08 +00:00
Compare commits
1281 Commits
swagger-co
...
v2.1.1-M1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
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 | ||
|
|
b49572005b | ||
|
|
ea11b4fc35 | ||
|
|
556485538f | ||
|
|
53e8683a5d | ||
|
|
6491223ed9 | ||
|
|
29a7375082 | ||
|
|
8f9947a20a | ||
|
|
dcaf639bec | ||
|
|
2f6bf95fa2 | ||
|
|
154c28b062 | ||
|
|
8106de95dc | ||
|
|
7c342a060a | ||
|
|
a15eb6f905 | ||
|
|
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 | ||
|
|
55bb1f2a76 | ||
|
|
cb534047ee | ||
|
|
735f5c61b3 | ||
|
|
73a2fc216e | ||
|
|
46323fae7c | ||
|
|
7fde848680 | ||
|
|
aef4190624 | ||
|
|
4be326152f | ||
|
|
51437245e4 | ||
|
|
36f4239c93 | ||
|
|
87ebc8a7f3 | ||
|
|
a4afa9bac2 | ||
|
|
7af8b0de18 | ||
|
|
66dd67597c | ||
|
|
f5fae2df48 | ||
|
|
adbadfe500 | ||
|
|
f7b1e25453 | ||
|
|
a0b0e7bcb7 | ||
|
|
6aa5b8f089 | ||
|
|
e9ef124f59 | ||
|
|
5d2ae3d353 | ||
|
|
031dd20072 | ||
|
|
67ce62c622 | ||
|
|
b4efa892a1 | ||
|
|
ddc94bcb7c | ||
|
|
bee14e82b2 | ||
|
|
4765c56b2a | ||
|
|
0b7db0ce2d | ||
|
|
68436f6cbe | ||
|
|
444de037bc | ||
|
|
ce1b4ec347 | ||
|
|
b65de5466c | ||
|
|
58cfacc4cf | ||
|
|
cbb61b1002 | ||
|
|
62c3a70843 | ||
|
|
e0d8a75441 | ||
|
|
687eff49a5 | ||
|
|
9f2a90722b | ||
|
|
90b5490f00 | ||
|
|
0bdf466e32 | ||
|
|
a8109930ed | ||
|
|
a3f08e87fd | ||
|
|
e65e5a730d | ||
|
|
8d4afdf5ad | ||
|
|
0a7f8f1055 | ||
|
|
93b11410a9 | ||
|
|
667b1cf7a5 | ||
|
|
93d81b84dc | ||
|
|
3f55736f33 | ||
|
|
91c2af2a98 | ||
|
|
548b86aef1 | ||
|
|
7baae391eb | ||
|
|
22783f8f0a | ||
|
|
55d60aca50 | ||
|
|
dd88a6b0ac | ||
|
|
b0c15d1c9b | ||
|
|
7a379a7b40 | ||
|
|
674fdff35b | ||
|
|
94919895bc | ||
|
|
c4e2515c8f | ||
|
|
85a0a728de | ||
|
|
89ec4010e2 | ||
|
|
b3d5b49e90 | ||
|
|
dbfeb59820 | ||
|
|
3ce7dbd960 | ||
|
|
cef535f380 | ||
|
|
3d1678a087 | ||
|
|
ac9cff08d4 | ||
|
|
5671bcf746 | ||
|
|
31fa05599e | ||
|
|
f20748f0d5 | ||
|
|
155251951b | ||
|
|
e2dbe61adf | ||
|
|
236a9697ad | ||
|
|
2f93e37645 | ||
|
|
56abce3fbd | ||
|
|
b6b80474b7 | ||
|
|
bab5973dd0 | ||
|
|
a29c580205 | ||
|
|
dec7bdfb82 | ||
|
|
b6a85a4b2e | ||
|
|
611cc6075b | ||
|
|
1e8c4668b7 | ||
|
|
84fb24ada5 | ||
|
|
1077e48e7e | ||
|
|
ad5d44769b | ||
|
|
e2c383bd80 | ||
|
|
44d018b642 | ||
|
|
cec3fa5810 | ||
|
|
d6cf7fc9aa | ||
|
|
256e746364 | ||
|
|
0504f68b41 | ||
|
|
21265454ab | ||
|
|
cdc1bbc133 | ||
|
|
2579ed311a | ||
|
|
cdfbedb0ea | ||
|
|
46249530a3 | ||
|
|
7881786fe8 | ||
|
|
5a9979633c | ||
|
|
3d379c82d1 | ||
|
|
77141cd55a | ||
|
|
26bcc80ae3 | ||
|
|
59cd5380aa | ||
|
|
c3b36c6944 | ||
|
|
f85c06628b | ||
|
|
7c55dddf43 | ||
|
|
374c68d8da | ||
|
|
de1ef1dde3 | ||
|
|
f5a69a5a3b | ||
|
|
5afd4b260a | ||
|
|
b648f84980 | ||
|
|
bc28ee97da | ||
|
|
a647576c97 | ||
|
|
45e4c1a53d | ||
|
|
6e4e375589 | ||
|
|
3e5e85509d | ||
|
|
92c0fc5afb | ||
|
|
5e90e2a24a | ||
|
|
53c612c13b | ||
|
|
2a1b1817c5 | ||
|
|
e9a8a8d755 | ||
|
|
9a6392a758 | ||
|
|
0fbae2736d | ||
|
|
85a4aacefa | ||
|
|
5189a85966 | ||
|
|
4d15674803 | ||
|
|
274b9e7c43 | ||
|
|
cf53a24271 | ||
|
|
4c0cd15a40 | ||
|
|
6829014393 | ||
|
|
2647f96c81 | ||
|
|
bbcdee8b28 | ||
|
|
8d79437c8d | ||
|
|
a4c9e26018 | ||
|
|
a38fc6eb06 | ||
|
|
b6a070e604 | ||
|
|
e9146234c7 | ||
|
|
1e73944722 | ||
|
|
f37f284605 | ||
|
|
a7156e6f00 | ||
|
|
7c812c2426 | ||
|
|
2dcfebea98 | ||
|
|
812213164f | ||
|
|
4b43e70555 | ||
|
|
5662891d62 | ||
|
|
a7f38e40c4 | ||
|
|
66f98ebaa8 | ||
|
|
3c53c13685 | ||
|
|
ae271fb57a | ||
|
|
53721239f4 | ||
|
|
6636acf2d3 | ||
|
|
b7ed61b8f9 | ||
|
|
02b5a929ac | ||
|
|
5482cb7822 | ||
|
|
6113826180 | ||
|
|
de1a4059b1 | ||
|
|
267ecec8f2 | ||
|
|
07addb366e | ||
|
|
21848c3cf3 | ||
|
|
45745f6f14 | ||
|
|
f7a929bd02 | ||
|
|
cb55d38a38 | ||
|
|
5eb1372e08 | ||
|
|
73b15dce53 | ||
|
|
9227d7b046 | ||
|
|
de0dffe83f | ||
|
|
3550309544 | ||
|
|
153de3077e | ||
|
|
bbb7e7138c | ||
|
|
c777640f04 | ||
|
|
6df5008310 | ||
|
|
37efc32374 | ||
|
|
275098a8ef | ||
|
|
52a9195411 | ||
|
|
5f81594f03 | ||
|
|
f295fe698a | ||
|
|
8805a7acbb | ||
|
|
b4485b1196 | ||
|
|
a929fce3a0 | ||
|
|
f4c8dd9dec | ||
|
|
79f2be422b | ||
|
|
b92a84eed8 | ||
|
|
a50f0627f9 | ||
|
|
d6f5231e93 | ||
|
|
6a9ba75640 | ||
|
|
95f6b00704 | ||
|
|
00fce59737 | ||
|
|
384a549807 | ||
|
|
af41b43c56 | ||
|
|
b146310c1a | ||
|
|
7138a3f8c2 | ||
|
|
038402abb3 | ||
|
|
52587de715 | ||
|
|
5773626d53 | ||
|
|
2d45c80415 | ||
|
|
432965fa0e | ||
|
|
63f2075410 | ||
|
|
f1c9e6c64e | ||
|
|
05ccb75ebf | ||
|
|
58ce2a1298 | ||
|
|
7e823f879e | ||
|
|
9e3fc6603f | ||
|
|
aa162b9393 | ||
|
|
a33df3ac33 | ||
|
|
c0aecff3dc | ||
|
|
43d15d4d00 | ||
|
|
2633eb77e2 | ||
|
|
094a1f2040 | ||
|
|
fc7c8c6a8f | ||
|
|
404c5ab8c3 | ||
|
|
6db5c15037 | ||
|
|
94ab81c1a2 | ||
|
|
e2d8f97e13 | ||
|
|
9be7a3f53c |
17
.gitignore
vendored
17
.gitignore
vendored
@@ -9,5 +9,22 @@ version.properties
|
||||
lib/*
|
||||
build/*
|
||||
generated-files/*
|
||||
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
|
||||
|
||||
target
|
||||
.idea
|
||||
.lib
|
||||
atlassian-ide-plugin.xml
|
||||
.DS_Store
|
||||
|
||||
4
.travis.yml
Normal file
4
.travis.yml
Normal file
@@ -0,0 +1,4 @@
|
||||
language: java
|
||||
script: mvn verify
|
||||
jdk:
|
||||
- oraclejdk7
|
||||
392
README.md
392
README.md
@@ -1,190 +1,242 @@
|
||||
# Swagger Client Code-Generator
|
||||
# Swagger Code Generator
|
||||
|
||||
[](https://travis-ci.org/swagger-api/swagger-codegen)
|
||||
|
||||
## Overview
|
||||
This is a project to build the Swagger code-gen library which can be used to automatically
|
||||
generate client libraries from a Swagger-compliant server. It also contains a testing
|
||||
framework which allows the client library to query an API server and validate expected results
|
||||
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.
|
||||
This is the swagger codegen project, which allows generation of client libraries automatically from a Swagger-compliant server.
|
||||
|
||||
## What's Swagger?
|
||||
|
||||
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
|
||||
|
||||
|
||||
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.
|
||||
|
||||
|
||||
## Compatability
|
||||
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 compatability | Notes
|
||||
----------------------- | ------------ | -------------------------- | -----
|
||||
2.1.0-M1 | 2015-02-16 | 1.0, 1.1, 1.2, 2.0 | [tag v2.1.0-M1](https://github.com/swagger-api/swagger-codegen/tree/v2.1.0-M1)
|
||||
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
|
||||
You need the following installed and available in your $PATH:
|
||||
|
||||
<li>- Java 1.6 or greater (http://java.oracle.com)
|
||||
* [Java 7](http://java.oracle.com)
|
||||
|
||||
<li>- Apache ant 1.7 or greater (http://ant.apache.org/)
|
||||
* [Apache maven 3.0.3 or greater](http://maven.apache.org/)
|
||||
|
||||
<li>- Scala 2.x or greater (http://www.scala-lang.org/downloads)
|
||||
After cloning the project, you can build it from source with this command:
|
||||
|
||||
You also need to set an environment variable for SCALA_HOME:
|
||||
```
|
||||
mvn package
|
||||
```
|
||||
|
||||
<pre>
|
||||
export SCALA_HOME={PATH_TO_YOUR_SCALA_DEPLOYMENT}
|
||||
</pre>
|
||||
### To generate a sample client library
|
||||
You can build a client against the swagger sample [petstore](http://petstore.swagger.io) API as follows:
|
||||
|
||||
```
|
||||
./bin/java-petstore.sh
|
||||
```
|
||||
|
||||
This will run the generator with this command:
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-distribution/target/swagger-codegen-distribution-2.1.0-M1.jar \
|
||||
-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 -h flag:
|
||||
```
|
||||
usage: Codegen
|
||||
-a,--auth addes authorization headers when fetching the
|
||||
swagger definitions remotely. Pass in a
|
||||
URL-encoded string of name:header with a comma
|
||||
separating multiple values
|
||||
-d,--debug-info prints additional info for debugging
|
||||
-h,--help shows this message
|
||||
-i,--input-spec <arg> location of the swagger spec, as URL or file
|
||||
-l,--lang <arg> client language to generate.
|
||||
Available languages include:
|
||||
[android, java, jaxrs, nodejs, objc, scalatra,
|
||||
scala, dynamic-html, html, swagger, tizen, php,
|
||||
python]
|
||||
-o,--output <arg> where to write the generated files
|
||||
-t,--template-dir <arg> folder containing the template files
|
||||
```
|
||||
|
||||
You can then compile and run the client, as well as unit tests against it:
|
||||
|
||||
```
|
||||
cd samples/client/petstore/java
|
||||
mvn package
|
||||
```
|
||||
|
||||
Other languages have petstore samples, too:
|
||||
```
|
||||
./bin/android-petstore.sh
|
||||
./bin/java-petstore.sh
|
||||
./bin/objc-petstore.sh
|
||||
```
|
||||
|
||||
### Generating libraries from your server
|
||||
It's just as easy--just use the `-i` flag to point to either a server or file.
|
||||
|
||||
### Modifying the client library format
|
||||
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.
|
||||
|
||||
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 tempalte folder. It actually is that easy.
|
||||
|
||||
### Where is Javascript???
|
||||
See our [javascript library](http://github.com/swagger-api/swagger-js)--it's completely dynamic and doesn't require
|
||||
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)
|
||||
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:
|
||||
|
||||
```
|
||||
-i ./modules/swagger-codegen/src/test/resources/2_0/petstore.json
|
||||
```
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
$ ls -1 modules/swagger-codegen/src/main/java/com/wordnik/swagger/codegen/languages/
|
||||
AndroidClientCodegen.java
|
||||
JavaClientCodegen.java
|
||||
JaxRSServerCodegen.java
|
||||
NodeJSServerCodegen.java
|
||||
ObjcClientCodegen.java
|
||||
PhpClientCodegen.java
|
||||
PythonClientCodegen.java
|
||||
ScalaClientCodegen.java
|
||||
ScalatraServerCodegen.java
|
||||
StaticDocCodegen.java
|
||||
StaticHtmlGenerator.java
|
||||
SwaggerGenerator.java
|
||||
TizenClientCodegen.java
|
||||
```
|
||||
|
||||
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 may want to extend these.
|
||||
|
||||
To change, for example, the prefix for the Objective-C generated files, simply subclass the ObjcClientCodegen.java:
|
||||
|
||||
```
|
||||
package com.mycompany.swagger.codegen;
|
||||
|
||||
import com.wordnik.swagger.codegen.languages.*;
|
||||
|
||||
public class MyObjcCodegen extends ObjcClientCodegen {
|
||||
static {
|
||||
PREFIX = "HELO";
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
and specify the `classname` when running the generator:
|
||||
|
||||
```
|
||||
-i com.mycompany.swagger.codegen.MyObjcCodegen
|
||||
```
|
||||
|
||||
Your subclass will now be loaded and overrides the `PREFIX` value in the superclass.
|
||||
|
||||
### Validating your swagger spec
|
||||
|
||||
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:
|
||||
|
||||
```
|
||||
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-distribution/target/swagger-codegen-distribution-2.1.0-M1.jar \
|
||||
-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-distribution/target/swagger-codegen-distribution-2.1.0-M1.jar \
|
||||
-i http://petstore.swagger.io/v2/swagger.json \
|
||||
-l scalatra \
|
||||
-o samples/server/petstore/scalatra
|
||||
```
|
||||
|
||||
### java jax-rs
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-distribution/target/swagger-codegen-distribution-2.1.0-M1.jar \
|
||||
-i http://petstore.swagger.io/v2/swagger.json \
|
||||
-l jaxrs \
|
||||
-o samples/server/petstore/jaxrs
|
||||
```
|
||||
|
||||
### To build the codegen library
|
||||
|
||||
You can build the client with the following:
|
||||
This will create the swagger-codegen library from source.
|
||||
|
||||
````
|
||||
```
|
||||
mvn package
|
||||
````
|
||||
```
|
||||
|
||||
### Other languages
|
||||
#### scala
|
||||
<pre>
|
||||
./bin/generate-scala-lib.sh http://petstore.swagger.wordnik.com/api "" "client" "generated-files"
|
||||
</pre>
|
||||
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
|
||||
|
||||
#### javascript
|
||||
<pre>
|
||||
./bin/generate-js-lib.sh http://petstore.swagger.wordnik.com/api "" "" "generated-files"
|
||||
</pre>
|
||||
License
|
||||
-------
|
||||
|
||||
#### actionscript
|
||||
<pre>
|
||||
./bin/generate-as3-lib.sh http://petstore.swagger.wordnik.com/api "" "client" "generated-files"
|
||||
</pre>
|
||||
Copyright 2015 Reverb Technologies, Inc.
|
||||
|
||||
#### PHP
|
||||
<pre>
|
||||
./bin/generate-php-lib.sh http://petstore.swagger.wordnik.com/api "" "client" "generated-files"
|
||||
</pre>
|
||||
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)
|
||||
|
||||
#### Python
|
||||
<pre>
|
||||
./bin/generate-python-lib.sh http://petstore.swagger.wordnik.com/api "" "client" "generated-files"
|
||||
</pre>
|
||||
|
||||
The main class for the generator is at src/main/java/com/wordnik/swagger/codegen/config/java/JavaLibCodeGen.java
|
||||
|
||||
The code-gen uses the antlr string template library for generating the output files, please look at
|
||||
http://www.stringtemplate.org for details on the antlr framework.
|
||||
|
||||
The Wordnik team is working on generating libraries for Ruby, ActionScript 3, Android, PHP and JavaScript, which will be open-sourced in the coming weeks
|
||||
|
||||
### The Swagger client test framework
|
||||
|
||||
The testing framework helps you to test Swagger generated client libraries using declarative test scripts. The same
|
||||
scripts can be used to test client libraries in different languages. The framework can be used for client and server
|
||||
regression testing.
|
||||
|
||||
For Example, first build the client library from the sample app:
|
||||
<pre>
|
||||
./bin/generate-java-lib.sh http://petstore.swagger.wordnik.com/api/ special-key com.foo.mydriver generated-files
|
||||
</pre>
|
||||
|
||||
Use the sample build script to build a jar from the client files:
|
||||
<pre>
|
||||
cp conf/java/sample/*.xml ./generated-files
|
||||
|
||||
cd generated-files
|
||||
|
||||
ant
|
||||
</pre>
|
||||
|
||||
This creates a complete client library jar. You can now run the tests:
|
||||
|
||||
<pre>
|
||||
./bin/test-java-lib.sh http://petstore.swagger.wordnik.com/api/ special-key conf/java/sample/lib-test-script.json \
|
||||
conf/java/sample/lib-test-data.json com.foo.mydriver.model.TestData com.foo.mydriver.api \
|
||||
generated-files/build/swagger-sample-java-lib-1.0.jar
|
||||
|
||||
Summary --> Total Test Cases: 9 Failed Test Cases: 0
|
||||
Details:
|
||||
1.1 : Create User : passed
|
||||
|
||||
1.2 : Login User : passed
|
||||
|
||||
1.3 : Find user by name : passed
|
||||
|
||||
1.4 : Delete user by name : passed
|
||||
|
||||
2.1 : Add pet : passed
|
||||
|
||||
2.2 : Find pet by id : passed
|
||||
|
||||
2.3 : Find pet by status : passed
|
||||
|
||||
3.1 : Find order by id : passed
|
||||
|
||||
3.2 : Place order : passed
|
||||
</pre>
|
||||
|
||||
In detail, there are two components in the test framework:
|
||||
|
||||
<li>- Test Script
|
||||
|
||||
<li>- Test Data
|
||||
|
||||
|
||||
#### Test script details
|
||||
|
||||
Test script is written in JSON structure. The JSON consists of following elements:
|
||||
|
||||
##### Resources. This is a list of resources considered in the test. Each resource object consists of following properties:
|
||||
|
||||
<li>- id: a unique test script ID
|
||||
|
||||
<li>- name: name of the resource, used in displaying the test result
|
||||
|
||||
<li>- httpMethod: HTTP method used in invoking this resource
|
||||
|
||||
<li>- path: path of the resource
|
||||
|
||||
<li>- suggested method name: By default this refers to method name of the API in resource classes
|
||||
|
||||
##### Test suites. This is a logical way of grouping related test cases. Each test suite consists of following properties:
|
||||
|
||||
<li>- id: unique id of the test script, displayed in the test report
|
||||
|
||||
<li>- name: name of the test suite. Used in test report
|
||||
|
||||
<li>- test cases: List of test cases with in each suite. Each test case consists of following properties:
|
||||
|
||||
<li>- id: unique with in the test suite. Used for reporting and tracking output data
|
||||
|
||||
<li>- name: Name of the test case
|
||||
|
||||
<li>- resource id: references the resource id in the resources section
|
||||
|
||||
<li>- input: Input is a JSON object with each property in the object map to query, path or post parameters.
|
||||
For POST data, the name of the property should be supplied as postData. The value for each property can refer
|
||||
to input file or output from previous test cases or actual values.
|
||||
|
||||
<li>- assertions: list of assertions that needs to be evaluated after test case is executed.
|
||||
|
||||
Each assertion contains
|
||||
|
||||
<li>- actual output, specified with reference to output of the current test case using syntax similar to object graph navigation language
|
||||
<li>- condition , support values are equal (==), not equal (!=), less than (<), lesser than or equal (<=), greater than (>), greater than or equal (>=)
|
||||
<li>- expected output. Specified using actual values or values referring previous outputs or input data file
|
||||
|
||||
Test data file is documented using a Test Data Object which is generated as part of Java client library code-gen. This
|
||||
class provides list getters and setters for each model object available in the resource description. It is called "TestData"
|
||||
and it is available in model package of the java library code generation output.
|
||||
|
||||
Chaining results of test cases:
|
||||
|
||||
<li>- Reference to data in input file is done with prefix <pre>${input.</pre>, followed by object graph navigation syntax.
|
||||
Example: to refer a first user object in test data file use the syntax <pre>${input.userList[0]}</pre>
|
||||
|
||||
<li>- To refer a individual property of user object use the syntax <pre>${input.userList[0].username}</pre>
|
||||
|
||||
<li>- Reference to output of test cases is done using combination test case path and OGNL. Reference to test cases output
|
||||
is prefixed with <pre>${output.</pre>
|
||||
|
||||
<li>- To refer an output of test case 1 in test suite 2, the syntax will be <pre>${output(1.2)}</pre>. Individual attributes can
|
||||
be accessed using OGNL syntax. Example: <pre>${output(1.1).username}</pre>
|
||||
|
||||
#### Reporting Test Results
|
||||
|
||||
A Summary will be reported with each test run. For instance:
|
||||
|
||||
<pre>
|
||||
Sample: "Summary --> Total Test Cases: 9 Failed Test Cases: 0"
|
||||
</pre>
|
||||
|
||||
In detail section each test case and its status (passed/failed) are reported. Failures include an exception trace. Test case path is
|
||||
combination of test suite id and test case id separated by "."
|
||||
|
||||
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.
|
||||
|
||||
6
bin/Version.scala
Normal file
6
bin/Version.scala
Normal file
@@ -0,0 +1,6 @@
|
||||
val version = scala.util.Properties.scalaPropOrElse("version.number", "unknown").toString match {
|
||||
case s if s startsWith "2.10" => "2.10"
|
||||
case s if s startsWith "2.11" => "2.11"
|
||||
case e: String => e
|
||||
}
|
||||
println(version)
|
||||
31
bin/all-petstore.sh
Executable file
31
bin/all-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
|
||||
|
||||
cd $APP_DIR
|
||||
./bin/android-java-petstore.sh
|
||||
./bin/dynamic-html.sh
|
||||
./bin/html.sh
|
||||
./bin/jaxrs-petstore-server.sh
|
||||
./bin/java-petstore-filemap.sh
|
||||
./bin/java-petstore.sh
|
||||
./bin/php-petstore.sh
|
||||
./bin/python-petstore.sh
|
||||
./bin/objc-petstore.sh
|
||||
./bin/scala-petstore.sh
|
||||
./bin/tizen-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
|
||||
36
bin/android-java-petstore.sh
Executable file
36
bin/android-java-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -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
|
||||
36
bin/android-java-wordnik-api.sh
Executable file
36
bin/android-java-wordnik-api.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -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
|
||||
36
bin/dynamic-html.sh
Executable file
36
bin/dynamic-html.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -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,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 4 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count "
|
||||
echo "Syntax: $0 location_of_service api_key package_name library_root"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.codegen.config.as3.As3LibCodeGen "$@"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 4 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count"
|
||||
echo "Syntax: $0 location_of_service api_key package_name library_root"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.codegen.config.java.JavaLibCodeGen "$@"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 3 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count "
|
||||
echo "Syntax: $0 location_of_service api_key library_root"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.codegen.config.js.JSLibCodeGen "$@"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 4 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count"
|
||||
echo "Syntax: $0 location_of_service api_key package_name library_root"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.codegen.config.php.PHPLibCodeGen "$@"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 4 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count"
|
||||
echo "Syntax: $0 location_of_service api_key package_name library_root"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.codegen.config.python.PythonLibCodeGen "$@"
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 4 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count"
|
||||
echo "Syntax: $0 location_of_service api_key package_name library_root"
|
||||
exit
|
||||
fi
|
||||
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g"
|
||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.codegen.config.scala.ScalaLibCodeGen "$@"
|
||||
36
bin/html-petstore.sh
Executable file
36
bin/html-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l html -o samples/html"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/java-petstore.sh
Executable file
36
bin/java-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l java -o samples/client/petstore/java"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/java-wordnik-api.sh
Executable file
36
bin/java-wordnik-api.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l java -o samples/client/wordnik/java"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/jaxrs-petstore-server.sh
Executable file
36
bin/jaxrs-petstore-server.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l jaxrs -o samples/server/petstore/jaxrs"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/nodejs-petstore-server.sh
Executable file
36
bin/nodejs-petstore-server.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l nodejs -o samples/server/petstore/nodejs"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/objc-petstore.sh
Executable file
36
bin/objc-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l objc -o samples/client/petstore/objc"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/objc-wordnik-api.sh
Executable file
36
bin/objc-wordnik-api.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l objc -o samples/client/wordnik/objc"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/php-petstore.sh
Executable file
36
bin/php-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l php -o samples/client/petstore/php"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/python-petstore.sh
Executable file
36
bin/python-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -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,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
echo -n 'build/main/java' >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
#first argument to the command line script give location of the library jar file
|
||||
export CLASSPATH=$(cat classpath.txt)$2
|
||||
export JAVA_OPTS="${JAVA_OPTS} -DrulePath=data -Dproperty=Xmx2g -DloggerPath=$BUILD_COMMON/test-config/log4j.properties"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH "$@" com.wordnik.swagger.api ../swagger-sample-app/sdk-libs/bin/AirExecutorApp-app.xml "/Applications/Adobe Flash Builder 4/sdks/4.1.0"
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "" > classpath.txt
|
||||
for file in `ls lib`;
|
||||
do echo -n 'lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls build`;
|
||||
do echo -n 'build/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -DrulePath=data -Dproperty=Xmx2g -DloggerPath=$BUILD_COMMON/test-config/log4j.properties"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH "$@"
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "" > classpath.txt
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
#first argument to the command line script give location of the library jar file
|
||||
export CLASSPATH=$(cat classpath.txt)$2
|
||||
export JAVA_OPTS="${JAVA_OPTS} -DrulePath=data -Dproperty=Xmx2g -DloggerPath=$BUILD_COMMON/test-config/log4j.properties"
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH "$@"
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
#!/bin/bash
|
||||
echo "" > classpath.txt
|
||||
for file in `ls lib`;
|
||||
do echo -n 'lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls build`;
|
||||
do echo -n 'build/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
|
||||
export CLASSPATH=$(cat classpath.txt)
|
||||
export JAVA_OPTS="${JAVA_OPTS} -DrulePath=data -Dproperty=Xmx2g -DloggerPath=$BUILD_COMMON/test-config/log4j.properties"
|
||||
scala $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH "$@"
|
||||
|
||||
36
bin/scala-petstore.sh
Executable file
36
bin/scala-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scala -o samples/client/petstore/scala"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/scala-wordnik-api.sh
Executable file
36
bin/scala-wordnik-api.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/wordnik.json -l scala -o samples/client/wordnik/scala"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
36
bin/scalatra-petstore-server.sh
Executable file
36
bin/scalatra-petstore-server.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l scalatra -o samples/server/petstore/scalatra"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,23 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 7 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count - expected 7 but has "
|
||||
echo "$#"
|
||||
echo "Syntax: $0 location_of_service api_key test_script_location test_data_location test_data_class_name api_classes_package_name location_of_client_library"
|
||||
exit
|
||||
fi
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
export CLASSPATH=$(cat classpath.txt)$7
|
||||
echo $CLASSPATH
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g "
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.testframework.APITestRunner "$@" AS3
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/bin/bash
|
||||
if [ $# -ne 7 ]
|
||||
then
|
||||
echo "Error in $0 - Invalid Argument Count"
|
||||
echo "Syntax: $0 location_of_client_library location_of_service api_key test_script_location test_data_location test_data_class_name api_classes_package_name"
|
||||
exit
|
||||
fi
|
||||
echo "" > classpath.txt
|
||||
for file in `ls target/lib`;
|
||||
do echo -n 'target/lib/' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
for file in `ls target/*.jar`;
|
||||
do echo -n '' >> classpath.txt;
|
||||
echo -n $file >> classpath.txt;
|
||||
echo -n ':' >> classpath.txt;
|
||||
done
|
||||
export CLASSPATH=$(cat classpath.txt)$7
|
||||
echo $CLASSPATH
|
||||
export JAVA_OPTS="${JAVA_OPTS} -Dproperty=Xmx2g "
|
||||
java $WORDNIK_OPTS $JAVA_CONFIG_OPTIONS $JAVA_OPTS -cp $CLASSPATH com.wordnik.swagger.testframework.APITestRunner "$@" JAVA
|
||||
36
bin/tizen-petstore.sh
Executable file
36
bin/tizen-petstore.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/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
|
||||
|
||||
root=./modules/swagger-codegen-distribution/pom.xml
|
||||
|
||||
# gets version of swagger-codegen
|
||||
version=$(sed '/<project>/,/<\/project>/d;/<version>/!d;s/ *<\/\?version> *//g' $root | sed -n '2p' | sed -e 's,.*<version>\([^<]*\)</version>.*,\1,g')
|
||||
|
||||
executable="./modules/swagger-codegen-distribution/target/swagger-codegen-distribution-$version.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="$@ -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l tizen -o samples/client/petstore/tizen"
|
||||
|
||||
java $JAVA_OPTS -jar $executable $ags
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"apiUrl":"http://localhost:8002/api/",
|
||||
|
||||
"apiKey":"special-key",
|
||||
|
||||
"defaultServiceBaseClass":"SwaggerApi",
|
||||
|
||||
"defaultModelBaseClass":"Object",
|
||||
|
||||
"serviceBaseClasses":{},
|
||||
|
||||
"defaultModelImports":[],
|
||||
|
||||
"defaultServiceImports":[],
|
||||
|
||||
"modelPackageName":"com.wordnik.swagger.model",
|
||||
|
||||
"apiPackageName":"com.wordnik.swagger.api",
|
||||
|
||||
"ignoreMethods":[],
|
||||
|
||||
"ignoreModels":[],
|
||||
|
||||
"outputDirectory":"../swagger-sample-app/sdk-libs/src/main/as3/com/wordnik/swagger/",
|
||||
|
||||
"libraryHome":"../swagger-sample-app/sdk-libs"
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"userList":[
|
||||
{
|
||||
"username":"testuser1",
|
||||
"password":"password1",
|
||||
"email":"test1@dummy.com"
|
||||
},
|
||||
{
|
||||
"username":"testuser2",
|
||||
"password":"password2",
|
||||
"email":"test2@dummy.com"
|
||||
}
|
||||
],
|
||||
"petList":[
|
||||
{
|
||||
"id":101,
|
||||
"name":"pet1",
|
||||
"photoUrls":["url1","url2"],
|
||||
"tags":[
|
||||
{
|
||||
"id":1,
|
||||
"name":"tag1"
|
||||
},
|
||||
{
|
||||
"id":2,
|
||||
"name":"tag2"
|
||||
}
|
||||
],
|
||||
"status":"available",
|
||||
"category":{"id":1,"name":"cat1"}
|
||||
}
|
||||
],
|
||||
"orderList":[
|
||||
{
|
||||
"id":101,
|
||||
"petId":1,
|
||||
"quantity":1,
|
||||
"status":"placed",
|
||||
"shipDate":13456789
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
{
|
||||
"resources" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Find Per by Id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/{petId}",
|
||||
"suggestedMethodName" : "getPetById"
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Find pets by status",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByStatus",
|
||||
"suggestedMethodName" : "findPetsByStatus"
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Find pets by tags",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByTags",
|
||||
"suggestedMethodName" : "findPetsByTags"
|
||||
},
|
||||
{
|
||||
"id" : 4,
|
||||
"name" : "Add a pet",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "addPet"
|
||||
},
|
||||
{
|
||||
"id" : 5,
|
||||
"name" : "Update a pet",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "updatePet"
|
||||
},
|
||||
{
|
||||
"id" : 6,
|
||||
"name" : "Create user",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/user.{format}",
|
||||
"suggestedMethodName" : "createUser"
|
||||
},
|
||||
{
|
||||
"id" : 7,
|
||||
"name" : "Update user",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "updateUser"
|
||||
},
|
||||
{
|
||||
"id" : 8,
|
||||
"name" : "Delete user",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "deleteUser"
|
||||
},
|
||||
{
|
||||
"id" : 9,
|
||||
"name" : "Get user by user name",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "getUserByName"
|
||||
},
|
||||
{
|
||||
"id" : 10,
|
||||
"name" : "Login",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/login",
|
||||
"suggestedMethodName" : "loginUser"
|
||||
},
|
||||
{
|
||||
"id" : 11,
|
||||
"name" : "Logout",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/logout",
|
||||
"suggestedMethodName" : "logoutUser"
|
||||
},
|
||||
{
|
||||
"id" : 12,
|
||||
"name" : "Find order by id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "getOrderById"
|
||||
},
|
||||
{
|
||||
"id" : 13,
|
||||
"name" : "Delete order by id",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "deleteOrder"
|
||||
},
|
||||
{
|
||||
"id" : 14,
|
||||
"name" : "Create order",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/store.{format}/order",
|
||||
"suggestedMethodName" : "placeOrder"
|
||||
}
|
||||
],
|
||||
"testSuites" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Test User service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Create User",
|
||||
"id" : 1,
|
||||
"resourceId" : 6,
|
||||
"input" : {
|
||||
"postData":"${input.userList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Login User",
|
||||
"id" : 2,
|
||||
"resourceId" : 10,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}",
|
||||
"password":"${input.userList[0].password}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find user by name",
|
||||
"id" : 3,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.3).username}",
|
||||
"condition" : "==",
|
||||
"expectedOutput" : "${input.userList[0].username}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Delete user by name",
|
||||
"id" : 4,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.4)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Test Pet service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Add pet",
|
||||
"id" : 1,
|
||||
"resourceId" : 4,
|
||||
"input" : {
|
||||
"postData":"${input.petList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by id",
|
||||
"id" : 2,
|
||||
"resourceId" : 1,
|
||||
"input" : {
|
||||
"petId":"1"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by status",
|
||||
"id" : 3,
|
||||
"resourceId" : 2,
|
||||
"input" : {
|
||||
"status":"available,sold,pending"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.3).size}",
|
||||
"condition" : ">",
|
||||
"expectedOutput" : "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Test Store service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Find order by id",
|
||||
"id" : 1,
|
||||
"resourceId" : 12,
|
||||
"input" : {
|
||||
"orderId":"1"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(3.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Place order",
|
||||
"id" : 2,
|
||||
"resourceId" : 14,
|
||||
"input" : {
|
||||
"postData":"${input.orderList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,241 +0,0 @@
|
||||
package com.wordnik.swagger.common
|
||||
{
|
||||
import asaxb.xml.bind.ASAXBContext;
|
||||
import asaxb.xml.bind.Unmarshaller;
|
||||
|
||||
import com.wordnik.swagger.event.ApiClientEvent;
|
||||
import com.wordnik.swagger.event.Response;
|
||||
import com.wordnik.swagger.common.ApiUserCredentials;
|
||||
import com.wordnik.swagger.model.LibraryReferences;
|
||||
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.utils.Dictionary;
|
||||
import flash.utils.describeType;
|
||||
import flash.xml.XMLDocument;
|
||||
import flash.xml.XMLNode;
|
||||
|
||||
import mx.messaging.ChannelSet;
|
||||
import mx.messaging.channels.HTTPChannel;
|
||||
import mx.messaging.messages.HTTPRequestMessage;
|
||||
import mx.rpc.AsyncToken;
|
||||
import mx.rpc.events.FaultEvent;
|
||||
import mx.rpc.events.ResultEvent;
|
||||
import mx.rpc.http.HTTPService;
|
||||
import mx.rpc.xml.SimpleXMLEncoder;
|
||||
import mx.utils.ObjectUtil;
|
||||
|
||||
|
||||
public class ApiInvoker extends EventDispatcher
|
||||
{
|
||||
|
||||
private var _apiUsageCredentials:ApiUserCredentials;
|
||||
internal var _apiProxyServerUrl:String = "";
|
||||
private var _baseUrl: String = "";
|
||||
internal var _useProxyServer: Boolean = true;
|
||||
private var _proxyHostName:String = "";
|
||||
private var _apiPath: String = "";
|
||||
|
||||
public var _apiEventNotifier:EventDispatcher;
|
||||
public var _apiLibraryReferences:LibraryReferences;
|
||||
|
||||
private static const DELETE_DATA_DUMMY:String = "dummyDataRequiredForDeleteOverride";
|
||||
private static const X_HTTP_OVERRIDE_KEY:String = "X-HTTP-Method-Override";
|
||||
private static const CONTENT_TYPE_HEADER_KEY:String = "Content-Type";
|
||||
|
||||
public function ApiInvoker(apiUsageCredentials: ApiUserCredentials, eventNotifier: EventDispatcher, useProxy: Boolean = true) {
|
||||
_apiUsageCredentials = apiUsageCredentials;
|
||||
_useProxyServer = useProxy;
|
||||
if(_apiUsageCredentials.hostName != null){
|
||||
_proxyHostName = _apiUsageCredentials.hostName;
|
||||
}
|
||||
_apiPath = _apiUsageCredentials.apiPath;
|
||||
_apiProxyServerUrl = _apiUsageCredentials.apiProxyServerUrl;
|
||||
_apiEventNotifier = eventNotifier;
|
||||
}
|
||||
|
||||
public function invokeAPI(resourceURL: String, method: String, queryParams: Dictionary, postObject: Object, headerParams: Dictionary): AsyncToken {
|
||||
//make the communication
|
||||
if(_useProxyServer) {
|
||||
resourceURL = resourceURL = _apiProxyServerUrl + resourceURL;
|
||||
}
|
||||
else{
|
||||
resourceURL = resourceURL = "http://"+ _proxyHostName + _apiPath + resourceURL;
|
||||
}
|
||||
|
||||
var counter: int = 0;
|
||||
var symbol: String = "&";
|
||||
var paramValue: Object;
|
||||
for (var paramName:String in queryParams) {
|
||||
paramValue = queryParams[paramName];
|
||||
//var key:String = paramName;
|
||||
// do stuff
|
||||
symbol = "&";
|
||||
if(counter == 0){
|
||||
symbol = "?";
|
||||
}
|
||||
resourceURL = resourceURL + symbol + paramName + "=" + paramValue.toString();
|
||||
counter++;
|
||||
|
||||
}
|
||||
//create a httpservice and invoke the rest url waiting for response
|
||||
var requestHeader:Object = new Object();
|
||||
resourceURL = ApiUrlHelper.appendTokenInfo(resourceURL, requestHeader, _apiUsageCredentials);
|
||||
var bodyData:String = marshal( postObject);//restRequest.postData;
|
||||
|
||||
return doRestCall(resourceURL, onApiRequestResult, onApiRequestFault, method, bodyData, requestHeader, "application/xml");
|
||||
|
||||
|
||||
}
|
||||
|
||||
private function doRestCall( url : String, resultFunction : Function, faultFunction : Function = null,
|
||||
restMethod : String = "GET",
|
||||
bodyData : Object = null, headers: Object = null, contentType:String = "application/xml" ) : AsyncToken
|
||||
{
|
||||
var httpService : HTTPService = new HTTPService( );
|
||||
|
||||
if(headers == null){
|
||||
headers = new Object();
|
||||
}
|
||||
httpService.method = restMethod;
|
||||
|
||||
if ( restMethod.toUpperCase() != HTTPRequestMessage.GET_METHOD )
|
||||
{
|
||||
//httpService.method = HTTPRequestMessage.POST_METHOD; - not required as we're using the proxy
|
||||
if( bodyData == null )
|
||||
{
|
||||
bodyData = new Object();
|
||||
}
|
||||
|
||||
if(restMethod == HTTPRequestMessage.DELETE_METHOD){
|
||||
headers[X_HTTP_OVERRIDE_KEY]= HTTPRequestMessage.DELETE_METHOD;
|
||||
bodyData = DELETE_DATA_DUMMY;
|
||||
}
|
||||
else{
|
||||
headers[CONTENT_TYPE_HEADER_KEY]= contentType;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//if the request type is GET and content type is xml then the Flex HTTPService converts it to a POST ... yeah
|
||||
contentType = null;
|
||||
}
|
||||
|
||||
httpService.url = url;
|
||||
httpService.contentType = contentType;
|
||||
httpService.resultFormat = "e4x";
|
||||
httpService.headers = headers;
|
||||
httpService.addEventListener( ResultEvent.RESULT, resultFunction );
|
||||
if( faultFunction != null )
|
||||
{
|
||||
httpService.addEventListener( FaultEvent.FAULT, faultFunction );
|
||||
}
|
||||
if(_useProxyServer){
|
||||
httpService.useProxy = true;
|
||||
|
||||
var channelSet: ChannelSet = new ChannelSet();
|
||||
var httpChannel: HTTPChannel = new HTTPChannel();
|
||||
httpChannel.uri = ApiUrlHelper.getProxyUrl(_proxyHostName);
|
||||
channelSet.addChannel(httpChannel);
|
||||
httpService.channelSet = channelSet;
|
||||
}
|
||||
return httpService.send( bodyData );
|
||||
}
|
||||
|
||||
private function onApiRequestResult(event:ResultEvent):void
|
||||
{
|
||||
var completionListener: Function = event.token.completionListener;
|
||||
var result: Object = event.result;
|
||||
var resultType: Class = event.token.returnType;
|
||||
var resultObject:Object;
|
||||
if(resultType != null) {
|
||||
var context:ASAXBContext = ASAXBContext.newInstance(resultType);
|
||||
var unmarshaller:Unmarshaller = context.createUnmarshaller();
|
||||
var resultXML: XML = new XML(event.result);
|
||||
try{
|
||||
resultObject = unmarshaller.unmarshal(resultXML);
|
||||
}
|
||||
catch(error: TypeError){
|
||||
var errorResponse: Response = new Response(false, null, "Could not unmarshall response");
|
||||
if (_apiEventNotifier != null) { //dispatch event via assigned dispatcher
|
||||
var failureEvent: ApiClientEvent = new ApiClientEvent(event.token.completionEventType);
|
||||
failureEvent.response = errorResponse;
|
||||
_apiEventNotifier.dispatchEvent(failureEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if(resultObject is ListWrapper){
|
||||
resultObject = ListWrapper(resultObject).getList();
|
||||
}
|
||||
|
||||
}
|
||||
var response : Response = new Response(true, resultObject);
|
||||
response.requestId = event.token.requestId;
|
||||
var successEventType: String = event.token.completionEventType != null ? event.token.completionEventType : ApiClientEvent.SUCCESS_EVENT;
|
||||
|
||||
if (_apiEventNotifier != null) { //dispatch event via assigned dispatcher
|
||||
var successEvent: ApiClientEvent = new ApiClientEvent(successEventType);
|
||||
successEvent.response = response;
|
||||
_apiEventNotifier.dispatchEvent(successEvent);
|
||||
}
|
||||
}
|
||||
|
||||
private function onApiRequestFault(event:FaultEvent):void
|
||||
{
|
||||
var completionListener: Function = event.token.completionListener;
|
||||
if(completionListener != null){
|
||||
completionListener.call( null, new Response( false, null, event.fault.faultString) );
|
||||
}
|
||||
|
||||
var failureEventType: String = event.token.completionEventType != null ? event.token.completionEventType : ApiClientEvent.FAILURE_EVENT;
|
||||
|
||||
if (_apiEventNotifier != null) { //dispatch event via assigned dispatcher
|
||||
var failureEvent: ApiClientEvent = new ApiClientEvent(failureEventType);
|
||||
failureEvent.response = new Response( false, null, event.fault.faultString);
|
||||
_apiEventNotifier.dispatchEvent(failureEvent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function marshal(source:Object):XML
|
||||
{
|
||||
var writer:XMLWriter=new XMLWriter();
|
||||
var objDescriptor:XML=describeType(source);
|
||||
var property:XML;
|
||||
var propertyType:String;
|
||||
var propertyValue:Object;
|
||||
|
||||
var qualifiedClassName:String=objDescriptor.@name;
|
||||
qualifiedClassName=qualifiedClassName.replace("::",".");
|
||||
var className: String = qualifiedClassName.substring(qualifiedClassName.lastIndexOf(".") + 1);
|
||||
className = className.charAt().toLowerCase() + className.substring(1);
|
||||
writer.xml.setName(className);
|
||||
|
||||
for each(property in objDescriptor.elements("variable")){
|
||||
propertyValue=source[property.@name];
|
||||
if (propertyValue!=null){
|
||||
if (ObjectUtil.isSimple(propertyValue)){
|
||||
writer.addProperty(property.@name, propertyValue.toString());
|
||||
}
|
||||
else {
|
||||
writer.addProperty(property.@name, marshal(propertyValue).toXMLString());
|
||||
}
|
||||
}
|
||||
}
|
||||
for each(property in objDescriptor.elements("accessor")){
|
||||
if (property.@access=="readonly"){
|
||||
continue;
|
||||
}
|
||||
propertyValue=source[property.@name];
|
||||
if (source[property.@name]!=null){
|
||||
if (ObjectUtil.isSimple(propertyValue)){
|
||||
writer.addProperty(property.@name, propertyValue.toString());
|
||||
}
|
||||
else {
|
||||
writer.addProperty(property.@name, marshal(propertyValue).toXMLString());
|
||||
}
|
||||
}
|
||||
}
|
||||
return writer.xml;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<s:WindowedApplication xmlns:fx="http://ns.adobe.com/mxml/2009"
|
||||
xmlns:s="library://ns.adobe.com/flex/spark"
|
||||
xmlns:mx="library://ns.adobe.com/flex/mx" creationComplete="runMe()" invoke="onInvoke(event)">
|
||||
<fx:Declarations>
|
||||
<!-- Place non-visual elements (e.g., services, value objects) here -->
|
||||
</fx:Declarations>
|
||||
<fx:Script>
|
||||
<![CDATA[
|
||||
import org.flexunit.listeners.AirCIListener;
|
||||
import org.flexunit.runner.FlexUnitCore;
|
||||
|
||||
import test.TestExecutor;
|
||||
|
||||
private var core: FlexUnitCore;
|
||||
|
||||
public function runMe(): void{
|
||||
core = new FlexUnitCore();
|
||||
core.addListener(new AirCIListener());
|
||||
core.run(test.TestExecutor);
|
||||
}
|
||||
|
||||
public function onInvoke(event: InvokeEvent): void{
|
||||
var arguments: Array = event.arguments;
|
||||
trace(arguments.toString());
|
||||
}
|
||||
]]>
|
||||
</fx:Script>
|
||||
</s:WindowedApplication>
|
||||
@@ -1,432 +0,0 @@
|
||||
package test
|
||||
{
|
||||
import com.adobe.serialization.json.JSON;
|
||||
import com.adobe.utils.DateUtil;
|
||||
import com.wordnik.swagger.common.ApiInvoker;
|
||||
import com.wordnik.swagger.common.ApiUserCredentials;
|
||||
import com.wordnik.swagger.common.SwaggerApi;
|
||||
import com.wordnik.swagger.event.ApiClientEvent;
|
||||
import com.wordnik.swagger.event.Response;
|
||||
|
||||
import flash.desktop.NativeApplication;
|
||||
import flash.events.Event;
|
||||
import flash.events.EventDispatcher;
|
||||
import flash.events.IEventDispatcher;
|
||||
import flash.events.IOErrorEvent;
|
||||
import flash.filesystem.File;
|
||||
import flash.filesystem.FileMode;
|
||||
import flash.filesystem.FileStream;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.system.System;
|
||||
import flash.utils.describeType;
|
||||
import flash.utils.getDefinitionByName;
|
||||
|
||||
import flexunit.framework.TestCase;
|
||||
|
||||
import mx.core.ClassFactory;
|
||||
import mx.rpc.events.FaultEvent;
|
||||
import mx.utils.StringUtil;
|
||||
|
||||
public class TestExecutor extends TestCase
|
||||
{
|
||||
private var urlReq:URLRequest;
|
||||
private var urlLdr:URLLoader;
|
||||
|
||||
private var apiInvoker: ApiInvoker;
|
||||
|
||||
private const MODEL_INFO_URL:String ="testData.json";
|
||||
private const TIME_OUT:int = 5000;
|
||||
|
||||
private var testData: Object;
|
||||
|
||||
|
||||
public function testApiMethod():void{
|
||||
initializeRequest();
|
||||
urlLdr.addEventListener(Event.COMPLETE, addAsync(executeTest, TIME_OUT));
|
||||
urlLdr.addEventListener(IOErrorEvent.IO_ERROR, executeTest);
|
||||
urlLdr.load(urlReq);
|
||||
}
|
||||
|
||||
private function initializeRequest():void {
|
||||
/* Initialize the URLRequest object with the URL to the file of name/value pairs. */
|
||||
urlReq = new URLRequest(MODEL_INFO_URL);
|
||||
/* Initialize the URLLoader object, assign the various event listeners, and load the specified URLRequest object. */
|
||||
urlLdr = new URLLoader();
|
||||
}
|
||||
|
||||
private function checkAndLoadModelXml(event:Event):Object {
|
||||
var ldr:URLLoader = urlLdr;//event.currentTarget as URLLoader;
|
||||
assertTrue("Test data info not found ", ldr.data != null);
|
||||
|
||||
var testData:Object = JSON.decode(ldr.data);
|
||||
//var classList:XML = new XML(ldr.data);
|
||||
assertTrue("Test data could not be loaded as xml ", testData != null);
|
||||
return testData;
|
||||
}
|
||||
|
||||
private function executeTest(event:Event):void {
|
||||
testData = checkAndLoadModelXml(event);
|
||||
//figure out class and method to execute
|
||||
var className: String = getServiceName(testData.resource);
|
||||
var methodName: String = testData.methodName;
|
||||
var servicePackageName: String = testData.apiPackageName;
|
||||
var fullClassName: String = servicePackageName + "." + className;
|
||||
|
||||
var apiUrl: String = testData.apiUrl;
|
||||
var apiHostName : String = apiUrl.substring(apiUrl.indexOf("//")+2,
|
||||
apiUrl.indexOf("/",apiUrl.indexOf("//")+2) );
|
||||
var apiPath: String = apiUrl.substring(apiUrl.indexOf(apiHostName)+ apiHostName.length,
|
||||
apiUrl.indexOf("/", apiUrl.indexOf(apiHostName)+ apiHostName.length + 1));
|
||||
var useProxyServer: Boolean = false;
|
||||
if(testData.useProxyServer != null){
|
||||
useProxyServer = testData.useProxyServer == "true" ? true : false;
|
||||
}
|
||||
var params: Array;
|
||||
//execute the test
|
||||
|
||||
var classRef:Class;
|
||||
try{
|
||||
classRef = getDefinitionByName(fullClassName) as Class;
|
||||
}
|
||||
catch(error: ReferenceError){
|
||||
var classFailure: Response = new Response(false, null, "Api Class not found");
|
||||
writeToFile( JSON.encode(classFailure) );
|
||||
}
|
||||
|
||||
var apiCredentials: ApiUserCredentials = new ApiUserCredentials(testData.apiKey,
|
||||
testData.authToken, apiHostName, -1, apiPath, testData.proxyServerUrl);
|
||||
|
||||
var apiInstance : * = new classRef(apiCredentials);
|
||||
apiInstance.useProxyServer(useProxyServer);
|
||||
apiInstance.addEventListener(methodName, addAsync(onApiCallResponse, TIME_OUT, {} , apiTimeOutHandler) );
|
||||
apiInstance.addEventListener(ApiClientEvent.FAILURE_EVENT, onApiCallFault );
|
||||
|
||||
var queryAndPathParams: Object = new Object();
|
||||
|
||||
queryAndPathParams = testData.queryAndPathParams;
|
||||
|
||||
params = getArgumentsForTestCaseExecution(methodName, apiInstance,
|
||||
queryAndPathParams, testData.postData, className, testData.resource);
|
||||
if(apiInstance.hasOwnProperty(methodName)){
|
||||
var method:Function = apiInstance[methodName];
|
||||
var returnValue:* = method.apply(apiInstance, params);
|
||||
}
|
||||
else{
|
||||
//write out error
|
||||
var failureResponse: Response = new Response(false, null, "Method not found");
|
||||
writeToFile( JSON.encode(failureResponse) );
|
||||
}
|
||||
|
||||
//write out test data result to json file
|
||||
}
|
||||
|
||||
private function onApiCallResponse(event: ApiClientEvent, tokenObject: Object = null): void{
|
||||
var result: Response = event.response;
|
||||
trace("writing to file");
|
||||
|
||||
writeToFile( JSON.encode(result) );
|
||||
}
|
||||
|
||||
private function onApiCallFault(event:FaultEvent):void {
|
||||
var failureResponse: Response = new Response(false, null, "Method invocation failure");
|
||||
writeToFile( JSON.encode(failureResponse) );
|
||||
}
|
||||
|
||||
private function writeToFile(data: String) : void {
|
||||
var localFile: File = File.documentsDirectory.resolvePath("testOutput.json");
|
||||
var localFileStream:FileStream = new FileStream();
|
||||
|
||||
localFileStream.open(localFile, FileMode.WRITE);
|
||||
|
||||
localFileStream.writeMultiByte( data, "utf-8");
|
||||
localFileStream.close();
|
||||
trace(data);
|
||||
applicationExit();
|
||||
}
|
||||
|
||||
private function apiTimeOutHandler(o: Object):void {
|
||||
//fail("test timed out");
|
||||
trace("Execution timed out");
|
||||
var failureResponse: Response = new Response(false, null, "Method Execution timed out");
|
||||
writeToFile( JSON.encode(failureResponse) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate name of the service from resource path.
|
||||
*
|
||||
* Example: if input is /user.json the generated name for this path will be UserAPI
|
||||
* If the input is /user.json/{userId}, the service name will still be generated as UserAPI
|
||||
*
|
||||
* @param resourcePath
|
||||
* @return
|
||||
*/
|
||||
private function getServiceName(resourcePath: String): String {
|
||||
var className:String = null;
|
||||
var index: int = resourcePath.indexOf(".");
|
||||
if(index >= 0) {
|
||||
var resourceName: String = resourcePath.substring(1,index);
|
||||
className = applyClassNamingPolicy(resourceName);
|
||||
}else{
|
||||
var paths: Array = resourcePath.split("/");
|
||||
for each(var path: String in paths) {
|
||||
if(path != null && path.length > 0) {
|
||||
className = applyClassNamingPolicy(path);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return className+ "API";
|
||||
}
|
||||
|
||||
private function getArgumentsForTestCaseExecution(methodName: String, apiObject: Object, queryAndPathParameters: Object,
|
||||
postData: String, className: String, resourcePath: String): Array{
|
||||
|
||||
var result: Array;
|
||||
//get the xml data for the type
|
||||
var classAsXML: XML = describeType(apiObject);
|
||||
//get the parameters for the method
|
||||
|
||||
var argNamesArray: Array = [];
|
||||
var argTypesArray: Array = [];
|
||||
|
||||
var list: XMLList = classAsXML.method;
|
||||
var methodXml: XML;
|
||||
var paramDefn: XML
|
||||
var currentMethodName: String;
|
||||
var methodParams: XMLList;
|
||||
var methodArgumentNames: XMLList;
|
||||
var argumentNames: String;
|
||||
|
||||
for each (methodXml in list) {
|
||||
//get the names and types for the parameters
|
||||
currentMethodName = methodXml.@name.toString();
|
||||
if(methodName == currentMethodName){
|
||||
methodParams = methodXml.parameter;
|
||||
for each(paramDefn in methodParams){
|
||||
argTypesArray.push(paramDefn.@type.toString());
|
||||
}
|
||||
methodArgumentNames = methodXml.metadata.(@name == "MethodArgumentNames");
|
||||
if(methodArgumentNames.length() > 0){
|
||||
argumentNames = methodArgumentNames.arg[0].@value.toString();
|
||||
argNamesArray = argNamesArray.concat(argumentNames.split(","));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(argNamesArray != null && argNamesArray.length > 0){
|
||||
result = [];
|
||||
//get the value of the input type parameter
|
||||
var inputClassName: String = getInputObjectName(className, resourcePath);
|
||||
var argName: String;
|
||||
var argType: String;
|
||||
var argumentValue: Object;
|
||||
for (var i: Number=0 ; i< argNamesArray.length ; i++){
|
||||
argName = StringUtil.trim( argNamesArray[i].toString() );
|
||||
argType = argTypesArray[i].toString();
|
||||
//if the parameter type is of collated input type
|
||||
if(argType == inputClassName){
|
||||
//create an object of type input model and populate it
|
||||
argumentValue = populateInputModelObject(argTypesArray[i], queryAndPathParameters);
|
||||
}
|
||||
//if it is a primitive type then
|
||||
else if( isPrimitiveType(argType) ){
|
||||
//get the value from the queryAndPathParameters
|
||||
argumentValue = queryAndPathParameters[argName] ;
|
||||
}
|
||||
//if it is a POST param
|
||||
else if( argName == "postData"){
|
||||
//convert from JSON to object ? of type ?
|
||||
if(postData.charAt(0) == "\"" && postData.charAt(postData.length - 1) == "\""){
|
||||
postData = postData.slice(1, postData.length);
|
||||
}
|
||||
argumentValue = JSON.decode( postData.toString() );
|
||||
argumentValue = mapToFlexObjects(argumentValue, argType);
|
||||
}
|
||||
else if(true){
|
||||
//???some times input can be list of primitives for supporting multivalued values. however test case sends the input as comma separated values
|
||||
//???so we need to convert comma separated string into JSON list format
|
||||
argumentValue = queryAndPathParameters[argName].toString().split(",");
|
||||
}
|
||||
result.push(argumentValue);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts an instance of type 'Object' to a type of 'argType'
|
||||
*/
|
||||
private function mapToFlexObjects(obj:Object, argType: String):Object {
|
||||
var fullClassName: String = argType.replace("::",".");
|
||||
var classRef:Class;
|
||||
try{
|
||||
classRef = getDefinitionByName(fullClassName) as Class;
|
||||
}
|
||||
catch(error: ReferenceError){
|
||||
var classFailure: Response = new Response(false, null, "Api Class not found");
|
||||
writeToFile( JSON.encode(classFailure) );
|
||||
}
|
||||
var returnObject : * = new classRef();
|
||||
|
||||
var propertyMap:XML = describeType(returnObject);
|
||||
var propertyTypeClass:Class;
|
||||
|
||||
for each (var property:XML in propertyMap.variable) {
|
||||
if ((obj as Object).hasOwnProperty(property.@name)) {
|
||||
propertyTypeClass = getDefinitionByName(property.@type) as Class;
|
||||
if (obj[property.@name] is (propertyTypeClass)) {
|
||||
returnObject[property.@name] = obj[property.@name];
|
||||
}
|
||||
|
||||
if(property.@type == "Date"){
|
||||
var dateValue:Date = DateUtil.parseW3CDTF( obj[property.@name] );
|
||||
returnObject[property.@name] = dateValue;
|
||||
}
|
||||
|
||||
if( !isPrimitiveType( property.@type )){
|
||||
try{
|
||||
var complexTypeObject: Object = mapToFlexObjects( obj[property.@name], property.@type );
|
||||
returnObject[property.@name] = complexTypeObject;
|
||||
}
|
||||
catch(error: Error){
|
||||
var mapToFlexFailure: Response = new Response(false, null, "Post data object could not be created");
|
||||
writeToFile( JSON.encode(mapToFlexFailure) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return returnObject;
|
||||
}
|
||||
|
||||
private function isPrimitiveType(type: String): Boolean {
|
||||
if(type == "String" || type == "int" || type == "integer" || type == "double" ||
|
||||
type == "boolean" || type == "float" || type == "long" || type == "Number" ){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts the first character of the input into upper case .
|
||||
* Example: If the input is word, the return value will be Word
|
||||
* @param input
|
||||
* @return
|
||||
*/
|
||||
private function applyClassNamingPolicy(input: String): String {
|
||||
if(input != null && input.length > 0) {
|
||||
return input.substring(0,1).toUpperCase() + input.substring(1);
|
||||
}else{
|
||||
throw new Error("Error converting input to first letter caps becuase of null or empty input");
|
||||
}
|
||||
}
|
||||
|
||||
private function getInputObjectName(serviceName: String, resourcePath: String): String {
|
||||
//Since service name has API at the end remove that format he name
|
||||
var inputobjectName: String = serviceName.substring(0, serviceName.length - 3);
|
||||
|
||||
var pathElements: Array = resourcePath.split("/");
|
||||
var urlPath: String = "";
|
||||
if(pathElements != null){
|
||||
for each(var pathElement: String in pathElements){
|
||||
if(pathElement != null && pathElement.length > 0) {
|
||||
var position: int = pathElement.indexOf("{");
|
||||
if(position < 0) {
|
||||
inputobjectName = inputobjectName + applyClassNamingPolicy( pathElement ) + "Input";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return inputobjectName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the swagger input model object.
|
||||
*
|
||||
* Input model is created when number of inputs to a method exceed certain limit.
|
||||
* @param inputDefinitions
|
||||
* @return
|
||||
*/
|
||||
private function populateInputModelObject(swaggerInputClassName: String, inputDefinitions: Object): Object {
|
||||
var inputModelObjectClass: Class = getDefinitionByName(swaggerInputClassName) as Class;
|
||||
var inputObject: Object = new inputModelObjectClass();
|
||||
|
||||
for(var attributeName: String in inputDefinitions){
|
||||
if(inputObject.hasOwnProperty(attributeName)){
|
||||
inputObject[attributeName] = inputDefinitions[attributeName];
|
||||
}
|
||||
}
|
||||
|
||||
return inputObject;
|
||||
}
|
||||
|
||||
public function applicationExit():void {
|
||||
var exitingEvent:Event = new Event(Event.EXITING, false, true);
|
||||
NativeApplication.nativeApplication.dispatchEvent(exitingEvent);
|
||||
if (!exitingEvent.isDefaultPrevented()) {
|
||||
NativeApplication.nativeApplication.exit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * Gets the list of input query and path parameters and post data vlues and covenrt them to arguments that
|
||||
// * can be used for calling the method. This logic will be different in each driver language depends on how method
|
||||
// * input arguments are created.
|
||||
// */
|
||||
// private function populateArgumentsForTestCaseExecution(methodToExecute: Function, queryAndPathParameters: Object,
|
||||
// postData: String, serviceName: String, resourcePath: String): Array {
|
||||
// MethodArgumentNames argNames = methodToExecute.getAnnotation(MethodArgumentNames.class);
|
||||
// String[] argNamesArray = null;
|
||||
// if(argNames != null && argNames.value().length() > 0) {
|
||||
// argNamesArray = argNames.value().split(",");
|
||||
// }
|
||||
// Class[] argTypesArray = methodToExecute.getParameterTypes();
|
||||
// Object output = null;
|
||||
// String inputClassName = namingPolicyProvider.getInputObjectName(serviceName, resourcePath);
|
||||
//
|
||||
// if(argNamesArray != null && argNamesArray.length > 0){
|
||||
// Object[] arguments = new Object[argNamesArray.length];
|
||||
//
|
||||
// for(int i=0; i < argNamesArray.length; i++){
|
||||
// Object argument = null;
|
||||
// //if the method takes input model instead of individual arguments, convert individual arguments into input model object
|
||||
// if(argTypesArray[i].getName().equalsIgnoreCase(inputClassName)){
|
||||
// argument = populateInputModelObject(argTypesArray[i], queryAndPathParameters);
|
||||
// }else if(datatypeMppingProvider.isPrimitiveType(argTypesArray[i].getName())){
|
||||
// argument = queryAndPathParameters.get(argNamesArray[i].trim());
|
||||
// }else if (argNamesArray[i].trim().equals(APITestRunner.POST_PARAM_NAME)){
|
||||
// argument = APITestRunner.convertJSONStringToObject(postData, argTypesArray[i]);
|
||||
// }else{
|
||||
// //some times input can be list of primitives for supporting multivalued values. however test case sends the input as comma separated values
|
||||
// //so we need to convert comma separated string into JSON list format
|
||||
// if(List.class.isAssignableFrom(argTypesArray[i]) && !queryAndPathParameters.get(argNamesArray[i].trim()).startsWith("[")){
|
||||
// String listInput= "[";
|
||||
// int x = 0;
|
||||
// String[] values = queryAndPathParameters.get(argNamesArray[i].trim()).split(",");
|
||||
// for(String value : values){
|
||||
// if(x > 0){listInput = listInput + ",";}
|
||||
// listInput = listInput + "\""+ value + "\"";
|
||||
// x++;
|
||||
// }
|
||||
// listInput = listInput + "]";
|
||||
// argument = APITestRunner.convertJSONStringToObject(listInput, argTypesArray[i]);
|
||||
// }else{
|
||||
// argument = APITestRunner.convertJSONStringToObject(queryAndPathParameters.get(argNamesArray[i].trim()), argTypesArray[i]);
|
||||
// }
|
||||
// }
|
||||
// arguments[i] = argument;
|
||||
// }
|
||||
// return arguments;
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package $packageName$;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $enum.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public enum $className$ {
|
||||
|
||||
$values: { value | $value.name$($value.value$)};separator=", "$;
|
||||
|
||||
final $enumValueType$ value;
|
||||
|
||||
$className$($enumValueType$ value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public $enumValueType$ getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return String.valueOf(this.getValue());
|
||||
}
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
package $packageName$ {
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $model.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
[XmlRootNode(name="$model.name$")]
|
||||
public class $className$ extends $extends$ {
|
||||
|
||||
$fields:{ field |
|
||||
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowableValues)$[AllowableValues(value="$field.allowedValuesString$"]$endif$
|
||||
*/
|
||||
$if(!field.fieldDefinition.collectionItemType)$
|
||||
[XmlElement(name="$field.fieldDefinition.name$")]$endif$
|
||||
$if(field.fieldDefinition.collectionItemType)$
|
||||
[XmlElements(name="$field.fieldDefinition.name$", type="$field.fieldDefinition.collectionItemType$")]$endif$
|
||||
public var $field.fieldDefinition.name$: $field.fieldDefinition.returnType$ $field.fieldDefinition.initialization$;$\r$}$
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package $packageName$ {
|
||||
|
||||
import com.wordnik.swagger.api.*;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* This class contains references for any classes that might not be directly referenced by the Api classes.
|
||||
* The AS3 compiler will exclude any class that is not referenced directly somewhere in your code.
|
||||
* This is an optimization that the compiler applies by design.
|
||||
* This convenience class prevents the user from having to iclude an import and variable declaration for such classes.
|
||||
*
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public class LibraryReferences {
|
||||
|
||||
$fields:{ field |
|
||||
private var $field.name$: $field.paramType$;$\r$}$
|
||||
}
|
||||
}
|
||||
@@ -1,132 +0,0 @@
|
||||
package $packageName$ {
|
||||
|
||||
|
||||
import $exceptionPackageName$.ApiErrorCodes;
|
||||
import $exceptionPackageName$.ApiError;
|
||||
import $modelPackageName$.*;
|
||||
import com.wordnik.swagger.common.ApiUserCredentials;
|
||||
import com.wordnik.swagger.event.Response;
|
||||
import com.wordnik.swagger.common.SwaggerApi;
|
||||
|
||||
import mx.rpc.AsyncToken;
|
||||
import mx.utils.UIDUtil;
|
||||
import flash.utils.Dictionary;
|
||||
import flash.events.EventDispatcher;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public class $resource$ extends $extends$ {
|
||||
|
||||
$methods:{ method |
|
||||
public var event_$method.name$: String = "$method.name$";$\r$}$
|
||||
|
||||
/**
|
||||
* Constructor for the $resource$ api client
|
||||
* @param apiCredentials Wrapper object for tokens and hostName required towards authentication
|
||||
* @param eventDispatcher Optional event dispatcher that when provided is used by the SDK to dispatch any Response
|
||||
*/
|
||||
public function $resource$(apiCredentials: ApiUserCredentials, eventDispatcher: EventDispatcher = null) {
|
||||
super(apiCredentials, eventDispatcher);
|
||||
}
|
||||
|
||||
|
||||
$methods:{ method |
|
||||
/**
|
||||
* $method.description$
|
||||
$method.arguments:{ argument |
|
||||
* @param $argument.name$ $argument.description$
|
||||
$if(argument.allowedValues)$
|
||||
* Allowed values are - $argument.allowedValues$
|
||||
$endif$}$
|
||||
*
|
||||
$if(!method.responseVoid)$
|
||||
* @return $method.returnValue$ {@link $method.returnClassName$} $endif$
|
||||
*/
|
||||
$if(method.hasArguments)$
|
||||
[MethodArgumentNames(value="$method.argumentNames; separator=", "$")]$endif$
|
||||
public function $method.name$($method.argumentDefinitions; separator=", "$): String {
|
||||
|
||||
$if(method.authToken)$
|
||||
if(_apiUsageCredentials == null || _apiUsageCredentials.authToken == null || _apiUsageCredentials.authToken.length == 0) {
|
||||
throw new ApiError(ApiErrorCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}$endif$
|
||||
var requestId: String = getUniqueId();
|
||||
//parse inputs
|
||||
var resourcePath: String = "$method.resourcePath$";
|
||||
resourcePath = resourcePath.replace("{format}","xml");
|
||||
var method: String = "$method.methodType$";
|
||||
var queryParams:Dictionary = new Dictionary();
|
||||
var headerParams:Dictionary = new Dictionary();
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
queryParams["$argument.name$"] = toPathValue($argument.name$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", $argument.name$);
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
headerParams["$argument.name$"] = toPathValue($argument.name$);
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
queryParams["$argument.name$"] = $argument.methodNameFromModelClass$;
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", $argument.methodNameFromModelClass$);
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
headerParams["$argument.name$"] = $argument.methodNameFromModelClass$;
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
//make the API Call
|
||||
$if(method.postObject)$
|
||||
$if(method.authToken)$
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(resourcePath, method, queryParams, postData, headerParams);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(resourcePath, method, queryParams, postData, headerParams);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
$if(!method.postObject)$
|
||||
$if(method.authToken)$
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(resourcePath, method, queryParams, null, headerParams);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
var token:AsyncToken = getApiInvoker().invokeAPI(resourcePath, method, queryParams, null, headerParams);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
token.requestId = requestId;
|
||||
token.completionEventType = "$method.name$";
|
||||
|
||||
//create output objects if the response has more than one object
|
||||
$if(!method.responseVoid)$
|
||||
token.returnType = $method.returnClassName$;
|
||||
|
||||
$endif$
|
||||
return requestId;
|
||||
}
|
||||
}$
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package $packageName$ {
|
||||
|
||||
/**
|
||||
* Maintains the compatible server version against which the drive is written
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public class VersionChecker {
|
||||
|
||||
private var compatibleVersion: String = "$apiVersion$";
|
||||
|
||||
/**
|
||||
* Gets the version against which the driver code was written
|
||||
*/
|
||||
public function getCompatibleVersion(): String {
|
||||
return compatibleVersion;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package $packageName$ {
|
||||
|
||||
import com.wordnik.swagger.common.ListWrapper;
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $model.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public class $className$ extends $extends$ implements ListWrapper{
|
||||
|
||||
$fields:{ field |
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowableValues)$[AllowableValues(value="$field.allowedValuesString$"]$endif$
|
||||
*/
|
||||
$if(!field.fieldDefinition.collectionItemType)$
|
||||
[XmlElement(name="$field.fieldDefinition.name$")]$endif$
|
||||
$if(field.fieldDefinition.collectionItemType)$
|
||||
[XmlElements(name="$field.fieldDefinition.collectionItemName$", type="$field.fieldDefinition.collectionItemType$")]$endif$
|
||||
public var $field.fieldDefinition.name$: $field.fieldDefinition.returnType$ $field.fieldDefinition.initialization$;}$
|
||||
|
||||
$fields:{ field |
|
||||
/**
|
||||
* Returns the list being wrapped by this wrapper class. There will be a single list item attribute in this class.
|
||||
*/
|
||||
$if(field.fieldDefinition.collectionItemType)$
|
||||
public function getList(): $field.fieldDefinition.returnType${
|
||||
return $field.fieldDefinition.name$;
|
||||
}$endif$}$
|
||||
}
|
||||
}
|
||||
@@ -1,111 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="swagger-sample-java-lib" xmlns:ivy="antlib:org.apache.ivy.ant" default="build.all" basedir=".">
|
||||
<property environment="env" />
|
||||
<property name="version.identifier" value="1.0" />
|
||||
<property name="artifact.ext" value="jar" />
|
||||
<property name="organization" value="wordnik" />
|
||||
<property name="module" value="${ant.project.name}" />
|
||||
|
||||
<!-- default dirs for the build -->
|
||||
<mkdir dir="lib"/>
|
||||
<mkdir dir="lib/ext"/>
|
||||
|
||||
<condition property="scala.home" value="${env.SCALA_HOME}">
|
||||
<isset property="env.SCALA_HOME" />
|
||||
</condition>
|
||||
|
||||
<path id="scala.classpath">
|
||||
<fileset dir="${scala.home}/lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<ivy:settings file="ivysettings.xml" />
|
||||
|
||||
<taskdef resource="scala/tools/ant/antlib.xml">
|
||||
<classpath>
|
||||
<fileset dir="lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${scala.home}/lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<!-- this is the output module -->
|
||||
<property name="module" value="${ant.project.name}" />
|
||||
|
||||
<target name="build.all" depends="clean, resolve, fastcompile" description="builds the module (default target)" />
|
||||
|
||||
<target name="clean" description="cleans the project folder">
|
||||
<mkdir dir="build" />
|
||||
<echo message="deleting build files" />
|
||||
<delete quiet="true">
|
||||
<fileset dir="build">
|
||||
<include name="*.jar" />
|
||||
<include name="*.xml" />
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<delete dir="build/main" quiet="true" />
|
||||
|
||||
<delete dir="dist" quiet="true" />
|
||||
|
||||
<!-- libraries handled by ivy -->
|
||||
<echo message="deleting libs handled by ivy" />
|
||||
<delete>
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
<include name="*.zip" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!-- copies ONLY the swagger-sample jar to dist-->
|
||||
<target name="fastdist" depends="fastcompile">
|
||||
<copy todir="dist/lib">
|
||||
<fileset dir="build">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- copies all dependencies into the lib folder -->
|
||||
<target name="resolve" description="retreive dependencies with ivy">
|
||||
<ivy:retrieve pattern="${basedir}/lib/[artifact]-[revision].[ext]" conf="build" />
|
||||
</target>
|
||||
|
||||
<target name="fastcompile" description="builds the module without artifact resolution or cleaning">
|
||||
<delete quiet="true" file="build/${organization}-${artifact}-*.${artifact.ext}" />
|
||||
<mkdir dir="build" />
|
||||
<mkdir dir="build/main" />
|
||||
<mkdir dir="build/main/java" />
|
||||
|
||||
<javac srcdir="src/main/java" debug="true" destdir="build/main/java">
|
||||
<classpath>
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="lib/ext">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<pathelement location="build/main/java" />
|
||||
</classpath>
|
||||
</javac>
|
||||
<jar jarfile="build/${module}-${version.identifier}.${artifact.ext}">
|
||||
<fileset dir="build/main/java" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<!-- cleans up the dist -->
|
||||
<target name="dist.clean" description="cleans the distribution folder">
|
||||
<delete quiet="true" dir="dist" />
|
||||
<delete quiet="true" file="dist.zip" />
|
||||
</target>
|
||||
|
||||
<target name="dependency.tree" description="builds a graphml dependency diagram for viewing with yEd">
|
||||
<ivy:report conf="build" graph="true" todir="." outputpattern="[artifact]-[revision].[ext]" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -1,31 +0,0 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="wordnik" module="sample-java-lib"/>
|
||||
<configurations>
|
||||
<conf name="build" description="build wordnik-java"/>
|
||||
<conf name="test" visibility="public"/>
|
||||
<conf name="source" visibility="public"/>
|
||||
<conf name="pom" visibility="public"/>
|
||||
</configurations>
|
||||
|
||||
<dependencies>
|
||||
<!-- jersey dependencies -->
|
||||
<dependency org="junit" name="junit" rev="4.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-json" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-client" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-server" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-core" rev="1.4" conf="build->default"/>
|
||||
<dependency org="asm" name="asm-parent" rev="3.1" conf="build->default"/>
|
||||
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.8.0" conf="build->default"/>
|
||||
<dependency org="org.antlr" name="stringtemplate" rev="3.2" conf="build->default"/>
|
||||
<!-- jackson jars -->
|
||||
<dependency org="org.codehaus.jackson" name="jackson-jaxrs" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-xc" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.1" conf="build->default"/>
|
||||
|
||||
|
||||
<dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9.2" conf="test->default">
|
||||
<exclude org="asm" name="asm-tree"/>
|
||||
<exclude org="asm" name="asm"/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ivysettings>
|
||||
<settings defaultResolver="chained" />
|
||||
<property name="ivy.checksums" value=""/>
|
||||
<property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local"
|
||||
override="false" />
|
||||
<property name="ivy.local.default.ivy.pattern"
|
||||
value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
|
||||
override="false" />
|
||||
<property name="ivy.local.default.artifact.pattern"
|
||||
value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
|
||||
override="false" />
|
||||
<resolvers>
|
||||
<chain name="chained" returnFirst="true">
|
||||
<filesystem name="local">
|
||||
<ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
|
||||
<artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
|
||||
</filesystem>
|
||||
<ibiblio name="ibiblio" m2compatible="true" />
|
||||
<ibiblio name="javanet" root="http://download.java.net/maven/2/" m2compatible="true" />
|
||||
</chain>
|
||||
</resolvers>
|
||||
</ivysettings>
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"apiUrl":"http://localhost:8002/api/",
|
||||
|
||||
"apiKey":"special-key",
|
||||
|
||||
"defaultServiceBaseClass":"Object",
|
||||
|
||||
"defaultModelBaseClass":"Object",
|
||||
|
||||
"serviceBaseClasses":{},
|
||||
|
||||
"defaultModelImports":[],
|
||||
|
||||
"defaultServiceImports":[],
|
||||
|
||||
"modelPackageName":"com.wordnik.swagger.sample.sdk.java.model",
|
||||
|
||||
"apiPackageName":"com.wordnik.swagger.sample.sdk.java.api",
|
||||
|
||||
"ignoreMethods":[],
|
||||
|
||||
"ignoreModels":[],
|
||||
|
||||
"outputDirectory":"../swagger-sample-app/sdk-libs/src/main/java/com/wordnik/swagger/sample/sdk/java",
|
||||
|
||||
"libraryHome":"../swagger-sample-app/sdk-libs"
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
{
|
||||
"userList":[
|
||||
{
|
||||
"username":"testuser1",
|
||||
"password":"password1",
|
||||
"email":"test1@dummy.com"
|
||||
},
|
||||
{
|
||||
"username":"testuser2",
|
||||
"password":"password2",
|
||||
"email":"test2@dummy.com"
|
||||
},
|
||||
{
|
||||
"username":"user?10",
|
||||
"password":"password2",
|
||||
"email":"test2@dummy.com"
|
||||
}
|
||||
],
|
||||
"petList":[
|
||||
{
|
||||
"id":101,
|
||||
"name":"pet1",
|
||||
"photoUrls":["url1","url2"],
|
||||
"tags":[
|
||||
{
|
||||
"id":1,
|
||||
"name":"tag1"
|
||||
},
|
||||
{
|
||||
"id":2,
|
||||
"name":"tag2"
|
||||
}
|
||||
],
|
||||
"status":"available",
|
||||
"category":{"id":1,"name":"cat1"}
|
||||
}
|
||||
],
|
||||
"orderList":[
|
||||
{
|
||||
"id":101,
|
||||
"petId":1,
|
||||
"quantity":1,
|
||||
"status":"placed",
|
||||
"shipDate":13456789
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,325 +0,0 @@
|
||||
{
|
||||
"resources" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Find Per by Id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/{petId}",
|
||||
"suggestedMethodName" : "getPetById"
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Find pets by status",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByStatus",
|
||||
"suggestedMethodName" : "findPetsByStatus"
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Find pets by tags",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByTags",
|
||||
"suggestedMethodName" : "findPetsByTags"
|
||||
},
|
||||
{
|
||||
"id" : 4,
|
||||
"name" : "Add a pet",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "addPet"
|
||||
},
|
||||
{
|
||||
"id" : 5,
|
||||
"name" : "Update a pet",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "updatePet"
|
||||
},
|
||||
{
|
||||
"id" : 6,
|
||||
"name" : "Create user",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/user.{format}",
|
||||
"suggestedMethodName" : "createUser"
|
||||
},
|
||||
{
|
||||
"id" : 7,
|
||||
"name" : "Update user",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "updateUser"
|
||||
},
|
||||
{
|
||||
"id" : 8,
|
||||
"name" : "Delete user",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "deleteUser"
|
||||
},
|
||||
{
|
||||
"id" : 9,
|
||||
"name" : "Get user by user name",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "getUserByName"
|
||||
},
|
||||
{
|
||||
"id" : 10,
|
||||
"name" : "Login",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/login",
|
||||
"suggestedMethodName" : "loginUser"
|
||||
},
|
||||
{
|
||||
"id" : 11,
|
||||
"name" : "Logout",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/logout",
|
||||
"suggestedMethodName" : "logoutUser"
|
||||
},
|
||||
{
|
||||
"id" : 12,
|
||||
"name" : "Find order by id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "getOrderById"
|
||||
},
|
||||
{
|
||||
"id" : 13,
|
||||
"name" : "Delete order by id",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "deleteOrder"
|
||||
},
|
||||
{
|
||||
"id" : 14,
|
||||
"name" : "Create order",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/store.{format}/order",
|
||||
"suggestedMethodName" : "placeOrder"
|
||||
},
|
||||
{
|
||||
"id" : 15,
|
||||
"name" : "Get users with array input",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/user.{format}/usersWithArray",
|
||||
"suggestedMethodName" : "getUserByNamesArray"
|
||||
},
|
||||
{
|
||||
"id" : 16,
|
||||
"name" : "get users with list",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/user.{format}/usersWithList",
|
||||
"suggestedMethodName" : "getUserByNamesList"
|
||||
}
|
||||
],
|
||||
"testSuites" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Test User service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Create User",
|
||||
"id" : 1,
|
||||
"resourceId" : 6,
|
||||
"input" : {
|
||||
"postData":"${input.userList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Login User",
|
||||
"id" : 2,
|
||||
"resourceId" : 10,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}",
|
||||
"password":"${input.userList[0].password}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find user by name",
|
||||
"id" : 3,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.3).username}",
|
||||
"condition" : "==",
|
||||
"expectedOutput" : "${input.userList[0].username}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Delete user by name",
|
||||
"id" : 4,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.4)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find user by name with special characters",
|
||||
"id" : 5,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[2].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.5).username}",
|
||||
"condition" : "==",
|
||||
"expectedOutput" : "${input.userList[2].username}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find users with array of user names",
|
||||
"id" : 6,
|
||||
"resourceId" : 15,
|
||||
"input" : {
|
||||
"postData":"[\"testuser1\", \"testuser2\"]"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.6).size}",
|
||||
"condition" : "==",
|
||||
"expectedOutput" : "2"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find users with list of user names",
|
||||
"id" : 7,
|
||||
"resourceId" : 16,
|
||||
"input" : {
|
||||
"postData":"[\"testuser1\", \"testuser2\"]"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.7).size}",
|
||||
"condition" : "==",
|
||||
"expectedOutput" : "2"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Test Pet service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Add pet",
|
||||
"id" : 1,
|
||||
"resourceId" : 4,
|
||||
"input" : {
|
||||
"postData":"${input.petList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by id",
|
||||
"id" : 2,
|
||||
"resourceId" : 1,
|
||||
"input" : {
|
||||
"petId":"1"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by status",
|
||||
"id" : 3,
|
||||
"resourceId" : 2,
|
||||
"input" : {
|
||||
"status":"available,sold,pending"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.3).size}",
|
||||
"condition" : ">",
|
||||
"expectedOutput" : "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Test Store service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Find order by id",
|
||||
"id" : 1,
|
||||
"resourceId" : 12,
|
||||
"input" : {
|
||||
"orderId":"3"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(3.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Place order",
|
||||
"id" : 2,
|
||||
"resourceId" : 14,
|
||||
"input" : {
|
||||
"postData":"${input.orderList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,46 +0,0 @@
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package $packageName$;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $enum.description$
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public enum $className$ {
|
||||
|
||||
$values: { value | $value.name$($value.value$)};separator=", "$;
|
||||
|
||||
private $enumValueType$ value;
|
||||
|
||||
$className$($enumValueType$ value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public $enumValueType$ getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return String.valueOf(this.getValue());
|
||||
}
|
||||
}
|
||||
@@ -1,58 +0,0 @@
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package $packageName$;
|
||||
|
||||
import com.wordnik.swagger.runtime.annotations.*;
|
||||
import java.util.List;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $model.description$
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class $className$ extends $extends$ {
|
||||
|
||||
$fields:{ field |
|
||||
|
||||
/**
|
||||
* $field.description$
|
||||
*/
|
||||
private $field.fieldDefinition.returnType$ $field.fieldDefinition.name$ $field.fieldDefinition.initialization$;$\r$}$
|
||||
|
||||
$fields:{ field |
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowableValues)$@AllowableValues(value="$field.allowedValuesString$")$endif$
|
||||
*/
|
||||
public $field.fieldDefinition.returnType$ get$field.fieldDefinition.NameForMethod$() {
|
||||
return $field.fieldDefinition.name$;
|
||||
}
|
||||
|
||||
public void set$field.fieldDefinition.NameForMethod$($field.fieldDefinition.returnType$ $field.fieldDefinition.name$) {
|
||||
this.$field.fieldDefinition.name$ = $field.fieldDefinition.name$;
|
||||
}
|
||||
|
||||
}$
|
||||
}
|
||||
@@ -1,152 +0,0 @@
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package $packageName$;
|
||||
|
||||
|
||||
import $modelPackageName$.*;
|
||||
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature;
|
||||
import org.codehaus.jackson.map.ObjectMapper;
|
||||
import org.codehaus.jackson.type.TypeReference;
|
||||
import com.wordnik.swagger.runtime.annotations.*;
|
||||
import com.wordnik.swagger.runtime.common.*;
|
||||
import com.wordnik.swagger.runtime.exception.*;
|
||||
|
||||
import java.util.*;
|
||||
import java.lang.Long;
|
||||
import java.io.IOException;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class $resource$ extends $extends$ {
|
||||
|
||||
private static APIInvoker apiInvoker = null;
|
||||
|
||||
$methods:{ method |
|
||||
/**
|
||||
* $method.title$
|
||||
*
|
||||
$if(method.description)$
|
||||
* $method.description$
|
||||
* $endif$
|
||||
* $method.arguments:{ argument |@param $argument.name$ $argument.description$
|
||||
* $if(argument.allowedValues)$
|
||||
* Allowed values are - $argument.allowedValues$ $endif$ }$
|
||||
$if(!method.responseVoid)$
|
||||
* @return $method.returnValue$ {@link $method.returnClassName$} $endif$
|
||||
* @throws APIException $method.exceptionDescription$
|
||||
*/
|
||||
$if(method.hasArguments)$
|
||||
@MethodArgumentNames(value="$method.argumentNames; separator=", "$")
|
||||
$endif$
|
||||
|
||||
public static $method.returnValue$ $method.name$($method.argumentDefinitions; separator=", "$) throws APIException {
|
||||
|
||||
//parse inputs
|
||||
String resourcePath = "$method.resourcePath$";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
String method = "$method.methodType$";
|
||||
Map<String, String> queryParams = new HashMap<String, String>();
|
||||
Map<String, String> headerParams = new HashMap<String, String>();
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
queryParams.put("$argument.name$", APIInvoker.toPathValue($argument.name$));
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", APIInvoker.toPathValue($argument.name$));
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
headerParams.put("$argument.name$", APIInvoker.toPathValue($argument.name$));
|
||||
}
|
||||
}$
|
||||
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
queryParams.put("$argument.name$", APIInvoker.toPathValue($argument.methodNameFromModelClass$));
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", APIInvoker.toPathValue($argument.methodNameFromModelClass$));
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
headerParams.put("$argument.name$", APIInvoker.toPathValue($argument.methodNameFromModelClass$));
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
//make the API Call
|
||||
$if(method.postObject)$
|
||||
String response = getApiInvoker().invokeAPI(resourcePath, method, queryParams, postData, headerParams);
|
||||
$endif$
|
||||
|
||||
$if(!method.postObject)$
|
||||
String response = getApiInvoker().invokeAPI(resourcePath, method, queryParams, null, headerParams);
|
||||
$endif$
|
||||
|
||||
$if(!method.responseVoid)$
|
||||
if(response == null || response.length() == 0){
|
||||
return null;
|
||||
}
|
||||
$if(!method.returnValueList)$
|
||||
//create output objects if the response has more than one object
|
||||
$method.returnValue$ responseObject = ($method.returnValue$) getApiInvoker().deserialize(response, $method.returnClassName$.class);
|
||||
return responseObject;
|
||||
$endif$
|
||||
$if(method.returnValueList)$
|
||||
TypeReference<ArrayList<$method.returnClassName$>> typeRef = new TypeReference<ArrayList<$method.returnClassName$>>() {};
|
||||
try {
|
||||
List<$method.returnClassName$> responseObject = (List<$method.returnClassName$>) getApiInvoker().mapper.readValue(response, typeRef);
|
||||
return responseObject;
|
||||
} catch (IOException ioe) {
|
||||
String[] args = new String[]{response, typeRef.toString()};
|
||||
throw new APIException(APIExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe);
|
||||
}
|
||||
$endif$
|
||||
$endif$
|
||||
}
|
||||
|
||||
}$
|
||||
|
||||
public static APIInvoker getApiInvoker() {
|
||||
if(apiInvoker == null){
|
||||
apiInvoker = APIInvoker.getApiInvoker();
|
||||
}
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
public static void setApiInvoker(APIInvoker invoker) {
|
||||
apiInvoker = invoker;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package $packageName$;
|
||||
|
||||
/**
|
||||
*
|
||||
* Maintains the compatible server version against which the drive is written
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
* @author ramesh
|
||||
*
|
||||
*/
|
||||
public class VersionChecker {
|
||||
|
||||
private String compatibleVersion = "$apiVersion$";
|
||||
|
||||
/**
|
||||
* Gets the version against which the library code was written
|
||||
*/
|
||||
public String getCompatibleVersion() {
|
||||
return compatibleVersion;
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"apiUrl":"http://localhost:8002/api/",
|
||||
|
||||
"apiKey":"special-key",
|
||||
|
||||
"defaultServiceBaseClass":"SwaggerApi",
|
||||
|
||||
"defaultModelBaseClass":"Object",
|
||||
|
||||
"serviceBaseClasses":{},
|
||||
|
||||
"defaultModelImports":[],
|
||||
|
||||
"defaultServiceImports":[],
|
||||
|
||||
"modelPackageName":"",
|
||||
|
||||
"apiPackageName":"",
|
||||
|
||||
"ignoreMethods":[],
|
||||
|
||||
"ignoreModels":[],
|
||||
|
||||
"outputDirectory":"../swagger-sample-app/sdk-libs/src/main/js/",
|
||||
|
||||
"libraryHome":"../swagger-sample-app/sdk-libs"
|
||||
}
|
||||
4
conf/js/structure/lib/jquery-1.6.4.min.js
vendored
4
conf/js/structure/lib/jquery-1.6.4.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -1,73 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>Swagger Javascript Lib Sandbox</title>
|
||||
<script src="lib/jquery-1.6.4.min.js" type="text/javascript" charset="utf-8"></script>
|
||||
<script src="api-lib.js" type="text/javascript" charset="utf-8"></script>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
function log(s) {
|
||||
if(window.console) console.log(s);
|
||||
}
|
||||
|
||||
function logResponse(event) {
|
||||
log("-----------------------------");
|
||||
log(event.type);
|
||||
log(event);
|
||||
}
|
||||
|
||||
function onUserCreated(event) {
|
||||
logResponse(event);
|
||||
|
||||
// update the created user
|
||||
var user = new User();
|
||||
user.lastName = "Sanders Lama";
|
||||
user.username = "vito";
|
||||
user.phone = "405-607-8980";
|
||||
user.email = "vito@sanders.com";
|
||||
user.userStatus = 1;
|
||||
user.firstName = "Vito";
|
||||
user.password = "XXXXX";
|
||||
UserAPI.updateUser("vito", user);
|
||||
}
|
||||
|
||||
function onUserUpdated(event) {
|
||||
logResponse(event);
|
||||
|
||||
// delete the created user
|
||||
UserAPI.deleteUser("vito");
|
||||
}
|
||||
|
||||
ApiInvoker.init("http://localhost:8002/api/", null, null, false);
|
||||
|
||||
ApiInvoker.addListener(PetAPI.event_getPetById, logResponse);
|
||||
ApiInvoker.addListener(StoreAPI.event_getOrderById, logResponse);
|
||||
ApiInvoker.addListener(UserAPI.event_getUserByName, logResponse);
|
||||
ApiInvoker.addListener(UserAPI.event_loginUser, logResponse);
|
||||
ApiInvoker.addListener(UserAPI.event_createUser, onUserCreated);
|
||||
ApiInvoker.addListener(UserAPI.event_updateUser, onUserUpdated);
|
||||
ApiInvoker.addListener(UserAPI.event_deleteUser, logResponse);
|
||||
|
||||
// Get some data
|
||||
StoreAPI.getOrderById("1");
|
||||
PetAPI.getPetById("1");
|
||||
UserAPI.getUserByName("user1");
|
||||
|
||||
// login
|
||||
UserAPI.loginUser("user1", "XXXXXXXXXXX")
|
||||
|
||||
// create new user
|
||||
var user = new User();
|
||||
user.lastName = "Sanders";
|
||||
user.username = "vito";
|
||||
user.phone = "405-607-8980";
|
||||
user.email = "vito@sanders.com";
|
||||
user.userStatus = 1;
|
||||
user.firstName = "Vito";
|
||||
user.password = "XXXXX";
|
||||
UserAPI.createUser(user);
|
||||
|
||||
</script>
|
||||
<body>
|
||||
</body>
|
||||
@@ -1,233 +0,0 @@
|
||||
var ApiInvoker = new function() {
|
||||
this.apiServer = null,
|
||||
this.authToken = null,
|
||||
this.apiKey = null,
|
||||
this.loggingEnabled = false,
|
||||
this.requestHeader = new Object(),
|
||||
|
||||
this.trace = function(obj) {
|
||||
if (this.loggingEnabled && window.console) console.log(obj);
|
||||
},
|
||||
|
||||
this.error = function(obj) {
|
||||
if (window.console) console.log(obj);
|
||||
},
|
||||
|
||||
this.init = function(apiServer, apiKey, authToken, loggingEnabled) {
|
||||
if (apiServer != null && apiServer.length > 0) {
|
||||
if (apiServer.substring(apiServer.length - 1) == ("/")) {
|
||||
apiServer = apiServer.substring(0, apiServer.length - 1);
|
||||
}
|
||||
this.apiServer = apiServer;
|
||||
this.apiKey = apiKey;
|
||||
this.authToken = authToken;
|
||||
this.loggingEnabled = (loggingEnabled === null) ? false : loggingEnabled;
|
||||
|
||||
if(this.apiKey)
|
||||
this.requestHeader.api_key = this.apiKey;
|
||||
|
||||
if(this.authToken)
|
||||
this.requestHeader.auth_token = this.authToken;
|
||||
|
||||
this.trace(this.requestHeader);
|
||||
}
|
||||
},
|
||||
|
||||
this.invokeAPI = function(authToken, resourceURL, method, queryParams, postObject, completionEvent, requestId, returnType, callback) {
|
||||
if (this.apiServer == null) {
|
||||
throw new Error("Please call ApiInvoker.init() to initialize the library");
|
||||
}
|
||||
|
||||
this.trace("authToken = " + authToken);
|
||||
this.trace("resourceURL = " + resourceURL);
|
||||
this.trace("method = " + method);
|
||||
// this.trace("returnType = " + returnType);
|
||||
this.trace("completionEvent = " + completionEvent);
|
||||
this.trace("requestId = " + requestId);
|
||||
this.trace("queryParams:");
|
||||
this.trace(queryParams);
|
||||
this.trace("postObject:");
|
||||
this.trace(postObject);
|
||||
|
||||
// create queryParam
|
||||
var counter = 0;
|
||||
var symbol = 0;
|
||||
for (var headerKey in this.requestHeader) {
|
||||
queryParams[headerKey] = this.requestHeader[headerKey]
|
||||
}
|
||||
|
||||
for (var paramName in queryParams) {
|
||||
var paramValue = queryParams[paramName];
|
||||
symbol = "&";
|
||||
if (counter == 0) {
|
||||
symbol = "?";
|
||||
}
|
||||
resourceURL = resourceURL + symbol + paramName + "=" + paramValue.toString();
|
||||
counter++;
|
||||
}
|
||||
|
||||
var callURL = this.apiServer + resourceURL;
|
||||
var responseDataType = (returnType === null || returnType == String) ? "html" : "json";
|
||||
|
||||
this.trace("callURL = " + callURL);
|
||||
this.trace("responseDataType = " + responseDataType);
|
||||
var ajaxRequest = null;
|
||||
if (method == "GET") {
|
||||
// $.get(callURL, postObject,
|
||||
// function(response) {
|
||||
// ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
// }, responseDataType).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "GET",
|
||||
dataType: "jsonp",
|
||||
contentType: "application/json",
|
||||
success: function(response) {
|
||||
ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
}
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
} else if (method == "POST") {
|
||||
this.trace("sending post");
|
||||
this.trace(JSON.stringify(postObject));
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "POST",
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
headers: this.requestHeader,
|
||||
success: function(response) {
|
||||
ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
}
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
} else if (method == "PUT") {
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "PUT",
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
success: function(response) {
|
||||
ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
}
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
} else if (method == "DELETE") {
|
||||
ajaxRequest = $.ajax({
|
||||
url: callURL,
|
||||
data: JSON.stringify(postObject),
|
||||
type: "DELETE",
|
||||
dataType: "json",
|
||||
contentType: "application/json",
|
||||
success: function(response) {
|
||||
ApiInvoker.fire(completionEvent, returnType, requestId, response, callback);
|
||||
}
|
||||
}).complete(this.showCompleteStatus).error(this.showErrorStatus);
|
||||
}
|
||||
|
||||
return ajaxRequest;
|
||||
},
|
||||
|
||||
this.guid = function() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
|
||||
function(c) {
|
||||
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
}).toUpperCase();
|
||||
},
|
||||
|
||||
this._listeners = {},
|
||||
|
||||
this.addListener = function(type, listener) {
|
||||
if (!this._listeners[type]) {
|
||||
this._listeners[type] = [];
|
||||
}
|
||||
|
||||
this._listeners[type].push(listener);
|
||||
},
|
||||
|
||||
this.fire = function(completionEvent, returnType, requestId, response, callback) {
|
||||
var event = new Object();
|
||||
event.type = completionEvent;
|
||||
event.requestId = requestId;
|
||||
if (returnType === null || returnType == String) {
|
||||
event.data = response;
|
||||
} else {
|
||||
event.data = eval("new " + returnType);
|
||||
event.data.parse(response);
|
||||
}
|
||||
|
||||
if (typeof event == "string") {
|
||||
event = { type: event };
|
||||
}
|
||||
|
||||
if (!event.target) {
|
||||
event.target = this;
|
||||
}
|
||||
|
||||
if (!event.type) {
|
||||
throw new Error("Event object must have 'type' property");
|
||||
}
|
||||
|
||||
this.trace(event.data);
|
||||
if(callback) {
|
||||
this.trace("invoking callback");
|
||||
callback(event);
|
||||
} else {
|
||||
this.trace("firing event " + event.type);
|
||||
|
||||
if (this._listeners[event.type]) {
|
||||
var listeners = this._listeners[event.type];
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
listeners[i].call(this, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
this.removeListener = function(type, listener) {
|
||||
if (this._listeners[type]) {
|
||||
var listeners = this._listeners[type];
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
if (listeners[i] === listener) {
|
||||
listeners.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
this.showErrorStatus = function(data) {
|
||||
ApiInvoker.trace(data);
|
||||
if (data.status != 200) {
|
||||
ApiInvoker.error("ERROR - " + data.status + ": " + data.statusText + " / " + data.responseText);
|
||||
} else {
|
||||
ApiInvoker.showStatus(data);
|
||||
}
|
||||
},
|
||||
|
||||
this.showCompleteStatus = function(data) {
|
||||
ApiInvoker.trace("complete " + data.status);
|
||||
// ApiInvoker.showStatus(data);
|
||||
},
|
||||
|
||||
this.showStatus = function(data) {
|
||||
ApiInvoker.trace(data);
|
||||
ApiInvoker.trace(data.getAllResponseHeaders());
|
||||
},
|
||||
|
||||
this.toPathValue = function(value) {
|
||||
if(typeof value == Array){
|
||||
return this.arrayToPathValue(value);
|
||||
} else
|
||||
return value == null ? "" : value.toString();
|
||||
},
|
||||
|
||||
this.arrayToPathValue = function(objects) {
|
||||
return objects.join(",");
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
@@ -1,30 +0,0 @@
|
||||
package $packageName$;
|
||||
|
||||
$imports:{ import |
|
||||
import $import$;
|
||||
}$
|
||||
|
||||
/**
|
||||
* $enum.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public enum $className$ {
|
||||
|
||||
$values: { value | $value.name$($value.value$)};separator=", "$;
|
||||
|
||||
final $enumValueType$ value;
|
||||
|
||||
$className$($enumValueType$ value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public $enumValueType$ getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
@Override public String toString() {
|
||||
return String.valueOf(this.getValue());
|
||||
}
|
||||
};
|
||||
@@ -1,66 +0,0 @@
|
||||
/**
|
||||
* $model.description$
|
||||
*/
|
||||
function $className$() {
|
||||
|
||||
$fields:{ field |
|
||||
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowableValues)$[AllowableValues(value="$field.allowedValuesString$"]$endif$
|
||||
*/
|
||||
this.$field.fieldDefinition.name$ = null;$\r$}$
|
||||
|
||||
|
||||
this.parse = function(data) {
|
||||
if(data) {
|
||||
|
||||
$fields:{ field |
|
||||
$! //$field.fieldDefinition.returnType$ (primitive=$field.fieldDefinition.hasPrimitiveType$) !$
|
||||
$if(field.fieldDefinition.hasListResponse)$
|
||||
$if(field.fieldDefinition.hasPrimitiveType)$
|
||||
this.$field.fieldDefinition.name$ = data.$field.fieldDefinition.name$;
|
||||
$else$
|
||||
this.$field.fieldDefinition.name$ = $field.fieldDefinition.collectionItemType$Object.parseArray(data.$field.fieldDefinition.name$);
|
||||
$endif$
|
||||
$elseif(field.fieldDefinition.hasSetResponse)$
|
||||
$if(field.fieldDefinition.hasPrimitiveType)$
|
||||
this.$field.fieldDefinition.name$ = data.$field.fieldDefinition.name$;
|
||||
$else$
|
||||
this.$field.fieldDefinition.name$ = $field.fieldDefinition.collectionItemType$Collection.get(data.$field.fieldDefinition.name$);
|
||||
$endif$
|
||||
$elseif(field.fieldDefinition.hasMapResponse)$
|
||||
this.$field.fieldDefinition.name$ = data.$field.fieldDefinition.name$;
|
||||
$elseif(field.fieldDefinition.hasDateResponse)$
|
||||
this.$field.fieldDefinition.name$ = new Date(Date.parse(data.$field.fieldDefinition.name$));
|
||||
$else$
|
||||
$if(field.fieldDefinition.hasPrimitiveType)$
|
||||
this.$field.fieldDefinition.name$ = data.$field.fieldDefinition.name$;
|
||||
$else$
|
||||
this.$field.fieldDefinition.name$ = new $field.fieldDefinition.returnType$(); this.$field.fieldDefinition.name$.parse(data.$field.fieldDefinition.name$);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
}$
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
var $className$Object = new function() {
|
||||
this.parseArray = function(arrayData) {
|
||||
var responseArray = new Array();
|
||||
|
||||
if(arrayData != null && arrayData.length > 0) {
|
||||
for(var i = 0; i < arrayData.length; i++) {
|
||||
var o = new $className$();
|
||||
o.parse(arrayData[i]);
|
||||
responseArray.push(o);
|
||||
}
|
||||
}
|
||||
|
||||
return responseArray;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,101 +0,0 @@
|
||||
/**
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
*/
|
||||
var $resource$ = new function() {
|
||||
|
||||
$methods:{ method |
|
||||
this.event_$method.name$ = "$resource$.$method.name$";$\r$}$
|
||||
|
||||
// /**
|
||||
// * Constructor for the $resource$ api client
|
||||
// * @param apiCredentials Wrapper object for tokens and hostName required towards authentication
|
||||
// * @param eventDispatcher Optional event dispatcher that when provided is used by the SDK to dispatch any Response
|
||||
// */
|
||||
// public function $resource$(apiCredentials: ApiUserCredentials, eventDispatcher: EventDispatcher = null) {
|
||||
// super(apiCredentials, eventDispatcher);
|
||||
// }
|
||||
|
||||
|
||||
$methods:{ method |
|
||||
/**
|
||||
* $method.description$
|
||||
$method.arguments:{ argument |
|
||||
* @param $argument.name$ $argument.description$
|
||||
$if(argument.allowedValues)$
|
||||
* Allowed values are - $argument.allowedValues$
|
||||
$endif$}$
|
||||
*
|
||||
$if(!method.responseVoid)$
|
||||
* @return $method.returnValue$ {@link $method.returnClassName$} $endif$
|
||||
* $if(method.hasArguments)$ $length(method.argumentNames)$ $endif$
|
||||
*/
|
||||
|
||||
$if(method.hasArguments)$
|
||||
this.$method.name$ = function($method.argumentNames; separator=", "$, callback)
|
||||
$else$
|
||||
this.$method.name$ = function(callback)
|
||||
$endif$ {
|
||||
|
||||
$if(method.authToken)$
|
||||
if(authToken == null || authToken.length == 0) {
|
||||
throw new Error(ApiErrorCodes.AUTH_TOKEN_NOT_VALID);
|
||||
}$endif$
|
||||
var requestId = ApiInvoker.guid();
|
||||
//parse inputs
|
||||
var resourcePath = "$method.resourcePath$";
|
||||
resourcePath = resourcePath.replace("{format}","json");
|
||||
var method = "$method.methodType$";
|
||||
var queryParams = new Object();
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
queryParams["$argument.name$"] = encodeURIComponent(ApiInvoker.toPathValue($argument.name$));
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.name$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", encodeURIComponent($argument.name$));
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
queryParams["$argument.name$"] = encodeURIComponent($argument.methodNameFromModelClass$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if( $argument.inputModelClassArgument$ != null && $argument.methodNameFromModelClass$ != null) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", encodeURIComponent($argument.methodNameFromModelClass$));
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
//make the API Call
|
||||
var eventName = "$resource$.$method.name$";
|
||||
var returnType = null;
|
||||
$if(!method.responseVoid)$
|
||||
returnType = $method.returnClassName$;
|
||||
$endif$
|
||||
var ajaxRequest = null;
|
||||
$if(method.postObject)$
|
||||
$if(method.authToken)$
|
||||
ajaxRequest = ApiInvoker.invokeAPI(authToken, resourcePath, method, queryParams, postData, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
ajaxRequest = ApiInvoker.invokeAPI(null, resourcePath, method, queryParams, postData, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
$if(!method.postObject)$
|
||||
$if(method.authToken)$
|
||||
ajaxRequest = ApiInvoker.invokeAPI(authToken, resourcePath, method, queryParams, null, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$if(!method.authToken)$
|
||||
ajaxRequest = ApiInvoker.invokeAPI(null, resourcePath, method, queryParams, null, eventName, requestId, returnType, callback);
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
return {"requestId":requestId, "ajaxRequest":ajaxRequest};
|
||||
}
|
||||
}$
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
/**
|
||||
* Maintains the compatible server version against which the drive is written
|
||||
*
|
||||
*/
|
||||
var VersionChecker = new function() {
|
||||
this.compatibleVersion = "$apiVersion$";
|
||||
}
|
||||
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* $model.description$
|
||||
* NOTE: This class is auto generated by the drive code generator program so please do not edit the class manually.
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
function $className$() {
|
||||
|
||||
$fields:{ field |
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowableValues)$[AllowableValues(value="$field.allowedValuesString$"]$endif$
|
||||
*/
|
||||
this.$field.fieldDefinition.name$ $field.fieldDefinition.initialization$;}$
|
||||
|
||||
$fields:{ field |
|
||||
/**
|
||||
* Returns the list being wrapped by this wrapper class. There will be a single list item attribute in this class.
|
||||
*/
|
||||
$if(field.fieldDefinition.collectionItemType)$
|
||||
this.getList = function() {
|
||||
return this.$field.fieldDefinition.name$;
|
||||
}
|
||||
|
||||
this.parse = function(data) {
|
||||
if(data) {
|
||||
this.$field.fieldDefinition.name$ = $field.fieldDefinition.collectionItemType$Object.parseArray(data);
|
||||
}
|
||||
}
|
||||
|
||||
$endif$}$
|
||||
}
|
||||
@@ -1,196 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* APIClient.php
|
||||
*/
|
||||
|
||||
|
||||
/* Autoload the model definition files */
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @param string $className the class to attempt to load
|
||||
*/
|
||||
function __autoload($className) {
|
||||
$currentDir = substr(__FILE__, 0, strrpos(__FILE__, '/'));
|
||||
if (file_exists($currentDir . '/' . $className . '.php')) {
|
||||
include $currentDir . '/' . $className . '.php';
|
||||
} elseif (file_exists($currentDir . '/../model/' . $className . '.php')) {
|
||||
include $currentDir . '/../model/' . $className . '.php';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class APIClient {
|
||||
|
||||
public static $POST = "POST";
|
||||
public static $GET = "GET";
|
||||
public static $PUT = "PUT";
|
||||
public static $DELETE = "DELETE";
|
||||
|
||||
/**
|
||||
* @param string $apiKey your API key
|
||||
* @param string $apiServer the address of the API server
|
||||
*/
|
||||
function __construct($apiKey, $apiServer) {
|
||||
$this->apiKey = $apiKey;
|
||||
$this->apiServer = $apiServer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param string $resourcePath path to method endpoint
|
||||
* @param string $method method to call
|
||||
* @param array $queryParams parameters to be place in query URL
|
||||
* @param array $postData parameters to be placed in POST body
|
||||
* @param array $headerParams parameters to be place in request header
|
||||
* @return unknown
|
||||
*/
|
||||
public function callAPI($resourcePath, $method, $queryParams, $postData,
|
||||
$headerParams) {
|
||||
|
||||
$headers = array();
|
||||
$headers[] = "Content-type: application/json";
|
||||
|
||||
# Allow API key from $headerParams to override default
|
||||
$added_api_key = False;
|
||||
if ($headerParams != null) {
|
||||
foreach ($headerParams as $key => $val) {
|
||||
$headers[] = "$key: $val";
|
||||
if ($key == 'api_key') {
|
||||
$added_api_key = True;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (! $added_api_key) {
|
||||
$headers[] = "api_key: " . $this->apiKey;
|
||||
}
|
||||
|
||||
if (is_object($postData) or is_array($postData)) {
|
||||
$postData = json_encode($postData);
|
||||
}
|
||||
|
||||
$url = $this->apiServer . $resourcePath;
|
||||
|
||||
$curl = curl_init();
|
||||
curl_setopt($curl, CURLOPT_TIMEOUT, 5);
|
||||
// return the result on success, rather than just TRUE
|
||||
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
||||
|
||||
if ($method == self::$GET) {
|
||||
if (! empty($queryParams)) {
|
||||
$url = ($url . '?' . http_build_query($queryParams));
|
||||
}
|
||||
} else if ($method == self::$POST) {
|
||||
curl_setopt($curl, CURLOPT_POST, true);
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||
} else if ($method == self::$PUT) {
|
||||
$json_data = json_encode($postData);
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "PUT");
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||
} else if ($method == self::$DELETE) {
|
||||
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, "DELETE");
|
||||
curl_setopt($curl, CURLOPT_POSTFIELDS, $postData);
|
||||
} else {
|
||||
throw new Exception('Method ' . $method . ' is not recognized.');
|
||||
}
|
||||
|
||||
curl_setopt($curl, CURLOPT_URL, $url);
|
||||
|
||||
// Make the request
|
||||
$response = curl_exec($curl);
|
||||
$response_info = curl_getinfo($curl);
|
||||
|
||||
// Handle the response
|
||||
if ($response_info['http_code'] == 0) {
|
||||
throw new Exception("TIMEOUT: api call to " . $url .
|
||||
" took more than 5s to return" );
|
||||
} else if ($response_info['http_code'] == 200) {
|
||||
$data = json_decode($response);
|
||||
} else if ($response_info['http_code'] == 401) {
|
||||
throw new Exception("Unauthorized API request to " . $url .
|
||||
": ".json_decode($response)->message );
|
||||
} else if ($response_info['http_code'] == 404) {
|
||||
$data = null;
|
||||
} else {
|
||||
throw new Exception("Can't connect to the api: " . $url .
|
||||
" response code: " .
|
||||
$response_info['http_code']);
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Take value and turn it into a string suitable for inclusion in
|
||||
* the path or the header
|
||||
* @param object $object an object to be serialized to a string
|
||||
* @return string the serialized object
|
||||
*/
|
||||
public static function toPathValue($object) {
|
||||
if (is_array($object)) {
|
||||
return implode(',', $object);
|
||||
} else {
|
||||
return $object;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Derialize a JSON string into an object
|
||||
*
|
||||
* @param object $object object or primitive to be deserialized
|
||||
* @param string $class class name is passed as a string
|
||||
* @return object an instance of $class
|
||||
*/
|
||||
public static function deserialize($object, $class) {
|
||||
|
||||
if (in_array($class, array('string', 'int', 'float', 'bool'))) {
|
||||
settype($object, $class);
|
||||
return $object;
|
||||
} else {
|
||||
$instance = new $class(); // this instantiates class named $class
|
||||
$classVars = get_class_vars($class);
|
||||
}
|
||||
|
||||
foreach ($object as $property => $value) {
|
||||
|
||||
// Need to handle possible pluralization differences
|
||||
$true_property = $property;
|
||||
|
||||
if (! property_exists($class, $true_property)) {
|
||||
if (substr($property, -1) == 's') {
|
||||
$true_property = substr($property, 0, -1);
|
||||
if (! property_exists($class, $true_property)) {
|
||||
trigger_error("class $class has no property $property"
|
||||
. " or $true_property", E_USER_WARNING);
|
||||
}
|
||||
} else {
|
||||
trigger_error("class $class has no property $property",
|
||||
E_USER_WARNING);
|
||||
}
|
||||
}
|
||||
|
||||
$type = $classVars['swaggerTypes'][$true_property];
|
||||
if (in_array($type, array('string', 'int', 'float', 'bool'))) {
|
||||
settype($value, $type);
|
||||
$instance->{$true_property} = $value;
|
||||
} elseif (preg_match("/array<(.*)>/", $type, $matches)) {
|
||||
$sub_class = $matches[1];
|
||||
$instance->{$true_property} = array();
|
||||
foreach ($value as $sub_property => $sub_value) {
|
||||
$instance->{$true_property}[] = self::deserialize($sub_value,
|
||||
$sub_class);
|
||||
}
|
||||
} else {
|
||||
$instance->{$true_property} = self::deserialize($value, $type);
|
||||
}
|
||||
}
|
||||
return $instance;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
@@ -1,120 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*/
|
||||
|
||||
class $resource$ {
|
||||
|
||||
function __construct(\$apiClient) {
|
||||
\$this->apiClient = \$apiClient;
|
||||
}
|
||||
|
||||
$methods:{ method |
|
||||
|
||||
/**
|
||||
* $method.title$
|
||||
*
|
||||
$if(method.description)$
|
||||
* $method.description$
|
||||
* $endif$
|
||||
* $method.arguments:{ argument |@param $argument.name$ $argument.description$
|
||||
* $if(argument.allowedValues)$
|
||||
* Allowed values are - $argument.allowedValues$ $endif$ }$
|
||||
$if(!method.responseVoid)$
|
||||
* @return $method.returnValue$ {@link $method.returnClassName$} $endif$
|
||||
* @throws APIException $method.exceptionDescription$
|
||||
*/
|
||||
|
||||
public function $method.name$($method.arguments: { argument | \$$argument.name$}; separator=", "$) {
|
||||
|
||||
//parse inputs
|
||||
\$resourcePath = "$method.resourcePath$";
|
||||
\$resourcePath = str_replace("{format}", "json", \$resourcePath);
|
||||
\$method = "$method.methodType$";
|
||||
\$queryParams = array();
|
||||
\$headerParams = array();
|
||||
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if(\$$argument.name$ != null) {
|
||||
\$queryParams['$argument.name$'] = \$this->apiClient->toPathValue(\$$argument.name$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if(\$$argument.name$ != null) {
|
||||
\$resourcePath = str_replace("{$argument.name$}", \$$argument.name$, \$resourcePath);
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if(\$$argument.name$ != null) {
|
||||
\$headerParams['$argument.name$'] = \$this->apiClient->toPathValue(\$$argument.name$);
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if(\$$argument.inputModelClassArgument$ != null && \$$argument.inputModelClassArgument$->$argument.name$ != null) {
|
||||
\$queryParams["$argument.name$"] = \$this->apiClient->toPathValue(\$$argument.inputModelClassArgument$->$argument.name$);
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if(\$$argument.inputModelClassArgument$ != null && \$$argument.inputModelClassArgument$->$argument.name$ != null) {
|
||||
\$resourcePath = str_replace("{$argument.name$}", \$$argument.inputModelClassArgument$->$argument.name$, \$resourcePath);
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if(\$$argument.inputModelClassArgument$ != null && \$$argument.inputModelClassArgument$->$argument.name$ != null) {
|
||||
\$headerParams['$argument.name$'] = \$this->apiClient->toPathValue(\$$argument.inputModelClassArgument$->$argument.name$);
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
|
||||
//make the API Call
|
||||
$if(method.postObject)$
|
||||
\$response = \$this->apiClient->callAPI(\$resourcePath, \$method, \$queryParams, \$postData, \$headerParams);
|
||||
$endif$
|
||||
$if(!method.postObject)$
|
||||
\$response = \$this->apiClient->callAPI(\$resourcePath, \$method, \$queryParams, null, \$headerParams);
|
||||
$endif$
|
||||
|
||||
$if(!method.responseVoid)$
|
||||
if(! \$response){
|
||||
return null;
|
||||
}
|
||||
|
||||
$if(!method.returnValueList)$
|
||||
//create output objects if the response has more than one object
|
||||
\$responseObject = \$this->apiClient->deserialize(\$response, '$method.returnClassName$');
|
||||
return \$responseObject;
|
||||
|
||||
$endif$
|
||||
$if(method.returnValueList)$
|
||||
\$responseObjects = array();
|
||||
foreach (\$response as \$object) {
|
||||
\$responseObjects[] = \$this->apiClient->deserialize(\$object, '$method.returnClassName$');
|
||||
}
|
||||
return \$responseObjects;
|
||||
$endif$
|
||||
$endif$
|
||||
}
|
||||
|
||||
}$
|
||||
|
||||
}
|
||||
@@ -1,131 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""Wordnik.com's Swagger generic API client. This client handles the client-
|
||||
server communication, and is invariant across implementations. Specifics of
|
||||
the methods and models for each application are generated from the Swagger
|
||||
templates."""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
import urllib
|
||||
import urllib2
|
||||
import httplib
|
||||
import json
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
|
||||
import model
|
||||
|
||||
|
||||
class APIClient:
|
||||
"""Generic API client for Swagger client library builds"""
|
||||
|
||||
def __init__(self, apiKey=None, apiServer=None):
|
||||
if apiKey == None:
|
||||
raise Exception('You must pass an apiKey when instantiating the '
|
||||
'APIClient')
|
||||
self.apiKey = apiKey
|
||||
self.apiServer = apiServer
|
||||
|
||||
def callAPI(self, resourcePath, method, queryParams, postData,
|
||||
headerParams=None):
|
||||
|
||||
url = self.apiServer + resourcePath
|
||||
headers = {}
|
||||
if headerParams:
|
||||
for param, value in headerParams.iteritems():
|
||||
headers[param] = value
|
||||
|
||||
headers['Content-type'] = 'application/json'
|
||||
headers['api_key'] = self.apiKey
|
||||
|
||||
data = None
|
||||
if method == 'GET':
|
||||
if queryParams:
|
||||
# Need to remove None values, these should not be sent
|
||||
sentQueryParams = {}
|
||||
for param, value in queryParams.iteritems():
|
||||
if value != None:
|
||||
sentQueryParams[param] = value
|
||||
url = url + '?' + urllib.urlencode(sentQueryParams)
|
||||
request = urllib2.Request(url=url, headers=headers)
|
||||
elif method in ['POST', 'PUT', 'DELETE']:
|
||||
data = postData
|
||||
if data:
|
||||
if type(postData) not in [str, int, float, bool]:
|
||||
data = json.dumps(postData.__dict__)
|
||||
request = urllib2.Request(url=url, headers=headers, data=data)
|
||||
if method in ['PUT', 'DELETE']:
|
||||
# Monkey patch alert! Urllib2 doesn't really do PUT / DELETE
|
||||
request.get_method = lambda: method
|
||||
|
||||
else:
|
||||
raise Exception('Method ' + method + ' is not recognized.')
|
||||
|
||||
# Make the request
|
||||
response = urllib2.urlopen(request).read()
|
||||
|
||||
try:
|
||||
data = json.loads(response)
|
||||
except ValueError: # PUT requests don't return anything
|
||||
data = None
|
||||
|
||||
return data
|
||||
|
||||
def toPathValue(self, obj):
|
||||
"""Serialize a list to a CSV string, if necessary.
|
||||
Args:
|
||||
obj -- data object to be serialized
|
||||
Returns:
|
||||
string -- json serialization of object
|
||||
"""
|
||||
if type(obj) == list:
|
||||
return ','.join(obj)
|
||||
else:
|
||||
return obj
|
||||
|
||||
def deserialize(self, obj, objClass):
|
||||
"""Derialize a JSON string into an object.
|
||||
|
||||
Args:
|
||||
obj -- string or object to be deserialized
|
||||
objClass -- class literal for deserialzied object, or string
|
||||
of class name
|
||||
Returns:
|
||||
object -- deserialized object"""
|
||||
|
||||
# Have to accept objClass as string or actual type. Type could be a
|
||||
# native Python type, or one of the model classes.
|
||||
if type(objClass) == str:
|
||||
try:
|
||||
objClass = eval(objClass)
|
||||
except NameError: # not a native type, must be model class
|
||||
objClass = eval('model.' + objClass + '.' + objClass)
|
||||
|
||||
if objClass in [str, int, float, bool]:
|
||||
return objClass(obj)
|
||||
|
||||
instance = objClass()
|
||||
|
||||
for attr, attrType in instance.swaggerTypes.iteritems():
|
||||
if attr in obj:
|
||||
value = obj[attr]
|
||||
if attrType in ['str', 'int', 'float', 'bool']:
|
||||
attrType = eval(attrType)
|
||||
try:
|
||||
value = attrType(value)
|
||||
except UnicodeEncodeError:
|
||||
value = unicode(value)
|
||||
setattr(instance, attr, value)
|
||||
elif 'list<' in attrType:
|
||||
match = re.match('list<(.*)>', attrType)
|
||||
subClass = match.group(1)
|
||||
subValues = []
|
||||
|
||||
for subValue in value:
|
||||
subValues.append(self.deserialize(subValue, subClass))
|
||||
setattr(instance, attr, subValues)
|
||||
else:
|
||||
setattr(instance, attr, self.deserialize(value,
|
||||
objClass))
|
||||
|
||||
return instance
|
||||
@@ -1,118 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
"""
|
||||
$resource$.py
|
||||
Copyright 2011 Wordnik, Inc.
|
||||
|
||||
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.
|
||||
|
||||
NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
|
||||
sys.path.append(os.path.dirname(os.path.abspath(__file__)) + '/../')
|
||||
import model
|
||||
|
||||
class $resource$(object):
|
||||
|
||||
def __init__(self, apiClient):
|
||||
self.apiClient = apiClient
|
||||
|
||||
$methods:{ method |
|
||||
def $method.name$(self, $method.arguments: { argument | $if(argument.required)$$argument.name$, $endif$}$$method.arguments: { argument | $if(! argument.required)$$argument.name$=None, $endif$}$):
|
||||
"""$method.title$
|
||||
$if(method.description)$
|
||||
$method.description$
|
||||
$endif$
|
||||
Args:
|
||||
$method.arguments:{ argument |$argument.name$ -- $argument.description$
|
||||
$if(argument.allowedValues)$
|
||||
Allowed values are - $argument.allowedValues$
|
||||
$endif$}$
|
||||
$if(!method.responseVoid)$
|
||||
Return:
|
||||
$method.returnValue$ -- an instance of $method.returnClassName$
|
||||
$endif$"""
|
||||
|
||||
# Parse inputs
|
||||
resourcePath = '$method.resourcePath$'
|
||||
resourcePath = resourcePath.replace('{format}', 'json')
|
||||
method = '$method.methodType$'
|
||||
|
||||
queryParams = {}
|
||||
headerParams = {}
|
||||
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
queryParams['$argument.name$'] = self.apiClient.toPathValue($argument.name$)
|
||||
}$
|
||||
|
||||
$method.pathParameters:{ argument |
|
||||
if $argument.name$ != None:
|
||||
resourcePath = resourcePath.replace('{$argument.name$}', $argument.name$)
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if $argument.name$ != None:
|
||||
headerParams['$argument.name$'] = self.apiClient.toPathValue($argument.name$)
|
||||
}$
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if $argument.inputModelClassArgument$ != None and $argument.inputModelClassArgument$.$argument.name$ != None:
|
||||
queryParams['$argument.name$'] = self.apiClient.toPathValue($argument.inputModelClassArgument$.$argument.name$)
|
||||
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if $argument.inputModelClassArgument$ != None and $argument.inputModelClassArgument$.$argument.name$ != None:
|
||||
resourcePath = resourcePath.replace('{$argument.name$}', $argument.inputModelClassArgument$.$argument.name$)
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if $argument.inputModelClassArgument$ != None and $argument.inputModelClassArgument$.$argument.name$ != None:
|
||||
headerParams['$argument.name$'] = self.apiClient.toPathValue($argument.inputModelClassArgument$.$argument.name$)
|
||||
}$
|
||||
|
||||
$endif$
|
||||
|
||||
# Make the API Call
|
||||
$if(method.postObject)$
|
||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||
postData, headerParams)
|
||||
$endif$
|
||||
|
||||
$if(!method.postObject)$
|
||||
response = self.apiClient.callAPI(resourcePath, method, queryParams,
|
||||
None, headerParams)
|
||||
$endif$
|
||||
|
||||
$if(!method.responseVoid)$
|
||||
if not response:
|
||||
return None
|
||||
|
||||
$if(!method.returnValueList)$
|
||||
# Create output objects if the response has more than one object
|
||||
responseObject = self.apiClient.deserialize(response,
|
||||
model.$method.returnClassName$.$method.returnClassName$)
|
||||
return responseObject
|
||||
$endif$
|
||||
|
||||
$if(method.returnValueList)$
|
||||
responseObjects = []
|
||||
for responseObject in response:
|
||||
responseObjects.append(self.apiClient.deserialize(responseObject,
|
||||
model.$method.returnClassName$.$method.returnClassName$))
|
||||
return responseObjects
|
||||
$endif$
|
||||
$endif$
|
||||
|
||||
}$
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="swagger-sample-scala-lib" xmlns:ivy="antlib:org.apache.ivy.ant" default="build.all" basedir=".">
|
||||
<property environment="env" />
|
||||
<property name="version.identifier" value="1.0" />
|
||||
<property name="artifact.ext" value="jar" />
|
||||
<property name="organization" value="wordnik" />
|
||||
<property name="module" value="${ant.project.name}" />
|
||||
|
||||
<!-- default dirs for the build -->
|
||||
<mkdir dir="lib"/>
|
||||
<mkdir dir="lib/ext"/>
|
||||
|
||||
<condition property="scala.home" value="${env.SCALA_HOME}">
|
||||
<isset property="env.SCALA_HOME" />
|
||||
</condition>
|
||||
|
||||
<path id="scala.classpath">
|
||||
<fileset dir="${scala.home}/lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<ivy:settings file="ivysettings.xml" />
|
||||
|
||||
<taskdef resource="scala/tools/ant/antlib.xml">
|
||||
<classpath>
|
||||
<fileset dir="lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${scala.home}/lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<!-- this is the output module -->
|
||||
<property name="module" value="${ant.project.name}" />
|
||||
|
||||
<target name="build.all" depends="clean, resolve, fastcompile" description="builds the module (default target)" />
|
||||
|
||||
<target name="clean" description="cleans the project folder">
|
||||
<mkdir dir="build" />
|
||||
<echo message="deleting build files" />
|
||||
<delete quiet="true">
|
||||
<fileset dir="build">
|
||||
<include name="*.jar" />
|
||||
<include name="*.xml" />
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<delete dir="build/main" quiet="true" />
|
||||
|
||||
<delete dir="dist" quiet="true" />
|
||||
|
||||
<!-- libraries handled by ivy -->
|
||||
<echo message="deleting libs handled by ivy" />
|
||||
<delete>
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
<include name="*.zip" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!-- copies ONLY the swagger-sample jar to dist-->
|
||||
<target name="fastdist" depends="fastcompile">
|
||||
<copy todir="dist/lib">
|
||||
<fileset dir="build">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<!-- copies all dependencies into the lib folder -->
|
||||
<target name="resolve" description="retreive dependencies with ivy">
|
||||
<ivy:retrieve pattern="${basedir}/lib/[artifact]-[revision].[ext]" conf="build" />
|
||||
</target>
|
||||
|
||||
<target name="fastcompile" description="builds the module without artifact resolution or cleaning">
|
||||
<delete quiet="true" file="build/${organization}-${artifact}-*.${artifact.ext}" />
|
||||
<mkdir dir="build" />
|
||||
<mkdir dir="build/main" />
|
||||
<mkdir dir="build/main/java" />
|
||||
|
||||
<javac srcdir="src/main/java" debug="true" destdir="build/main/java">
|
||||
<classpath>
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="lib/ext">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<pathelement location="build/main/java" />
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
|
||||
<scalac srcdir="src/main/java:src/main/scala" destdir="build/main/java">
|
||||
<classpath>
|
||||
<pathelement location="build/main/java" />
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="lib/ext">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${scala.home}/lib"/>
|
||||
</classpath>
|
||||
<include name="**/*.scala" />
|
||||
<include name="**/*.java" />
|
||||
</scalac>
|
||||
|
||||
<jar jarfile="build/${module}-${version.identifier}.${artifact.ext}">
|
||||
<fileset dir="build/main/java" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<!-- cleans up the dist -->
|
||||
<target name="dist.clean" description="cleans the distribution folder">
|
||||
<delete quiet="true" dir="dist" />
|
||||
<delete quiet="true" file="dist.zip" />
|
||||
</target>
|
||||
|
||||
<target name="dependency.tree" description="builds a graphml dependency diagram for viewing with yEd">
|
||||
<ivy:report conf="build" graph="true" todir="." outputpattern="[artifact]-[revision].[ext]" />
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -1,31 +0,0 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="wordnik" module="sample-java-lib"/>
|
||||
<configurations>
|
||||
<conf name="build" description="build wordnik-java"/>
|
||||
<conf name="test" visibility="public"/>
|
||||
<conf name="source" visibility="public"/>
|
||||
<conf name="pom" visibility="public"/>
|
||||
</configurations>
|
||||
|
||||
<dependencies>
|
||||
<!-- jersey dependencies -->
|
||||
<dependency org="junit" name="junit" rev="4.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-json" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-client" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-server" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-core" rev="1.4" conf="build->default"/>
|
||||
<dependency org="asm" name="asm-parent" rev="3.1" conf="build->default"/>
|
||||
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.8.0" conf="build->default"/>
|
||||
<dependency org="org.antlr" name="stringtemplate" rev="3.2" conf="build->default"/>
|
||||
<!-- jackson jars -->
|
||||
<dependency org="org.codehaus.jackson" name="jackson-jaxrs" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-xc" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.1" conf="build->default"/>
|
||||
|
||||
|
||||
<dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9.2" conf="test->default">
|
||||
<exclude org="asm" name="asm-tree"/>
|
||||
<exclude org="asm" name="asm"/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ivysettings>
|
||||
<settings defaultResolver="chained" />
|
||||
<property name="ivy.checksums" value=""/>
|
||||
<property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local"
|
||||
override="false" />
|
||||
<property name="ivy.local.default.ivy.pattern"
|
||||
value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
|
||||
override="false" />
|
||||
<property name="ivy.local.default.artifact.pattern"
|
||||
value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
|
||||
override="false" />
|
||||
<resolvers>
|
||||
<chain name="chained" returnFirst="true">
|
||||
<filesystem name="local">
|
||||
<ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
|
||||
<artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
|
||||
</filesystem>
|
||||
<ibiblio name="ibiblio" m2compatible="true" />
|
||||
<ibiblio name="javanet" root="http://download.java.net/maven/2/" m2compatible="true" />
|
||||
</chain>
|
||||
</resolvers>
|
||||
</ivysettings>
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"apiUrl":"http://localhost:8002/api/",
|
||||
|
||||
"apiKey":"special-key",
|
||||
|
||||
"defaultServiceBaseClass":"Object",
|
||||
|
||||
"defaultModelBaseClass":"Object",
|
||||
|
||||
"serviceBaseClasses":{},
|
||||
|
||||
"defaultModelImports":[],
|
||||
|
||||
"defaultServiceImports":[],
|
||||
|
||||
"modelPackageName":"com.wordnik.swagger.sample.sdk.java.model",
|
||||
|
||||
"apiPackageName":"com.wordnik.swagger.sample.sdk.java.api",
|
||||
|
||||
"ignoreMethods":[],
|
||||
|
||||
"ignoreModels":[],
|
||||
|
||||
"outputDirectory":"../swagger-sample-app/sdk-libs/src/main/java/com/wordnik/swagger/sample/sdk/java",
|
||||
|
||||
"libraryHome":"../swagger-sample-app/sdk-libs"
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"userList":[
|
||||
{
|
||||
"username":"testuser1",
|
||||
"password":"password1",
|
||||
"email":"test1@dummy.com"
|
||||
},
|
||||
{
|
||||
"username":"testuser2",
|
||||
"password":"password2",
|
||||
"email":"test2@dummy.com"
|
||||
}
|
||||
],
|
||||
"petList":[
|
||||
{
|
||||
"id":101,
|
||||
"name":"pet1",
|
||||
"photoUrls":["url1","url2"],
|
||||
"tags":[
|
||||
{
|
||||
"id":1,
|
||||
"name":"tag1"
|
||||
},
|
||||
{
|
||||
"id":2,
|
||||
"name":"tag2"
|
||||
}
|
||||
],
|
||||
"status":"available",
|
||||
"category":{"id":1,"name":"cat1"}
|
||||
}
|
||||
],
|
||||
"orderList":[
|
||||
{
|
||||
"id":101,
|
||||
"petId":1,
|
||||
"quantity":1,
|
||||
"status":"placed",
|
||||
"shipDate":13456789
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
{
|
||||
"resources" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Find Per by Id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/{petId}",
|
||||
"suggestedMethodName" : "getPetById"
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Find pets by status",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByStatus",
|
||||
"suggestedMethodName" : "findPetsByStatus"
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Find pets by tags",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByTags",
|
||||
"suggestedMethodName" : "findPetsByTags"
|
||||
},
|
||||
{
|
||||
"id" : 4,
|
||||
"name" : "Add a pet",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "addPet"
|
||||
},
|
||||
{
|
||||
"id" : 5,
|
||||
"name" : "Update a pet",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "updatePet"
|
||||
},
|
||||
{
|
||||
"id" : 6,
|
||||
"name" : "Create user",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/user.{format}",
|
||||
"suggestedMethodName" : "createUser"
|
||||
},
|
||||
{
|
||||
"id" : 7,
|
||||
"name" : "Update user",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "updateUser"
|
||||
},
|
||||
{
|
||||
"id" : 8,
|
||||
"name" : "Delete user",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "deleteUser"
|
||||
},
|
||||
{
|
||||
"id" : 9,
|
||||
"name" : "Get user by user name",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "getUserByName"
|
||||
},
|
||||
{
|
||||
"id" : 10,
|
||||
"name" : "Login",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/login",
|
||||
"suggestedMethodName" : "loginUser"
|
||||
},
|
||||
{
|
||||
"id" : 11,
|
||||
"name" : "Logout",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/logout",
|
||||
"suggestedMethodName" : "logoutUser"
|
||||
},
|
||||
{
|
||||
"id" : 12,
|
||||
"name" : "Find order by id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "getOrderById"
|
||||
},
|
||||
{
|
||||
"id" : 13,
|
||||
"name" : "Delete order by id",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "deleteOrder"
|
||||
},
|
||||
{
|
||||
"id" : 14,
|
||||
"name" : "Create order",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/store.{format}/order",
|
||||
"suggestedMethodName" : "placeOrder"
|
||||
}
|
||||
],
|
||||
"testSuites" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Test User service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Create User",
|
||||
"id" : 1,
|
||||
"resourceId" : 6,
|
||||
"input" : {
|
||||
"postData":"${input.userList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Login User",
|
||||
"id" : 2,
|
||||
"resourceId" : 10,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}",
|
||||
"password":"${input.userList[0].password}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find user by name",
|
||||
"id" : 3,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.3).username}",
|
||||
"condition" : "==",
|
||||
"expectedOutput" : "${input.userList[0].username}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Delete user by name",
|
||||
"id" : 4,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.4)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Test Pet service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Add pet",
|
||||
"id" : 1,
|
||||
"resourceId" : 4,
|
||||
"input" : {
|
||||
"postData":"${input.petList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by id",
|
||||
"id" : 2,
|
||||
"resourceId" : 1,
|
||||
"input" : {
|
||||
"petId":"1"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by status",
|
||||
"id" : 3,
|
||||
"resourceId" : 2,
|
||||
"input" : {
|
||||
"status":"available,sold,pending"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.3).size}",
|
||||
"condition" : ">",
|
||||
"expectedOutput" : "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Test Store service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Find order by id",
|
||||
"id" : 1,
|
||||
"resourceId" : 12,
|
||||
"input" : {
|
||||
"orderId":"1"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(3.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Place order",
|
||||
"id" : 2,
|
||||
"resourceId" : 14,
|
||||
"input" : {
|
||||
"postData":"${input.orderList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
# nothing to see yet
|
||||
@@ -1,21 +0,0 @@
|
||||
class $className$Model
|
||||
attr_accessor $fields:{ field | :$field.fieldDefinition.name$};separator=", "$
|
||||
$fields:{ field |
|
||||
$if(field.required)$ validate_presence_of :$field.fieldDefinition.name$$endif$
|
||||
}$
|
||||
|
||||
# TODO: move this to base class
|
||||
def initialize(attributes = {})
|
||||
attributes.symbolize_and_underscore_keys!
|
||||
|
||||
# loop over incoming attributes, only assign to valid attr_accessor props
|
||||
$fields:{ field |
|
||||
if(UserModel.respond_to? :$field.fieldDefinition.name$) self.$field.fieldDefinition.name$ = attributes[:$field.fieldDefinition.name$]
|
||||
}$
|
||||
|
||||
# if(UserModel.respond_to? :word) self.word = attributes[:word]
|
||||
# Zap any whitespace and bad encoding
|
||||
# attributes[:name] &&= attributes[:name].strip.squeeze(' ').force_encoding('UTF-8')
|
||||
# super(attributes)
|
||||
end
|
||||
end
|
||||
@@ -1,47 +0,0 @@
|
||||
module $resource$
|
||||
|
||||
$methods:{ method |
|
||||
def $method.name$(opts={})
|
||||
$if(method.pathParameters)$ requiredKeys=[:$method.pathParameters:{ param | $param.name$};separator=", "$]$endif$
|
||||
$if(method.queryParameters)$ queryparamKeys=[:$method.queryParameters:{ param | $param.name$};separator=", "$]$endif$
|
||||
|
||||
$if(method.pathParameters)$
|
||||
#check required options
|
||||
requiredKeys.each do |key|
|
||||
raise "#{key} is required" unless options.has_key?(key)
|
||||
end
|
||||
$endif$
|
||||
|
||||
|
||||
# set default values and merge with input
|
||||
options = {
|
||||
$if(method.arguments)$$method.arguments:{ param | $if(param.defaultValue)$ :$param.name$="$param.defaultValue$"$endif$}$$endif$
|
||||
}.merge(opts)
|
||||
|
||||
#resource path
|
||||
path = "$method.resourcePath$".sub('{format}', '.json')
|
||||
|
||||
$if(method.pathParameters)$
|
||||
# sub pathparams
|
||||
$method.pathParameters:{ param |
|
||||
path.sub!('{$param.name$}', URI.encode(options[:$param.name$]))
|
||||
}$$endif$
|
||||
#pull querystring keys from options
|
||||
queryopts = options.select do |key,value|
|
||||
queryparamKeys.include? key
|
||||
end
|
||||
|
||||
$if(method.hasResponseValue)$
|
||||
results = Swagger::request.new(:get, path, queryopts, nil)
|
||||
$if(method.returnValueList)$
|
||||
output = results.map {|result| $method.returnValue$.new(result)}
|
||||
$else$
|
||||
output = $method.returnValue$.new(result)
|
||||
$endif$
|
||||
$else$
|
||||
Swagger::request.new(:get, path, queryopts, nil)
|
||||
$endif$
|
||||
|
||||
end
|
||||
|
||||
}$
|
||||
@@ -1,5 +0,0 @@
|
||||
module $resource$
|
||||
def get_compatible_version(*args)
|
||||
'$apiVersion$'
|
||||
end
|
||||
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<project name="swagger-sample-scala-lib" xmlns:ivy="antlib:org.apache.ivy.ant" default="build.all" basedir=".">
|
||||
<property environment="env" />
|
||||
<property name="version.identifier" value="1.0" />
|
||||
<property name="artifact.ext" value="jar" />
|
||||
<property name="organization" value="wordnik" />
|
||||
<property name="module" value="${ant.project.name}" />
|
||||
|
||||
<!-- default dirs for the build -->
|
||||
<mkdir dir="lib"/>
|
||||
<mkdir dir="lib/ext"/>
|
||||
|
||||
<condition property="scala.home" value="${env.SCALA_HOME}">
|
||||
<isset property="env.SCALA_HOME" />
|
||||
</condition>
|
||||
|
||||
<path id="scala.classpath">
|
||||
<fileset dir="${scala.home}/lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<ivy:settings file="ivysettings.xml" />
|
||||
|
||||
<taskdef resource="scala/tools/ant/antlib.xml">
|
||||
<classpath>
|
||||
<fileset dir="lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${scala.home}/lib">
|
||||
<include name="scala**.jar" />
|
||||
</fileset>
|
||||
</classpath>
|
||||
</taskdef>
|
||||
|
||||
<!-- this is the output module -->
|
||||
<property name="module" value="${ant.project.name}" />
|
||||
|
||||
<target name="jar" description="creates jar file " depends="build.all">
|
||||
<jar jarfile="build/${release.module}-${release.version}.${artifact.ext}">
|
||||
<fileset dir="build/main/java" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="build.all" depends="clean, resolve, fastcompile" description="builds the module (default target)" />
|
||||
|
||||
<target name="clean" description="cleans the project folder">
|
||||
<mkdir dir="build" />
|
||||
<echo message="deleting build files" />
|
||||
<delete quiet="true">
|
||||
<fileset dir="build">
|
||||
<include name="*.jar" />
|
||||
<include name="*.xml" />
|
||||
</fileset>
|
||||
</delete>
|
||||
|
||||
<delete dir="build/main" quiet="true" />
|
||||
|
||||
<delete dir="dist" quiet="true" />
|
||||
|
||||
<!-- libraries handled by ivy -->
|
||||
<echo message="deleting libs handled by ivy" />
|
||||
<delete>
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
<include name="*.zip" />
|
||||
</fileset>
|
||||
</delete>
|
||||
</target>
|
||||
|
||||
<!-- copies all dependencies into the lib folder -->
|
||||
<target name="resolve" description="retreive dependencies with ivy">
|
||||
<ivy:retrieve pattern="${basedir}/lib/[artifact]-[revision].[ext]" conf="build" />
|
||||
</target>
|
||||
|
||||
<target name="fastcompile" description="builds the module without artifact resolution or cleaning">
|
||||
<delete quiet="true" file="build/${organization}-${artifact}-*.${artifact.ext}" />
|
||||
<mkdir dir="build" />
|
||||
<mkdir dir="build/main" />
|
||||
<mkdir dir="build/main/java" />
|
||||
|
||||
<javac srcdir="src/main/java" debug="true" destdir="build/main/java">
|
||||
<classpath>
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="lib/ext">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<pathelement location="build/main/java" />
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<scalac srcdir="src/main/java:src/main/scala" destdir="build/main/java">
|
||||
<classpath>
|
||||
<pathelement location="build/main/java" />
|
||||
<fileset dir="lib">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="lib/ext">
|
||||
<include name="*.jar" />
|
||||
</fileset>
|
||||
<fileset dir="${scala.home}/lib"/>
|
||||
</classpath>
|
||||
<include name="**/*.scala" />
|
||||
<include name="**/*.java" />
|
||||
</scalac>
|
||||
|
||||
<jar jarfile="build/${module}-${version.identifier}.${artifact.ext}">
|
||||
<fileset dir="build/main/java" />
|
||||
</jar>
|
||||
</target>
|
||||
|
||||
<target name="dependency.tree" description="builds a graphml dependency diagram for viewing with yEd">
|
||||
<ivy:report conf="build" graph="true" todir="." outputpattern="[artifact]-[revision].[ext]" />
|
||||
</target>
|
||||
</project>
|
||||
@@ -1,31 +0,0 @@
|
||||
<ivy-module version="2.0">
|
||||
<info organisation="wordnik" module="sample-java-lib"/>
|
||||
<configurations>
|
||||
<conf name="build" description="build wordnik-java"/>
|
||||
<conf name="test" visibility="public"/>
|
||||
<conf name="source" visibility="public"/>
|
||||
<conf name="pom" visibility="public"/>
|
||||
</configurations>
|
||||
|
||||
<dependencies>
|
||||
<!-- jersey dependencies -->
|
||||
<dependency org="junit" name="junit" rev="4.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-json" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-client" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-server" rev="1.4" conf="build->default"/>
|
||||
<dependency org="com.sun.jersey" name="jersey-core" rev="1.4" conf="build->default"/>
|
||||
<dependency org="asm" name="asm-parent" rev="3.1" conf="build->default"/>
|
||||
<dependency org="commons-beanutils" name="commons-beanutils" rev="1.8.0" conf="build->default"/>
|
||||
<dependency org="org.antlr" name="stringtemplate" rev="3.2" conf="build->default"/>
|
||||
<!-- jackson jars -->
|
||||
<dependency org="org.codehaus.jackson" name="jackson-jaxrs" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-xc" rev="1.7.1" conf="build->default"/>
|
||||
<dependency org="org.codehaus.jackson" name="jackson-mapper-asl" rev="1.7.1" conf="build->default"/>
|
||||
|
||||
|
||||
<dependency org="net.sourceforge.cobertura" name="cobertura" rev="1.9.2" conf="test->default">
|
||||
<exclude org="asm" name="asm-tree"/>
|
||||
<exclude org="asm" name="asm"/>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ivysettings>
|
||||
<settings defaultResolver="chained" />
|
||||
<property name="ivy.checksums" value=""/>
|
||||
<property name="ivy.local.default.root" value="${ivy.default.ivy.user.dir}/local"
|
||||
override="false" />
|
||||
<property name="ivy.local.default.ivy.pattern"
|
||||
value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
|
||||
override="false" />
|
||||
<property name="ivy.local.default.artifact.pattern"
|
||||
value="[organisation]/[module]/[revision]/[type]s/[artifact].[ext]"
|
||||
override="false" />
|
||||
<resolvers>
|
||||
<chain name="chained" returnFirst="true">
|
||||
<filesystem name="local">
|
||||
<ivy pattern="${ivy.local.default.root}/${ivy.local.default.ivy.pattern}" />
|
||||
<artifact pattern="${ivy.local.default.root}/${ivy.local.default.artifact.pattern}" />
|
||||
</filesystem>
|
||||
<ibiblio name="ibiblio" m2compatible="true" />
|
||||
<ibiblio name="javanet" root="http://download.java.net/maven/2/" m2compatible="true" />
|
||||
</chain>
|
||||
</resolvers>
|
||||
</ivysettings>
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"apiUrl":"http://localhost:8002/api/",
|
||||
|
||||
"apiKey":"special-key",
|
||||
|
||||
"defaultServiceBaseClass":"Object",
|
||||
|
||||
"defaultModelBaseClass":"Object",
|
||||
|
||||
"serviceBaseClasses":{},
|
||||
|
||||
"defaultModelImports":[],
|
||||
|
||||
"defaultServiceImports":[],
|
||||
|
||||
"modelPackageName":"com.wordnik.swagger.sample.sdk.java.model",
|
||||
|
||||
"apiPackageName":"com.wordnik.swagger.sample.sdk.java.api",
|
||||
|
||||
"ignoreMethods":[],
|
||||
|
||||
"ignoreModels":[],
|
||||
|
||||
"outputDirectory":"../swagger-sample-app/sdk-libs/src/main/java/com/wordnik/swagger/sample/sdk/java",
|
||||
|
||||
"libraryHome":"../swagger-sample-app/sdk-libs"
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
{
|
||||
"userList":[
|
||||
{
|
||||
"username":"testuser1",
|
||||
"password":"password1",
|
||||
"email":"test1@dummy.com"
|
||||
},
|
||||
{
|
||||
"username":"testuser2",
|
||||
"password":"password2",
|
||||
"email":"test2@dummy.com"
|
||||
}
|
||||
],
|
||||
"petList":[
|
||||
{
|
||||
"id":101,
|
||||
"name":"pet1",
|
||||
"photoUrls":["url1","url2"],
|
||||
"tags":[
|
||||
{
|
||||
"id":1,
|
||||
"name":"tag1"
|
||||
},
|
||||
{
|
||||
"id":2,
|
||||
"name":"tag2"
|
||||
}
|
||||
],
|
||||
"status":"available",
|
||||
"category":{"id":1,"name":"cat1"}
|
||||
}
|
||||
],
|
||||
"orderList":[
|
||||
{
|
||||
"id":101,
|
||||
"petId":1,
|
||||
"quantity":1,
|
||||
"status":"placed",
|
||||
"shipDate":13456789
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,265 +0,0 @@
|
||||
{
|
||||
"resources" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Find Per by Id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/{petId}",
|
||||
"suggestedMethodName" : "getPetById"
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Find pets by status",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByStatus",
|
||||
"suggestedMethodName" : "findPetsByStatus"
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Find pets by tags",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/pet.{format}/findByTags",
|
||||
"suggestedMethodName" : "findPetsByTags"
|
||||
},
|
||||
{
|
||||
"id" : 4,
|
||||
"name" : "Add a pet",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "addPet"
|
||||
},
|
||||
{
|
||||
"id" : 5,
|
||||
"name" : "Update a pet",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/pet.{format}",
|
||||
"suggestedMethodName" : "updatePet"
|
||||
},
|
||||
{
|
||||
"id" : 6,
|
||||
"name" : "Create user",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/user.{format}",
|
||||
"suggestedMethodName" : "createUser"
|
||||
},
|
||||
{
|
||||
"id" : 7,
|
||||
"name" : "Update user",
|
||||
"httpMethod" : "PUT",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "updateUser"
|
||||
},
|
||||
{
|
||||
"id" : 8,
|
||||
"name" : "Delete user",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "deleteUser"
|
||||
},
|
||||
{
|
||||
"id" : 9,
|
||||
"name" : "Get user by user name",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/{username}",
|
||||
"suggestedMethodName" : "getUserByName"
|
||||
},
|
||||
{
|
||||
"id" : 10,
|
||||
"name" : "Login",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/login",
|
||||
"suggestedMethodName" : "loginUser"
|
||||
},
|
||||
{
|
||||
"id" : 11,
|
||||
"name" : "Logout",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/user.{format}/logout",
|
||||
"suggestedMethodName" : "logoutUser"
|
||||
},
|
||||
{
|
||||
"id" : 12,
|
||||
"name" : "Find order by id",
|
||||
"httpMethod" : "GET",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "getOrderById"
|
||||
},
|
||||
{
|
||||
"id" : 13,
|
||||
"name" : "Delete order by id",
|
||||
"httpMethod" : "DELETE",
|
||||
"path" : "/store.{format}/order/{orderId}",
|
||||
"suggestedMethodName" : "deleteOrder"
|
||||
},
|
||||
{
|
||||
"id" : 14,
|
||||
"name" : "Create order",
|
||||
"httpMethod" : "POST",
|
||||
"path" : "/store.{format}/order",
|
||||
"suggestedMethodName" : "placeOrder"
|
||||
}
|
||||
],
|
||||
"testSuites" : [
|
||||
{
|
||||
"id" : 1,
|
||||
"name" : "Test User service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Create User",
|
||||
"id" : 1,
|
||||
"resourceId" : 6,
|
||||
"input" : {
|
||||
"postData":"${input.userList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Login User",
|
||||
"id" : 2,
|
||||
"resourceId" : 10,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}",
|
||||
"password":"${input.userList[0].password}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find user by name",
|
||||
"id" : 3,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.3).username}",
|
||||
"condition" : "==",
|
||||
"expectedOutput" : "${input.userList[0].username}"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Delete user by name",
|
||||
"id" : 4,
|
||||
"resourceId" : 9,
|
||||
"input" : {
|
||||
"username":"${input.userList[0].username}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.4)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 2,
|
||||
"name" : "Test Pet service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Add pet",
|
||||
"id" : 1,
|
||||
"resourceId" : 4,
|
||||
"input" : {
|
||||
"postData":"${input.petList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by id",
|
||||
"id" : 2,
|
||||
"resourceId" : 1,
|
||||
"input" : {
|
||||
"petId":"1"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Find pet by status",
|
||||
"id" : 3,
|
||||
"resourceId" : 2,
|
||||
"input" : {
|
||||
"status":"available,sold,pending"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(2.3).size}",
|
||||
"condition" : ">",
|
||||
"expectedOutput" : "0"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"id" : 3,
|
||||
"name" : "Test Store service related APIs",
|
||||
"testCases" : [
|
||||
{
|
||||
"name" : "Find order by id",
|
||||
"id" : 1,
|
||||
"resourceId" : 12,
|
||||
"input" : {
|
||||
"orderId":"1"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(3.1)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "NULL"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name" : "Place order",
|
||||
"id" : 2,
|
||||
"resourceId" : 14,
|
||||
"input" : {
|
||||
"postData":"${input.orderList[0]}"
|
||||
},
|
||||
"assertions" : [
|
||||
{
|
||||
"actualOutput" : "${output(1.2)}",
|
||||
"condition" : "!=",
|
||||
"expectedOutput" : "EXCEPTION"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package $packageName$
|
||||
|
||||
import com.wordnik.swagger.runtime.annotations._
|
||||
|
||||
import scala.reflect.BeanProperty
|
||||
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
$imports:{ import |
|
||||
import $import$
|
||||
}$
|
||||
|
||||
/**
|
||||
* $model.description$
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
*
|
||||
* @author tony
|
||||
*
|
||||
*/
|
||||
class $className$ extends $extends$ {
|
||||
|
||||
$fields:{ field |
|
||||
/**
|
||||
* $field.description$
|
||||
* $if(field.required)$@Required$endif$
|
||||
* $if(field.allowableValues)$@AllowableValues(value="$field.allowedValuesString$")$endif$
|
||||
*/
|
||||
$if(field.fieldDefinition.hasListResponse)$
|
||||
var $field.fieldDefinition.name$ $field.fieldDefinition.initialization$
|
||||
def get$field.fieldDefinition.NameForMethod$:java.util.List[$field.fieldDefinition.collectionItemType$] = {
|
||||
$field.fieldDefinition.name$.toList
|
||||
}
|
||||
def set$field.fieldDefinition.NameForMethod$(args:java.util.List[$field.fieldDefinition.collectionItemType$]) = {
|
||||
$field.fieldDefinition.name$.clear
|
||||
args.foreach(arg=>$field.fieldDefinition.name$ += arg)
|
||||
}
|
||||
$\r$
|
||||
$else$
|
||||
@BeanProperty
|
||||
var $field.fieldDefinition.name$:$field.fieldDefinition.returnType$ $field.fieldDefinition.initialization$$\r\r$
|
||||
$endif$
|
||||
}$ override def toString:String = {
|
||||
"[" +
|
||||
$fields:{ field | "$field.fieldDefinition.name$:" + $field.fieldDefinition.name$};separator=" + \r "$ + "]"
|
||||
}
|
||||
}
|
||||
@@ -1,177 +0,0 @@
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
package $packageName$
|
||||
|
||||
import $modelPackageName$._
|
||||
|
||||
import org.codehaus.jackson.map.DeserializationConfig.Feature
|
||||
import org.codehaus.jackson.map.ObjectMapper
|
||||
import org.codehaus.jackson.`type`.TypeReference
|
||||
import com.wordnik.swagger.runtime.annotations._
|
||||
import com.wordnik.swagger.runtime.common._
|
||||
import com.wordnik.swagger.runtime.exception._
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
import scala.collection.mutable._
|
||||
import scala.collection.JavaConversions._
|
||||
|
||||
$imports:{ import |
|
||||
import $import$
|
||||
}$
|
||||
|
||||
/**
|
||||
*
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
* @author tony
|
||||
*
|
||||
*/
|
||||
object $resource$ {
|
||||
|
||||
var apiInvoker:APIInvoker = null;
|
||||
|
||||
$methods:{ method |
|
||||
/**
|
||||
* $method.title$
|
||||
*
|
||||
$if(method.description)$
|
||||
* $method.description$
|
||||
* $endif$
|
||||
* $method.arguments:{ argument |@param $argument.name$ $argument.description$
|
||||
$if(argument.allowedValues)$
|
||||
* Allowed values are - $argument.allowedValues$ $endif$ }$
|
||||
$if(!method.responseVoid)$
|
||||
* @return $method.returnValue$ {@link $method.returnClassName$} $endif$
|
||||
* @throws APIException $method.exceptionDescription$
|
||||
*/
|
||||
$if(method.hasArguments)$
|
||||
@MethodArgumentNames(value="$method.argumentNames; separator=", "$")
|
||||
$endif$
|
||||
|
||||
@throws(classOf[APIException])
|
||||
def $method.name$($method.argumentDefinitions; separator=", "$)$if(method.hasResponseValue)$: $if(method.returnValueList)$$method.returnValue$$else$Option[$method.returnValue$]$endif$$endif$ = {
|
||||
//parse inputs
|
||||
var resourcePath = "$method.resourcePath$".replace("{format}","json")
|
||||
val method = "$method.methodType$";
|
||||
var queryParams = new HashMap[String, String]
|
||||
var headerParams = new HashMap[String, String]
|
||||
|
||||
$if(!method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if(null != $argument.name$) {
|
||||
queryParams += "$argument.name$" -> APIInvoker.toPathValue($argument.name$)
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if(null != $argument.name$) {
|
||||
headerParams += "$argument.name$" -> APIInvoker.toPathValue($argument.name$)
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if(null != $argument.name$) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", APIInvoker.toPathValue($argument.name$))
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
$if(method.inputModel)$
|
||||
$method.queryParameters:{ argument |
|
||||
if(null != $argument.inputModelClassArgument$ && null != $argument.methodNameFromModelClass$ ) {
|
||||
queryParams += "$argument.name$" -> APIInvoker.toPathValue($argument.methodNameFromModelClass$)
|
||||
}
|
||||
}$
|
||||
$method.headerParameters:{ argument |
|
||||
if(null != $argument.inputModelClassArgument$ && null != $argument.methodNameFromModelClass$ ) {
|
||||
headerParams += "$argument.name$" -> APIInvoker.toPathValue($argument.methodNameFromModelClass$)
|
||||
}
|
||||
}$
|
||||
$method.pathParameters:{ argument |
|
||||
if(null != $argument.inputModelClassArgument$ && null != $argument.methodNameFromModelClass$ ) {
|
||||
resourcePath = resourcePath.replace("{$argument.name$}", APIInvoker.toPathValue($argument.methodNameFromModelClass$))
|
||||
}
|
||||
}$
|
||||
$endif$
|
||||
//make the API Call
|
||||
$if(method.hasResponseValue)$
|
||||
var response: String = null
|
||||
try {
|
||||
$if(method.postObject)$
|
||||
response = apiInvoker.invokeAPI(resourcePath, method, queryParams, postData, headerParams)
|
||||
$else$
|
||||
response = apiInvoker.invokeAPI(resourcePath, method, queryParams, null, headerParams)
|
||||
$endif$
|
||||
} catch {
|
||||
case ex: APIException if ex.getCode == 404 =>
|
||||
$if(method.returnValueList)$ return List()
|
||||
$else$ return None
|
||||
$endif$
|
||||
case ex: APIException => throw ex
|
||||
}
|
||||
$else$
|
||||
$if(method.postObject)$
|
||||
apiInvoker.invokeAPI(resourcePath, method, queryParams, postData, headerParams)
|
||||
$else$
|
||||
apiInvoker.invokeAPI(resourcePath, method, queryParams, null, headerParams)
|
||||
$endif$
|
||||
$endif$
|
||||
$if(!method.responseVoid)$
|
||||
|
||||
$if(method.hasResponseValue)$
|
||||
$if(!method.returnValueList)$
|
||||
if(null == response){
|
||||
return None
|
||||
}
|
||||
$endif$
|
||||
$endif$
|
||||
$if(!method.returnValueList)$
|
||||
$if(method.hasResponseValue)$
|
||||
//create output objects if the response has more than one object
|
||||
val responseObject = APIInvoker.deserialize(response, classOf[$method.returnClassName$]).asInstanceOf[$method.returnValue$]
|
||||
|
||||
$if(method.returnValueList)$
|
||||
responseObject
|
||||
$else$
|
||||
Some(responseObject)
|
||||
$endif$
|
||||
$endif$
|
||||
$endif$
|
||||
$if(method.returnValueList)$
|
||||
val typeRef = new TypeReference[Array[$method.returnClassName$]] {}
|
||||
try {
|
||||
val responseObject = APIInvoker.mapper.readValue(response, typeRef).asInstanceOf[Array[$method.returnClassName$]]
|
||||
responseObject.toList
|
||||
} catch {
|
||||
case ioe:IOException => {
|
||||
val args = Array(response, typeRef.toString())
|
||||
throw new APIException(APIExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, args, "Error in converting response json value to java object : " + ioe.getMessage(), ioe)
|
||||
}
|
||||
case _ => throw new APIException(APIExceptionCodes.ERROR_CONVERTING_JSON_TO_JAVA, "Error in converting response json value to java object")
|
||||
}
|
||||
$endif$
|
||||
$endif$
|
||||
}
|
||||
}$
|
||||
|
||||
def getApiInvoker():APIInvoker = {
|
||||
if(null == apiInvoker){
|
||||
apiInvoker = APIInvoker.getApiInvoker();
|
||||
}
|
||||
return apiInvoker;
|
||||
}
|
||||
|
||||
def setApiInvoker(invoker:APIInvoker) = {
|
||||
apiInvoker = invoker;
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
/**
|
||||
* Copyright 2011 Wordnik, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package $packageName$
|
||||
|
||||
/**
|
||||
*
|
||||
* Maintains the compatible server version against which the drive is written
|
||||
* NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually.
|
||||
* @author tony
|
||||
*
|
||||
*/
|
||||
class VersionChecker {
|
||||
var compatibleVersion = "$apiVersion$"
|
||||
|
||||
/**
|
||||
* Gets the version against which the library code was written
|
||||
*/
|
||||
def getCompatibleVersion():String = compatibleVersion
|
||||
}
|
||||
80
modules/swagger-codegen-distribution/pom.xml
Normal file
80
modules/swagger-codegen-distribution/pom.xml
Normal file
@@ -0,0 +1,80 @@
|
||||
<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">
|
||||
<parent>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-codegen-project</artifactId>
|
||||
<version>2.1.1-M1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-codegen-distribution</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-codegen (executable)</name>
|
||||
<version>2.1.1-M1</version>
|
||||
<build>
|
||||
<testSourceDirectory>src/test/scala</testSourceDirectory>
|
||||
<outputDirectory>target/classes</outputDirectory>
|
||||
<testOutputDirectory>target/test-classes</testOutputDirectory>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<directory>target</directory>
|
||||
<finalName>${project.artifactId}-${project.version}</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<mainClass>com.wordnik.swagger.codegen.Codegen</mainClass>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<minimizeJar>false</minimizeJar>
|
||||
<createDependencyReducedPom>true</createDependencyReducedPom>
|
||||
<dependencyReducedPomLocation>
|
||||
${java.io.tmpdir}/dependency-reduced-pom.xml
|
||||
</dependencyReducedPomLocation>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-codegen</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
public class Readme {
|
||||
public String getInfo() {
|
||||
return "See the documentation for swagger-codegen";
|
||||
}
|
||||
}
|
||||
341
modules/swagger-codegen/pom.xml
Normal file
341
modules/swagger-codegen/pom.xml
Normal file
@@ -0,0 +1,341 @@
|
||||
<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">
|
||||
<parent>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-codegen-project</artifactId>
|
||||
<version>2.1.1-M1</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.wordnik</groupId>
|
||||
<artifactId>swagger-codegen</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<name>swagger-codegen (core library)</name>
|
||||
<version>2.1.1-M1</version>
|
||||
<build>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
<defaultGoal>install</defaultGoal>
|
||||
<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>com.wordnik.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>
|
||||
<configuration>
|
||||
<recompileMode>incremental</recompileMode>
|
||||
</configuration>
|
||||
<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>com.wordnik</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>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<configuration>
|
||||
<releaseProfiles>release</releaseProfiles>
|
||||
<goals>sign</goals>
|
||||
</configuration>
|
||||
</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 />
|
||||
</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>
|
||||
</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>
|
||||
</dependencies>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>sonatype-snapshots</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
</repository>
|
||||
</repositories>
|
||||
</project>
|
||||
@@ -0,0 +1,104 @@
|
||||
/**
|
||||
* Copyright 2015 Reverb, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
import com.wordnik.swagger.codegen.ClientOpts;
|
||||
import com.wordnik.swagger.annotations.*;
|
||||
import com.wordnik.swagger.models.Swagger;
|
||||
import com.wordnik.swagger.models.auth.AuthorizationValue;
|
||||
|
||||
import java.util.*;
|
||||
import java.net.URLEncoder;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
public class ClientOptInput {
|
||||
private ClientOpts opts;
|
||||
private Swagger swagger;
|
||||
private List<AuthorizationValue> auths;
|
||||
protected CodegenConfig config;
|
||||
|
||||
public ClientOptInput swagger(Swagger swagger) {
|
||||
this.setSwagger(swagger);
|
||||
return this;
|
||||
}
|
||||
public ClientOptInput opts(ClientOpts opts) {
|
||||
this.setOpts(opts);
|
||||
return this;
|
||||
}
|
||||
|
||||
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 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 List<AuthorizationValue> getAuthorizationValues() {
|
||||
return auths;
|
||||
}
|
||||
|
||||
public CodegenConfig getConfig() {
|
||||
return config;
|
||||
}
|
||||
public void setConfig(CodegenConfig config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void setOpts(ClientOpts opts) {
|
||||
this.opts = opts;
|
||||
}
|
||||
|
||||
public ClientOpts getOpts() {
|
||||
return opts;
|
||||
}
|
||||
|
||||
public void setSwagger(Swagger swagger) {
|
||||
this.swagger = swagger;
|
||||
}
|
||||
|
||||
@ApiModelProperty(dataType="Object")
|
||||
public Swagger getSwagger() {
|
||||
return swagger;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
import com.wordnik.swagger.codegen.auth.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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,138 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
import com.wordnik.swagger.codegen.languages.*;
|
||||
import com.wordnik.swagger.models.Swagger;
|
||||
import com.wordnik.swagger.models.auth.AuthorizationValue;
|
||||
import com.wordnik.swagger.util.*;
|
||||
|
||||
import io.swagger.parser.SwaggerParser;
|
||||
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
public class Codegen extends DefaultGenerator {
|
||||
static Map<String, CodegenConfig> configs = new HashMap<String, CodegenConfig>();
|
||||
static String configString;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
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", false, "addes 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());
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
import com.wordnik.swagger.models.*;
|
||||
import com.wordnik.swagger.models.properties.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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 toModelName(String name);
|
||||
String toParamName(String name);
|
||||
String escapeReservedWord(String name);
|
||||
String getTypeDeclaration(Property p);
|
||||
String getTypeDeclaration(String name);
|
||||
void processOpts();
|
||||
|
||||
Set<String> reservedWords();
|
||||
|
||||
List<SupportingFile> supportingFiles();
|
||||
|
||||
void setOutputDir(String dir);
|
||||
String getOutputDir();
|
||||
|
||||
CodegenModel fromModel(String name, Model model);
|
||||
CodegenOperation fromOperation(String resourcePath, String httpMethod, Operation operation);
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
import com.wordnik.swagger.models.*;
|
||||
import com.wordnik.swagger.models.properties.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
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;
|
||||
public ExternalDocs externalDocs;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.wordnik.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,20 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
public enum CodegenModelType {
|
||||
|
||||
MODEL(CodegenModel.class),
|
||||
OPERATION(CodegenOperation.class),
|
||||
PARAMETER(CodegenParameter.class),
|
||||
PROPERTY(CodegenProperty.class),
|
||||
RESPONSE(CodegenResponse.class);
|
||||
|
||||
private final Class<?> defaultImplementation;
|
||||
|
||||
private CodegenModelType(Class<?> defaultImplementation) {
|
||||
this.defaultImplementation = defaultImplementation;
|
||||
}
|
||||
|
||||
public Class<?> getDefaultImplementation() {
|
||||
return defaultImplementation;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
import com.wordnik.swagger.models.*;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class CodegenOperation {
|
||||
public Boolean hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
|
||||
returnSimpleType, subresourceOperation, isMapContainer, isListContainer;
|
||||
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<String> tags;
|
||||
public List<CodegenResponse> responses = new ArrayList<CodegenResponse>();
|
||||
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||
public Set<String> imports = new HashSet<String>();
|
||||
public List<Map<String, String>> examples;
|
||||
public ExternalDocs externalDocs;
|
||||
|
||||
// legacy support
|
||||
public String nickname;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.wordnik.swagger.codegen;
|
||||
|
||||
public class CodegenParameter {
|
||||
public Boolean isFormParam, isQueryParam, isPathParam, isHeaderParam,
|
||||
isCookieParam, isBodyParam, isFile, notFile, hasMore, isContainer, secondaryParam;
|
||||
public String baseName, paramName, dataType, collectionFormat, description, baseType;
|
||||
/**
|
||||
* 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;
|
||||
|
||||
return output;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user