Compare commits

..

845 Commits

Author SHA1 Message Date
Tony Tam
2ed68c2df8 version 2.0.17 2014-08-26 16:52:26 -07:00
Tony Tam
db1915ec89 Merge pull request #252 from earldouglas/path-not-optional
Drop the 'optional' param for path params
2014-08-26 14:40:14 -07:00
James Earl Douglas
77e9ce5ede Drop the 'optional' param for path params 2014-08-26 14:38:27 -07:00
Tony Tam
013c19eb36 Merge pull request #251 from earldouglas/not-so-required
Set param as 'required' iff required, else set as 'optional'
2014-08-26 14:33:00 -07:00
James Earl Douglas
61c04ddaf1 Set param as 'required' iff required, else set as 'optional' 2014-08-26 14:31:45 -07:00
Tony Tam
b4d361130c Merge pull request #247 from xoom/issues/java_pom
Issues/java pom - remove scala dependencies from Java pom files
2014-08-25 23:05:04 -07:00
Tony Tam
8e7571c34f Merge pull request #248 from xhh/patch-1
Fixes #242 - Ruby model syntax error
2014-08-25 23:03:45 -07:00
xhh
1ba42ef6cc Fixes #242 - Ruby model syntax error 2014-08-26 09:18:54 +08:00
Rob Blair
fc77521d49 Simplify java sample poms.
* remove scala references from the java client pom template files.
* regenerate the petstore sample pom.xml, verify they can build properly.
2014-08-25 17:37:36 -07:00
Rob Blair
1522069281 Regenerate the java code before modifying templates 2014-08-25 17:35:44 -07:00
Tony Tam
a13f46e781 Merge pull request #245 from ganeshs/master
Added import mappings for java.util.Set and java.sql.Timestamp
2014-08-20 23:43:05 -07:00
Ganesh Subramanian
3ad1ecf153 Added import mapping for Timestamp 2014-08-21 12:11:19 +05:30
Ganesh Subramanian
6087181634 Added import mapping for Timestamp 2014-08-21 12:10:14 +05:30
Ganesh Subramanian
c09adc4539 Fix for issue #226 2014-08-21 12:01:44 +05:30
Tony Tam
a626dea181 Update api.mustache 2014-08-11 08:58:45 -07:00
Tony Tam
454ec4b438 fix for #235 2014-08-08 16:38:38 -04:00
Ivan Porto Carrero
c7da910e68 remove sample files again 2014-08-05 10:56:20 -07:00
Ivan Porto Carrero
40d33693cf add typesafe releases resolver, fixes #232 2014-08-05 10:43:28 -07:00
Tony Tam
13eaf2bf63 Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-08-03 09:19:01 -07:00
Tony Tam
d4508ed112 updated resolvers 2014-08-03 09:16:30 -07:00
Tony Tam
c252e9f7c6 added sonatype as resolver 2014-08-03 09:12:16 -07:00
Tony Tam
6690b80b29 Update .travis.yml 2014-08-02 16:32:10 -07:00
Tony Tam
19bb97a725 updated travis to 2.10.4 2014-08-02 16:09:00 -07:00
Tony Tam
62ee62ebd3 Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-08-02 16:04:55 -07:00
Tony Tam
87083034ee Merge pull request #215 from JDiPierro/fix_java_generator_lists
Use config.processResponseClass to determine type of returnContainer
2014-07-24 11:48:19 -07:00
Tony Tam
d9de57da6f Merge pull request #223 from darkcube/master
CSharp: Multipart form submission
2014-07-23 08:43:37 -04:00
Timothy Lusk
d0b0323925 CSharp: Implement multipart form submission 2014-07-22 17:17:54 -04:00
Tony Tam
f592414409 Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-07-18 09:52:57 -06:00
Tony Tam
e1c8f58d28 added 2.10.4 2014-07-18 09:52:53 -06:00
Tony Tam
4870ed7e51 Merge pull request #220 from darkcube/master
CSharp Changes
2014-07-16 16:30:15 -06:00
Timothy Lusk
bbe48814b4 CSharp: Add optional api constructor argument to set the basePath 2014-07-15 15:41:57 -04:00
Timothy Lusk
3b6ffa4a1f CSharp: Close the WebResponse if we throw an ApiException 2014-07-15 15:41:56 -04:00
Tony Tam
527c40b996 Merge pull request #211 from wcandillon/patch-1
Link back to the swagger-js-codegen project
2014-07-13 07:21:22 -07:00
Justin DiPierro
e2a20447df Fixed comment in test 2014-07-10 10:02:18 -04:00
Tony Tam
5d42c8cc5f moved to petstore 2014-07-04 10:19:48 -07:00
Tony Tam
256485ec5b updated template 2014-07-04 10:19:28 -07:00
Tony Tam
7ab0394e76 added node.js instead of jetty 2014-07-04 10:19:09 -07:00
Tony Tam
89b04b2e10 formatting 2014-07-04 10:18:44 -07:00
Tony Tam
a019a438e0 changed to petstore sample 2014-07-04 10:08:54 -07:00
Justin DiPierro
9834059786 Fixed BasicScalaGeneratorTest to expect Some(List) 2014-07-03 11:32:37 -04:00
Justin DiPierro
550fade9e0 Codegen.apiToMap should use config.processResponseClass when setting the returnContainer property. Test passes now 2014-07-03 11:24:05 -04:00
Justin DiPierro
aa1b4fc0fb Wrote failing test for Codegen 2014-07-03 11:23:07 -04:00
Tony Tam
5a659803a8 Merge pull request #212 from darkcube/master
Various csharp codegen fixes
2014-06-29 13:59:21 -07:00
Timothy Lusk
7bc7789e81 CSharp: Invoker should handle WebException and rethrow ApiException 2014-06-27 17:55:10 -04:00
Timothy Lusk
cf0721da73 CSharp: Use nullable primitive types to allow optional parameters 2014-06-27 16:10:45 -04:00
Timothy Lusk
dcbf4d1bfd CSharp: Use the correct model package name 2014-06-27 16:01:24 -04:00
William Candillon
017b578502 Link back to the swagger-js-codegen project 2014-06-26 15:05:33 +02:00
Tony Tam
58bade3b01 Update README.md 2014-06-19 09:33:41 -07:00
Tony Tam
02631e674a Merge pull request #207 from emmekappa/master
Fixing extensions and namespaces for csharp common files.
2014-06-17 10:53:17 -07:00
Michele Cantelli
5f5e534d05 CSharp: renaming the "packages" to follow the .NET style. 2014-06-17 16:22:04 +02:00
Michele Cantelli
51deeb478d Fixing extensions for csharp common files. 2014-06-17 15:18:58 +02:00
Tony Tam
acff8229b3 Merge pull request #206 from xoom/issue/modelsFromStatus
Issue/models from status - utilize the responseModel, if present
2014-06-16 17:03:17 -07:00
Rob Blair
233555790a Regenerate sample java files with example response status codes
* none of existing examples use the responseMessage.responseModel feature, but I have tested it.
* Didn't want to muck with sample json
* update the scripts used to generate both java versions.
* see https://github.com/wordnik/swagger-spec/blob/master/versions/1.2.md#525-response-message-object
2014-06-16 12:59:53 -07:00
Rob Blair
d5ddac8e7e Update java mustache to show error status codes and models in generated API, in comments.
* I wonder if there is some clever way to make exceptions based on the model thrown, and automatically fill them in with the parsed error models?
* Until then, it's comments, and roll your own.
2014-06-16 12:51:35 -07:00
Rob Blair
e8210cd5e3 allow list of models to be returned in errors
* for example, a list of validation errors with an exceptional status
2014-06-16 12:40:44 -07:00
Rob Blair
2dc6b485e0 Generate classes from the models declared in 'responseModel'
* ResponseMessage has new constructor parameter, an optional string for responseModel
* Make sure we add it to list of models
* make sure the responseModel is part of the error list available to mustache
2014-06-16 12:34:44 -07:00
Tony Tam
11bede2b7d improved validation messages 2014-06-12 00:45:27 -07:00
Tony Tam
ed51dd9dea added files 2014-06-11 06:41:59 -07:00
Tony Tam
218f514005 updated node sample 2014-06-11 06:41:31 -07:00
Tony Tam
209e8e066c Merge pull request #201 from xoom/issue/JavaSafeApiName
coerce API names for classesand files to valid Java names
2014-06-11 06:12:55 -07:00
Tony Tam
7d05b01a56 Merge pull request #202 from gonimar/patch-1
Unused local variable 'json_data'.
2014-06-11 06:12:36 -07:00
Tony Tam
64f6bedc37 Merge branch 'repackage' 2014-06-11 06:12:15 -07:00
Tony Tam
4ae4aa98bb formatting 2014-06-11 06:11:45 -07:00
Tony Tam
db8bda087b made nickname optional 2014-06-11 06:11:31 -07:00
Tony Tam
06eb52118e updated to 2.3.0 release 2014-06-11 06:03:44 -07:00
Tony Tam
63be7d0069 removed println 2014-06-11 05:50:44 -07:00
Tony Tam
c7468125fa added clientName 2014-06-10 20:37:36 -07:00
Tony Tam
7b3d8bf799 added file upload support 2014-06-10 20:37:24 -07:00
Tony Tam
c4913fe583 wrapped in apiInfo 2014-06-10 20:37:08 -07:00
Tony Tam
d3339cb087 fixed string default 2014-06-10 20:36:58 -07:00
Tony Tam
ba4fda12dc added additional params 2014-06-10 20:36:29 -07:00
Tony Tam
7a6d6d27ff enabled logging 2014-06-10 20:36:10 -07:00
Tony Tam
bcabb03225 added support for nickname generation 2014-06-10 20:05:19 -07:00
Tony Tam
a404823c54 updated copyright 2014-06-10 17:23:35 -07:00
Tony Tam
96ea70e3c9 added className key 2014-06-10 17:23:20 -07:00
Tony Tam
9a01331ddd updated copyright 2014-06-10 16:58:43 -07:00
Tony Tam
3bfa468ed1 fixed filemap 2014-06-10 16:57:39 -07:00
Tony Tam
fdf8572535 updated copyright 2014-06-10 16:57:12 -07:00
Tony Tam
cff8b1552d updated copyright 2014-06-10 16:57:01 -07:00
Tony Tam
e73dd0a7c4 updated copyrights 2014-06-10 16:56:06 -07:00
Tony Tam
9c4c2dfd37 updated copyrights 2014-06-10 16:55:57 -07:00
Tony Tam
2f8355c953 regenerated client 2014-06-10 16:55:34 -07:00
Tony Tam
3f480482b6 regenerated client 2014-06-10 16:55:17 -07:00
Tony Tam
8274196999 regenerated client 2014-06-10 16:55:13 -07:00
Tony Tam
4e8c71f754 regenerated client 2014-06-10 16:54:48 -07:00
Tony Tam
57e7b41e9c regenerated client 2014-06-10 16:52:16 -07:00
Tony Tam
58d9894f1f regenerated client 2014-06-10 16:51:41 -07:00
Tony Tam
4b4d4d32cd regenerated client 2014-06-10 16:51:36 -07:00
Tony Tam
6a2ea9f614 regenerated client 2014-06-10 16:51:10 -07:00
Tony Tam
0d6754e167 regenerated client 2014-06-10 16:50:17 -07:00
Tony Tam
cb5c2a9708 regenerated client 2014-06-10 16:48:27 -07:00
Tony Tam
dc8ad7edf5 updated client 2014-06-10 16:48:05 -07:00
Tony Tam
52bc82149f file rename 2014-06-10 16:34:40 -07:00
Tony Tam
f53b5e27e0 updated scalatra version, templates for files, forms 2014-06-10 15:51:15 -07:00
Tony Tam
ce5be3452c added patch class 2014-06-10 15:50:49 -07:00
Tony Tam
ce14c225e5 added patch 2014-06-10 10:36:46 -07:00
Tony Tam
b78721826e regenerated client 2014-06-10 10:36:13 -07:00
Tony Tam
85113df113 regenerated client 2014-06-10 08:41:44 -07:00
Tony Tam
607b56cb87 removed println 2014-06-10 08:40:19 -07:00
Tony Tam
2dbf8b7d41 regenerated 2014-06-10 08:40:03 -07:00
Tony Tam
7d4c10043d updated client 2014-06-10 08:22:40 -07:00
Tony Tam
64604124c9 added array support 2014-06-10 08:22:08 -07:00
Tony Tam
50f20ad836 updated templates 2014-06-10 08:21:51 -07:00
Tony Tam
ac40283501 updated samples 2014-06-10 08:01:53 -07:00
Sergey Gonimar
e03d4fc1a5 Unused local variable 'json_data'.
The value of the variable is not used anywhere.
2014-06-10 19:25:00 +06:00
Rob Blair
05e9443db5 coerce API names of class and file valid Java names
* Swagger allows names of apis to include characters like '-' Java does not like that
* use same replace strings as used in toVarName
2014-06-09 17:04:57 -07:00
Tony Tam
1250cc758f updated version 2014-06-09 16:34:42 -07:00
Tony Tam
a18784da6c updated file maps 2014-06-09 15:05:23 -07:00
Tony Tam
c87d637edd regenerated 2014-06-06 00:27:40 -07:00
Tony Tam
bf4a4e5296 fixed imports, nesting 2014-06-06 00:27:15 -07:00
Tony Tam
4f7b80dad2 added debug, fixed headers 2014-06-05 22:49:09 -07:00
Tony Tam
8a2f9bc7bb compatibility 2014-06-05 20:08:59 -07:00
Tony Tam
b9806c183b fixed case 2014-06-05 20:08:37 -07:00
Tony Tam
5aa4c4c999 made snapshot 2014-05-31 16:04:19 -07:00
Tony Tam
424cfac80f updated config 2014-05-30 16:27:54 -07:00
Ivan Porto Carrero
715913f3b4 Update slightly add some test files 2014-05-30 15:17:53 -07:00
Tony Tam
1c2c4fdcd3 removed function override 2014-05-30 15:03:10 -07:00
Ivan Porto Carrero
2ea6c2a3a7 Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-05-30 14:25:57 -07:00
Tony Tam
d91da857a0 removed unused code 2014-05-30 09:59:27 -07:00
Tony Tam
31e65969b3 removed printlns, cruft 2014-05-30 07:53:27 -07:00
Tony Tam
df250bc056 fixed model mapping, refactoring the processing of apiMap and modelMap so it's executed just once 2014-05-30 07:29:19 -07:00
Tony Tam
1569274684 fixed package 2014-05-20 00:14:01 -07:00
Tony Tam
6d8f751da4 added model package 2014-05-19 23:23:23 -07:00
Tony Tam
c2dd00a4ab fixed return type 2014-05-19 15:08:44 -07:00
Tony Tam
9e6ae6eef8 added opts for input 2014-05-15 08:51:41 -04:00
Tony Tam
58b985ba02 moved packages to address collisions with swagger-core per #145 2014-05-14 18:23:32 -04:00
Tony Tam
b4f3143c8c Merge pull request #159 from yanoosh/php-fix-sanitize
PHP - Improved/fixed serialization and deserialize.
2014-05-01 20:31:13 -07:00
Tony Tam
84ad6b5d50 rebuilt docs 2014-05-01 20:19:40 -07:00
Tony Tam
32c14af5ce added resize 2014-05-01 20:18:23 -07:00
Tony Tam
46023c47f5 Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-05-01 20:17:53 -07:00
Tony Tam
71212e5f68 reverted to artifactVersion 2014-05-01 20:16:46 -07:00
Tony Tam
6d1c34048c fix for #176 2014-05-01 20:16:27 -07:00
Tony Tam
f67006057e updated version 2014-05-01 20:14:41 -07:00
Tony Tam
e1e397a7b5 Merge pull request #179 from j-unior/scala-2.10
Added scala 2.10 support in generated maven profile.
2014-05-01 18:03:22 -07:00
Tony Tam
0f35799a77 fixed start script #188 2014-04-29 09:46:49 -07:00
Tony Tam
be44221d98 Merge pull request #187 from earldouglas/return-generated-files
Return files generated from BasicGenerator#generateClientWithoutExit
2014-04-24 16:06:12 -07:00
James Earl Douglas
94ad254a58 Return files generated from BasicGenerator#generateClientWithoutExit 2014-04-24 15:14:41 -07:00
James Earl Douglas
666a4be1f2 Return files generated from Codegen#writeSupportingClasses 2014-04-24 15:12:11 -07:00
James Earl Douglas
e542fbd0a2 De-duplicate code from Codegen#writeSupportingClasses 2014-04-24 15:07:45 -07:00
Pat
f4b2d13aa4 Update README.md 2014-04-09 10:15:08 -07:00
j-unior
abcae6da96 Added scala 2.10 support in generated maven profile. You can enable it with mvn install -P scala_2.10 on generated client 2014-04-01 16:56:08 +03:00
Tony Tam
1b9b3eaa8e Merge pull request #175 from STEAMULO/master
Filename misprint for Android generation
2014-03-25 11:33:03 -07:00
aansel
0babc4f192 Filename misprint for Android generation 2014-03-25 18:44:05 +01:00
webron
e51ffb37b4 Update README.md 2014-03-23 13:16:02 +02:00
Tony Tam
2fba96713c Merge pull request #172 from giovannibotta/master
Minor change to map used when generating supporting files
2014-03-19 08:27:49 -07:00
giodude
dccf8edc25 Minor change to map used when generating supporting files. 2014-03-19 11:18:23 -04:00
webron
d98aeac818 Create LICENSE 2014-03-19 16:08:55 +02:00
webron
62bfc4ea19 Update README.md
Updated license year.
2014-03-19 16:08:38 +02:00
Tony Tam
8d74029fba Merge pull request #170 from hsanjuan/master
Issue #168: Let runscala.sh run from everywhere without breaking
2014-03-18 18:54:28 -07:00
Hector Sanjuan
809cb5cf1f Issue #168: Let runscala.sh run from everywhere without breaking and correctly
setting the classpath
2014-03-17 16:21:36 +01:00
Tony Tam
a4196609c9 added friendly error message when SSL validation fails 2014-03-06 08:29:02 -08:00
Tony Tam
e7eedcf48d removed printlns 2014-03-05 07:54:12 -08:00
Tony Tam
8bf042b153 updated sample with form param support 2014-03-05 07:54:03 -08:00
Tony Tam
8325a12faf fixed hasMore 2014-03-04 20:05:16 -08:00
Tony Tam
03abccd8e8 fix for #154 2014-03-04 19:48:13 -08:00
Janusz Jablonski
19e79fedb2 Added backslash before DateTime object. 2014-03-03 00:40:45 +01:00
Tony Tam
71eacaa3b1 Merge pull request #160 from yanoosh/php-removed-escape
PHP - Removed escapeReservedWord method.
2014-03-02 13:30:08 -08:00
Janusz Jablonski
7cfa46d838 Removed escapeReservedWord method. 2014-03-02 18:31:35 +01:00
Janusz Jablonski
7989e78460 Improved/fixed serialization and deserialize. 2014-03-02 14:44:46 +01:00
Tony Tam
08466f615f Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-02-25 12:54:12 -08:00
Tony Tam
880d14990f added patch support 2014-02-25 12:53:11 -08:00
Tony Tam
39ac8f6d46 added patch support 2014-02-25 12:52:49 -08:00
Tony Tam
685fc7066f Update README.md 2014-02-22 07:21:13 -08:00
Tony Tam
127600e728 Update README.md 2014-02-21 17:29:22 -08:00
Tony Tam
d764328026 updated readme 2014-02-21 17:22:48 -08:00
Tony Tam
cae8296999 updated readme 2014-02-21 17:21:56 -08:00
Tony Tam
86efb71124 updated readme 2014-02-21 17:21:50 -08:00
Tony Tam
0899b08b8c Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-02-21 17:20:16 -08:00
Tony Tam
a770db9d3e added readme 2014-02-21 17:20:06 -08:00
Tony Tam
87b5c43166 Merge pull request #158 from mkantor/objc-safe-var-names
Prevent ObjC generator from producing invalid var names.
2014-02-21 13:41:26 -08:00
Matt Kantor
d14ab2aeff Prevent ObjC generator from producing invalid var names. 2014-02-21 13:35:13 -08:00
Tony Tam
5e95362542 added files 2014-02-20 21:09:48 -08:00
Tony Tam
e92d4e6258 updated sample 2014-02-19 16:46:11 -08:00
Tony Tam
641aada8a8 updated templates 2014-02-19 15:08:06 -08:00
Tony Tam
c8c59fe93a manual merge of https://github.com/wordnik/swagger-codegen/pull/135 2014-02-19 14:30:49 -08:00
Tony Tam
450746f94d updated jodatime version, added groupId and artifactId params 2014-02-19 14:30:20 -08:00
Tony Tam
827f03f272 Merge pull request #157 from df-jsykes/master
fix for broken links when using file system to browse
2014-02-19 12:40:03 -08:00
Jason Sykes
de6f949c64 fix for broken links when using file system to browse 2014-02-19 15:37:07 -05:00
Tony Tam
82cdec7197 Merge pull request #107 from SimonKaluza/patch-1
Update Objective-C's run-time type-check in SWGApiClient to allow NSArrays
2014-02-19 12:30:32 -08:00
Tony Tam
ab7e152877 Merge pull request #139 from cb372/pass-version-to-mustache
Add the API version to the Mustache model when generating supporting files
2014-02-19 12:24:09 -08:00
Tony Tam
0ec694940e fixed target directory 2014-02-19 12:16:31 -08:00
Tony Tam
5a4af29f0e fix for #156 2014-02-19 12:15:50 -08:00
Tony Tam
d72578e492 removed .yml suffix 2014-02-19 12:13:51 -08:00
Tony Tam
405e8b1786 Merge pull request #151 from yanoosh/accepts-header
Added consumes and produces to php templates.
2014-02-11 22:32:29 -08:00
Janusz Jabłoński
8909bd4ba1 Added consumes and produces to php templates. 2014-02-11 12:42:30 +01:00
Tony Tam
e9af56eb87 Update README.md 2014-02-06 18:14:17 -08:00
Tony Tam
ee361e9ae2 Merge pull request #150 from msolujic/master
Added 'char' and 'short' to alowed special words for Java generator.
2014-02-06 18:07:22 -08:00
msolujic
a580c38fed Added 'char' and 'short' to alowed special words for Java generator. 2014-02-07 02:53:09 +01:00
Tony Tam
668059a2c4 added travis build file 2014-02-05 09:08:14 -08:00
Tony Tam
31a53d5842 fix for #147 2014-02-05 08:59:28 -08:00
Tony Tam
e4e768062a Merge pull request #142 from bkowalik/master
BasicGenerator refactoring
2014-02-03 23:16:05 -08:00
Tony Tam
3192240dc0 Merge pull request #126 from cb372/joda-time-dependency
Add joda-time support to BasicJavaGenerator
2014-02-03 22:36:39 -08:00
Tony Tam
2d9a011f82 Merge pull request #133 from giodude/master
Explicitly defined type of a few properties
2014-02-03 22:36:01 -08:00
Tony Tam
476aed7f5b Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-02-03 17:31:35 -08:00
Tony Tam
09580c2d87 added publish fat jar 2014-02-03 17:31:19 -08:00
Bartosz Kowalik
48a07d031e BasicGenerator refactoring 2014-01-30 10:36:36 +01:00
Tony Tam
7414a9d56a Merge pull request #141 from radius314/master
Fix for non-GET verbs
2014-01-29 17:37:07 -08:00
Tony Tam
91e08b5524 fix for #140 2014-01-29 17:14:28 -08:00
Danny Gershman
8abb6521b4 removed line break 2014-01-29 19:45:24 -05:00
Danny Gershman
6394e5448c the verb wasn’t being set for web client, thus non GETs would probably always fail 2014-01-29 19:35:54 -05:00
Chris Birchall
2f5651d988 Add the API version to the Mustache model when generating supporting files.
This makes it easy to generate a client with version numbering in sync
with the server's advertised API version.
2014-01-28 15:44:38 +09:00
Tony Tam
a7afbd106f Merge pull request #138 from radonsky/add_getter_and_setter_to_parameters
added “getter” and “setter” to operation parameter properties
2014-01-27 14:31:48 -08:00
Marek Radonsky
d67774d90f added “getter” and “setter” to operation parameter properties 2014-01-27 13:56:28 -08:00
Tony Tam
07f36d3500 Merge pull request #137 from radonsky/clone_required_parameters
clone the parameter map when creating list of required parameters
2014-01-27 13:22:06 -08:00
Marek Radonsky
cc1bcf7989 clone the parameter map when creating list of required parameters 2014-01-27 13:11:20 -08:00
Tony Tam
096653daf7 removed old pom 2014-01-27 07:50:38 -08:00
Tony Tam
773a6b50eb fixed scala-reflect library inclusion 2014-01-27 07:50:23 -08:00
Tony Tam
bb3bd0d357 regenerated clients 2014-01-27 07:49:58 -08:00
Tony Tam
16eb944d2f Merge branch 'master' of github.com:wordnik/swagger-codegen 2014-01-27 07:48:44 -08:00
Tony Tam
74df3ab4f7 fix for csharp array response type 2014-01-27 07:48:29 -08:00
Chris Birchall
d18e75bbf1 Fixup: change spaces to tab 2014-01-26 11:34:04 +09:00
Chris Birchall
b7cffe4121 Add and register Jackson Joda-Time module 2014-01-26 11:31:08 +09:00
Tony Tam
5180b09acb Merge pull request #134 from bkowalik/master
Lack of models description bugfix
2014-01-24 10:44:45 -08:00
Bartosz Kowalik
6fad954147 Lack of models description bugfix 2014-01-24 19:33:50 +01:00
Giovanni Botta
3b1eac0e50 Explicitly defined type of a few properties
As per [this issue](https://github.com/wordnik/swagger-codegen/issues/130) this change makes the signature of those three properties consistent with their superclass so that traits assuming that signature can be mixed in.
2014-01-24 09:37:03 -05:00
Tony Tam
7715dbf0f2 Merge pull request #132 from gyeh/master
Fix docs to point to correct swagger spec URL
2014-01-22 13:45:48 -08:00
gyeh
bbb682c13d Fix docs to point to correct swagger spec URL 2014-01-22 12:01:44 -08:00
Tony Tam
42a8514c22 updated to scalatra 2.3 2014-01-21 09:40:42 -08:00
Tony Tam
ffca1e2969 updated listings 2014-01-21 09:39:30 -08:00
Tony Tam
1aa65bc14b Merge pull request #131 from cb372/fix-auth-deser
Fix deserialization of "authorizations" fields
2014-01-21 09:36:56 -08:00
Chris Birchall
1f46819b61 Fix deserialization of "authorizations" fields
Deserializer should expect a Map[String, AuthorizationType], not a
List[String].
2014-01-21 20:17:34 +09:00
Tony Tam
5892fdb2bb manual merge of #125 2014-01-16 20:34:26 -08:00
Tony Tam
32d792de01 Merge pull request #122 from vaelen/android-ignore-ssl-certificates
Update android target to work with self signed certificates if needed.
2014-01-16 20:30:19 -08:00
Tony Tam
82646f34ca Merge pull request #108 from backstop/generate-client-without-exit
Extract actual work from generateClient so that we can call it without killing the JVM.
2014-01-16 20:29:27 -08:00
Tony Tam
4f25ea7e6b Merge pull request #127 from cb372/fix-pom-fields
Improve groupId, artifactId, name in generated pom.xml
2014-01-16 20:19:25 -08:00
Chris Birchall
146f5c4c2a Improve groupId, artifactId, name in generated pom.xml
1. Replace hardcoded groupId (`com.wordnik`) with `package` variable.

2. artifactId and name were using non-existent variable `artifactId`.
This results in an empty artifactId, which makes Maven puke.
Replaced them with a sensible hardcoded value, "api-client".
2014-01-17 11:39:22 +09:00
Chris Birchall
6b9cba1411 Add joda-time support to BasicJavaGenerator
* Add joda-time as a dependency in pom.xml
* Add import mappings for commonly used joda-time classes
2014-01-17 10:34:19 +09:00
Tony Tam
a413efc3ca Merge pull request #121 from vaelen/fix-android-param-names
Fixes a bug where the wrong name was being used for header parameters in the Android code generator.
2014-01-16 13:36:57 -08:00
Tony Tam
6c8aed5dcc Merge pull request #112 from vaelen/fix-no-content
Updated Java client to handle the case of a NO_CONTENT response.
2014-01-16 13:36:06 -08:00
Andrew Young
52905fd6de Adds http scheme back in. 2014-01-08 16:32:30 -08:00
Andrew Young
f8807c7440 Code cleanup. 2014-01-08 16:32:13 -08:00
Andrew Young
755591f9e5 Updates the android target to use a version of HttpClient that is closer
to the version shipped with Android.  Also adds support for skipping SSL
certificate verifcation.  This allows the client to be used with self
signed certificates.

Conflicts:
	src/main/resources/android-java/apiInvoker.mustache
2014-01-08 16:31:50 -08:00
Andrew Young
896d0d4b54 [#61769706] Fixes a bug where the wrong name was being used for header
parameters in the Android code generator.
2014-01-06 22:54:42 -08:00
Tony Tam
cf95d4e59e added android sample 2014-01-06 12:27:57 -08:00
Tony Tam
b503994577 added android sample 2014-01-06 12:27:31 -08:00
Tony Tam
569f77b512 added yml2swagger 2013-12-20 16:42:59 -08:00
Tony Tam
773fb89acb Merge pull request #111 from RobBlairInq/issues/67
Issues/67 - generate expected exceptions in java templates when parameters are missing
2013-12-04 23:32:11 -08:00
Tony Tam
890b1ee3c2 updated package 2013-12-03 12:15:20 -08:00
Andrew Young
bfb5b721c5 Merge remote-tracking branch 'upstream/master' into fix-no-content
Conflicts:
	samples/client/petstore/java/src/main/java/com/wordnik/client/ApiInvoker.java
2013-12-02 13:42:15 -08:00
Robert Blair
9b6995f28c Merge branch 'master' into issues/67 2013-11-29 10:49:48 -08:00
Tony Tam
1b8bb4a0a6 rebuilt client 2013-11-28 13:28:26 -10:00
Tony Tam
7f35b875a4 Merge branch 'issues/91' of git://github.com/RobBlairInq/swagger-codegen into RobBlairInq-issues/91 2013-11-28 10:56:36 -10:00
Tony Tam
b5d2ed0322 Merge pull request #113 from RobBlairInq/issues/rebuildall
add script to run all the sample build scripts
2013-11-28 11:01:37 -08:00
Robert Blair
a7b78a6210 add script to run all the sample build scripts 2013-11-27 20:30:31 -08:00
Robert Blair
90c14fd116 issue/91 - and also check in the generated fils 2013-11-27 20:04:57 -08:00
Robert Blair
830ad87fcb issues/91 - enum in model commented out by default 2013-11-27 18:03:57 -08:00
Rob Blair
3a8928f869 issues/91 - regenerate petstore java files 2013-11-27 14:19:56 -08:00
Rob Blair
f883c5e77c issues/91 - allow enum and min/max to be used in templates
* parse numeric min / max values, include in parameters
* pass along the allowable values in the model used by templates
* ensure ‘hasMore’ is set for more parameter lists used by templates
* java model now includes min / max in comment, and allowed enum values as model children
* note: enums in spec can contain non-java characters, so the User.java in examples does not compile presently.
2013-11-27 14:18:35 -08:00
Andrew Young
8cc83d180d Fixed spacing issue. 2013-11-27 12:58:58 -08:00
Andrew Young
65cc529ec6 Updated to handle the case of a NO_CONTENT response. 2013-11-27 12:52:38 -08:00
Andrew Young
9686ceed2d Updated sample code to reflect changes. 2013-11-27 12:52:38 -08:00
Robert Blair
2c73efa536 And rebuild the samples for android-java 2013-11-27 08:02:42 -08:00
Robert Blair
800312361f Also android-java templates:
Rebuild wording sample ApiInvoker from latest.To throw expected ApiException instead of NullPointerException, check required parameters before use
2013-11-27 08:02:03 -08:00
Robert Blair
59897c19a9 Rebuild wording sample ApiInvoker from latest. 2013-11-27 01:16:58 -08:00
Robert Blair
08a3e9e881 Rebuild generated java samples with ApiException checking properly located 2013-11-27 01:16:21 -08:00
Robert Blair
1e2f7cb1f8 To throw expected ApiException instead of NullPointerException, check required parameters before use 2013-11-27 01:13:51 -08:00
Robert Blair
17c38115e6 rebuild java files before changes to template 2013-11-27 01:05:13 -08:00
Robert Blair
0ee6531fcd Version mapping for scala 2.10.* should be consistent. 2013-11-27 01:02:04 -08:00
George Shakhnazaryan
87c12c155d Extract actual work from generateClient so that we can call it without killing the JVM. 2013-11-19 15:55:06 -06:00
SimonKaluza
b373e4312e Fixed SWGApiClient.m's run-type type checking to allow NSArrays to be passed (for Swagger-generated methods that rely on List parameters in the HTTP body) 2013-11-12 23:26:09 -05:00
Ivan Porto Carrero
b39a609226 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-11-09 12:18:42 -08:00
Ivan Porto Carrero
d25f64cca0 change to return transpor client in async scala client 2013-11-09 12:18:20 -08:00
Tony Tam
0d40a53e06 Merge pull request #101 from joeltgf/master
Change "success" response status code in Java ApiInvoker to all 2xx responses vs. just 200.
2013-11-04 09:57:09 -08:00
Joel Caplin
c779905163 Rationalize response status code check. Ensure that all bona fide 2xx responses are treated in the same way that "200 OK" is.
Previously, was explicitly checking for response code 200 (ClientResponse.Status.OK).

Now, checks the family of the response to make sure it is successful (Family.SUCCESSFUL). This enables us to POST to resources that return 201 created - without having to handle a checked ApiException.
2013-10-31 18:23:44 -07:00
Tony Tam
59da358eb5 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-10-22 12:08:56 -07:00
Tony Tam
b815ffa403 formatting 2013-10-22 12:08:43 -07:00
Tony Tam
27a8be2381 upped version for release 2013-10-22 12:08:31 -07:00
Tony Tam
d5b53a1778 updated templates 2013-10-22 02:24:37 -07:00
Tony Tam
01b745c366 added hack to support writing json models in 1.1 format 2013-10-22 02:23:50 -07:00
Russell Horton
af96f33e6f regenerated python, python3 and php clients 2013-10-18 16:24:08 -07:00
Tony Tam
2dda926cb6 added path to spec files 2013-10-18 16:05:50 -07:00
Tony Tam
8fb6fc847c fix for #81 2013-10-18 15:26:20 -07:00
Tony Tam
11d1b8fcd4 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-10-18 14:46:21 -07:00
Tony Tam
5076d76a74 updated scripts to detect scala version and use appropriate library if possible 2013-10-18 14:46:03 -07:00
Tony Tam
044621b325 fixed import issue for objc 2013-10-18 14:45:45 -07:00
Tony Tam
5a3426dee6 renamed to use SWG as default prefix 2013-10-18 14:45:29 -07:00
Tony Tam
b6b28bb1a2 added version checking to avoid runtime scala incompatibilities 2013-10-18 14:45:05 -07:00
Tony Tam
189569518d updated to use afnetworking, cocoapods 2013-10-18 14:44:44 -07:00
Tony Tam
731fddbc30 regenerated client 2013-10-18 14:44:02 -07:00
Tony Tam
c4990b773d regenerated client 2013-10-18 14:43:26 -07:00
Tony Tam
d56c5e3b44 regenerated client 2013-10-18 14:42:57 -07:00
Tony Tam
6f1a4a2f82 Merge pull request #70 from sibblegp/fix_python_obj_type
Only check in lists and dictionaries
2013-10-18 08:25:10 -07:00
Tony Tam
a96d49f045 Merge pull request #100 from JanxSpirit/master
more descriptive exception message than MatchError
2013-10-16 20:21:11 -07:00
Gregg Carrier
ee19dfadf1 more descriptive exception message than MatchError 2013-10-16 22:11:15 -04:00
Tony Tam
2c5524476e Merge pull request #98 from markac/master
Fix Java Generator to always generate valid Java variable names
2013-10-07 22:10:28 -07:00
Mark Crowther
7bde2ffd6e Fix Java Generator to always generate valid Java variable names 2013-10-03 15:59:40 +01:00
Ivan Porto Carrero
f17654cd96 adds bodyParamRequired 2013-10-01 20:17:11 -07:00
Tony Tam
0a47fc23a3 Merge pull request #96 from df-jsykes/master
Fix for sidebar never scrolling in static docs, preventing the user from seeing all operations.
2013-09-30 15:04:06 -07:00
Jason Sykes
13eb435138 removed trigger 2013-09-30 17:56:39 -04:00
Jason Sykes
329f2817c2 Fix to scroll left side of sample docs 2013-09-30 17:50:36 -04:00
Tony Tam
609cef0b65 added android client 2013-09-20 12:34:12 -07:00
Tony Tam
cfa1f1a3c1 formatting 2013-09-19 08:13:50 -07:00
Tony Tam
e851262875 Merge pull request #95 from canadaduane/http_lc
Add an 'httpMethodLowerCase' property
2013-09-18 15:02:43 -07:00
Duane Johnson
7956ccc979 Add an 'httpMethodLowerCase' property
Some libraries use lower case httpMethod names for method calls. For
example, Ruby's Faraday library uses 'get', 'put', 'post', 'delete'.

Rather than this unweildy Ruby code produced by a mustache template:
  self.send("GET".downcase, path, request_opts)

This patch would allow for a more tidy output such as:
  get(path, request_opts)
2013-09-18 15:47:41 -06:00
Tony Tam
13bc111bd6 added some logging for fatal container issues 2013-09-18 12:55:12 -07:00
Tony Tam
cc0a30edf8 added header support, suppressed println 2013-09-18 11:55:45 -07:00
Tony Tam
0ffc6cb7a0 added header passing for codegen 2013-09-17 13:44:45 -07:00
Tony Tam
6a2f53f07d added type modification 2013-09-16 17:35:15 -07:00
Tony Tam
930b1ea0ea updated java example 2013-09-16 17:35:01 -07:00
Tony Tam
8e8e5308b6 added validation error if response not specified 2013-09-16 16:25:19 -07:00
Tony Tam
8f71d3fc50 added form params 2013-09-16 16:25:00 -07:00
Tony Tam
a123d8f066 added set mapping 2013-09-16 16:24:44 -07:00
Tony Tam
ea15cad8d5 fixes for position, and null arg removal 2013-09-16 16:24:24 -07:00
Tony Tam
e4a4f25f22 updated test to match changes in petstore as deployed 2013-09-16 16:23:56 -07:00
Tony Tam
93677742d3 Merge pull request #93 from canadaduane/swagger_config
Fix Ruby Request class: no access to inject_format on Class object
2013-09-12 17:33:26 -07:00
Duane Johnson
389765c113 Fix Ruby Request class: no access to inject_format on Class object 2013-09-12 16:05:59 -06:00
Tony Tam
5ef5fa7296 fixed container type translation 2013-09-12 13:57:03 -07:00
Tony Tam
4e408e6d80 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-09-12 13:42:01 -07:00
Tony Tam
a140ea2b9d fixed response type with array of simple types 2013-09-12 13:41:53 -07:00
Ivan Porto Carrero
b920881490 allow api level config of default imports in async scala 2013-09-09 18:51:04 -07:00
Tony Tam
56d5167a27 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-09-09 17:53:11 -07:00
Tony Tam
ddf81948a8 fixed bug where inner simple types were not being processed 2013-09-09 17:52:49 -07:00
Tony Tam
6652028d71 fixed bug where inner simple types were not being processed 2013-09-09 17:52:30 -07:00
Tony Tam
c9fccc5c75 removed lc array 2013-09-09 17:52:06 -07:00
Tony Tam
f766937ac7 added set support 2013-09-09 17:51:48 -07:00
Tony Tam
54f0823ec4 Update README.md 2013-09-09 15:25:38 -07:00
Tony Tam
5f61d20610 fixed build error 2013-09-09 13:59:55 -07:00
Ivan Porto Carrero
7ed2df2722 one more qualified type 2013-09-07 10:15:28 -07:00
Ivan Porto Carrero
a8a2a41315 Fill out qualified type when it's provided in the json 2013-09-06 22:14:48 -07:00
Ivan Porto Carrero
676283875b add the ability to exclude packages for models in the async scala codegen 2013-09-06 20:52:14 -07:00
Ivan Porto Carrero
4f95550977 fix set generation in async client 2013-09-05 21:58:24 -07:00
Ivan Porto Carrero
7056081605 fix Array[long] to List[Long] 2013-09-05 21:45:19 -07:00
Tony Tam
c90083855f added set test 2013-09-05 17:15:36 -07:00
Tony Tam
2f997e6b29 added fix for set 2013-09-05 17:15:10 -07:00
Tony Tam
8ad07d069c Merge pull request #87 from canadaduane/rubyclean
Change ruby generation to be a little more ruby-esque
2013-09-02 21:17:15 -07:00
Tony Tam
51e29cdfaf Merge pull request #88 from silentdth/master
documentation for compiling on Windows
2013-09-02 21:05:20 -07:00
Ivan Porto Carrero
811425a15f Revert "use position property in json to preserve ordering across generations"
This reverts commit 9ee361df5b.
2013-08-31 19:57:54 -07:00
Ivan Porto Carrero
9ee361df5b use position property in json to preserve ordering across generations 2013-08-31 19:46:14 -07:00
Benjamin Dodd
c1df192f09 documentation for compiling on Windows 2013-08-31 19:58:04 +12:00
Duane Johnson
7d6660d56c Change ruby generation to be a little more ruby-esque
Cleaned up some very long lines, added indentation, and shortened
the repetitive parts of the model mustache template.
2013-08-30 17:07:11 -06:00
Tony Tam
450b3c7ed5 fixed array with simple types, added test 2013-08-28 17:28:52 -07:00
Ivan Porto Carrero
e1e95fc1d2 remove redundant brace 2013-08-27 20:22:22 -07:00
Mike O'Connor
8365270134 bump version 2013-08-27 20:22:34 -04:00
Mike O'Connor
33163cd253 options should be unwrapped 2013-08-27 17:04:09 -04:00
Ivan Porto Carrero
2b04a5a127 Fix using the typeMappings 2013-08-26 17:55:28 -07:00
Ivan Porto Carrero
baa0a45537 add array type mapping 2013-08-26 02:05:39 -07:00
Ivan Porto Carrero
6747e3eb0b update to sbt 0.13.0 2013-08-25 18:20:23 -07:00
Ivan Porto Carrero
bad8d7c4b3 build.sbt edit 2013-08-24 19:42:51 -07:00
Ivan Porto Carrero
2610ac7fc3 update async scala client to use type classes for serializing and deserializing 2013-08-24 19:36:43 -07:00
Ivan Porto Carrero
e2730ae34e fix async scala client generator 2013-08-22 15:31:42 -07:00
Tony Tam
beeeb133e6 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-08-22 13:18:13 -07:00
Tony Tam
01dc29d789 fix for jsonschema format in model property with array 2013-08-22 13:18:03 -07:00
Ivan Porto Carrero
21085b472a bump version 2013-08-22 10:09:22 -07:00
Tony Tam
5483ba5ae7 fix for type 2013-08-20 22:53:13 -07:00
Tony Tam
4a50bb3183 updated to 1.2 spec support 2013-08-17 10:10:37 -07:00
Tony Tam
daeb964bfc updated import 2013-08-16 21:22:14 -07:00
Tony Tam
ad4bf57535 updated prefix 2013-08-16 21:22:06 -07:00
Tony Tam
83ff341e5e fix for #83 2013-08-16 17:53:03 -07:00
Tony Tam
701d4c15a9 updated to 1.2 2013-08-16 17:43:02 -07:00
Tony Tam
01ff7be020 updated to 1.2 2013-08-16 17:22:02 -07:00
Tony Tam
a7bf8b6314 fixes for inner types, spec 1.2 conversion 2013-08-16 17:16:20 -07:00
Tony Tam
c386edb2e4 fixes for inner types, spec 1.2 conversion 2013-08-16 17:16:04 -07:00
Cody Allen
9e12191a64 Fix wrapping default values in an Option for optional params 2013-08-16 09:26:33 -07:00
Ivan Porto Carrero
feb6c188d3 Fix isNotRequired/required on models 2013-08-14 23:16:50 -07:00
Tony Tam
1e245583c9 updated docs 2013-08-14 17:56:08 -07:00
Tony Tam
0e03509cbc added checking 2013-08-14 17:56:03 -07:00
Tony Tam
3bf486e49d updated script 2013-08-14 17:19:20 -07:00
Tony Tam
2497e3a8cf fix for serializer 2013-08-14 17:19:03 -07:00
Tony Tam
d798725d9e added file 2013-08-14 14:49:10 -07:00
Tony Tam
f0517880e7 updated converter args, serializer 2013-08-14 14:43:13 -07:00
Tony Tam
dd68c31fb4 fixed tests 2013-08-14 14:41:35 -07:00
Tony Tam
f6622fbb59 added spec converter 2013-08-14 13:52:19 -07:00
Tony Tam
aa1fbb680b updates for response class to 1.2 spec 2013-08-11 15:36:16 -07:00
Tony Tam
93067a0ce0 updated 1.2 tests 2013-08-11 09:42:53 -07:00
Tony Tam
5a064d6bad updated 1.2 tests 2013-08-11 09:26:32 -07:00
Tony Tam
feb5a2ff3b updated to 1.2 spec 2013-08-10 09:55:30 -07:00
Tony Tam
73a70a65ff added 1.2 spec tests 2013-08-10 09:54:37 -07:00
Tony Tam
3b81d81143 added 1.2 spec tests 2013-08-10 09:54:14 -07:00
Tony Tam
74543f75f9 merged pom + invoker changes, added correct mapping for list 2013-08-08 16:18:57 -07:00
Tony Tam
d9d6cc1e76 fixed filePath 2013-08-08 16:18:33 -07:00
Tony Tam
a3f5c0c688 fixed content type for java client 2013-08-08 16:05:05 -07:00
Tony Tam
17b63b2be8 more refactoring to support 1.2 spec 2013-08-08 15:32:37 -07:00
Tony Tam
558a9cbf64 updated support for relative base paths 2013-08-08 13:53:14 -07:00
Tony Tam
021f269d9d prep for swagger-1.2 support 2013-08-08 12:13:27 -07:00
Tony Tam
7f73007ec4 prep for swagger-1.2 support 2013-08-08 12:13:08 -07:00
Tony Tam
1a1bfd2c7c added logger per #273 2013-08-01 18:21:19 -07:00
Tony Tam
90b34333f5 changed response code 2013-07-31 20:43:29 -07:00
Tony Tam
fa59f168a7 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-07-30 23:55:57 -07:00
Tony Tam
9102a333e3 moved files to version-specific 2013-07-30 23:55:43 -07:00
Tony Tam
43bc3f5be2 formatting 2013-07-30 23:55:19 -07:00
Tony Tam
fbc09aa77b renamed to separate spec versions 2013-07-30 23:55:05 -07:00
Russell Horton
03619b19a1 in PHP client, add query params for all methods, not just GET 2013-07-23 17:50:07 -07:00
Tony Tam
422e79dd01 Update README.md 2013-07-21 10:07:14 -07:00
Tony Tam
b9a60649a8 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-07-20 23:13:23 -07:00
Tony Tam
a06dd72989 added exit to quit template engine 2013-07-20 23:13:12 -07:00
Tony Tam
932dc843f9 updated urls per #75 2013-07-20 23:12:58 -07:00
Tony Tam
c45c8d251a Merge pull request #73 from victorgit/master
Code that generates a groovy plugin based on the swagger resources
2013-07-18 07:41:08 -07:00
Victor Trakhtenberg
ea6a9305be Groovy client generation 2013-07-18 14:31:47 +03:00
Victor Trakhtenberg
c82a5c8aaa Groovy client generation 2013-07-18 13:30:16 +03:00
Victor Trakhtenberg
8135cd65dc Groovy client generation 2013-07-18 13:27:22 +03:00
Tony Tam
db68a3acbd Merge pull request #63 from geoffreys/master
C# template compiler error for non-string parameters
2013-07-16 21:50:16 -07:00
George Sibble
0628c63b15 Check for None Type
Signed-off-by: George Sibble <gsibble@gmail.com>
2013-07-16 14:32:17 -07:00
George Sibble
4d05b5d81f Only check in lists and dictionaries
The "in" operator also works on strings which can cause problems with this line if the attribute and the object are named the same thing.

Signed-off-by: George Sibble <gsibble@gmail.com>
2013-07-16 14:20:49 -07:00
Tony Tam
24af6a00c6 added 2.9.1 launcher support 2013-07-09 16:01:34 -07:00
Tony Tam
fd72c1b9f1 fix for #69, fixed test output 2013-07-03 13:48:35 -07:00
Tony Tam
885cd36165 added support for swagger 1.2 spec 2013-06-30 21:36:52 -07:00
Ivan Porto Carrero
a31780e08f Make the launcher scripts use the assembly generated jar 2013-06-25 20:10:48 -07:00
Ivan Porto Carrero
dc3a4b4eb5 allow adding typeMappings and includes through config 2013-06-23 18:35:48 -07:00
Tony Tam
c1e018947d changed to staging repo 2013-06-23 08:55:47 -07:00
Ivan Porto Carrero
4a3321f253 use sonatype repos for publishing 2013-06-22 22:34:47 -07:00
Ivan Porto Carrero
c9614ab795 force maven style publishing 2013-06-22 22:34:21 -07:00
Ivan Porto Carrero
500262bd03 allow using Map[String, List[String]] 2013-06-22 22:01:43 -07:00
Ivan Porto Carrero
4467fe66c6 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-06-22 17:45:02 -07:00
Geoff Steffens
981ce3d990 Support non-string parameters in querystring 2013-06-19 14:47:40 +10:00
Tony Tam
936387d1df fix for #61 2013-06-17 21:33:40 -07:00
Tony Tam
d14f74b82c removed primitives from reserved words 2013-06-17 20:58:06 -07:00
Tony Tam
85b1fb71c2 Merge pull request #60 from radius314/feature/code-comments
Feature/code comments
2013-06-05 08:53:19 -07:00
Tony Tam
9e8f817a6b Merge pull request #59 from radius314/feature/escaping-forward-slash-windows
fixing replaceAll bug on windows with escaping paths, changed replaceAll...
2013-06-05 08:18:19 -07:00
Tony Tam
697f6dc7c7 updated names 2013-06-04 11:08:34 -07:00
Danny Gershman
d038ef4799 needed to update the compile file for documentation 2013-06-04 01:15:47 -04:00
Danny Gershman
3a2d7adc35 code comment templating added 2013-06-03 19:02:09 -04:00
Ivan Porto Carrero
0e8274ff3b use latest swagger async http client 2013-06-02 18:28:10 -07:00
Tony Tam
a335fe008d added groupId 2013-06-01 12:15:23 -07:00
Tony Tam
251384bb47 added groupId 2013-06-01 12:15:14 -07:00
Tony Tam
54ec7f2bb2 added artifact id 2013-06-01 12:11:59 -07:00
Tony Tam
2199d08e72 added support for artifact id 2013-06-01 12:11:12 -07:00
Danny Gershman
e9fa4434f2 fixing replaceAll bug on windows with escaping paths, changed replaceAll() to replace() 2013-05-30 15:35:47 -04:00
Tony Tam
154b2fdeca Merge pull request #56 from radius314/feature/csharp-templates
created CSharp codegen templating
2013-05-28 11:50:54 -07:00
Danny Gershman
cf05602924 removed property name cleanup due to naming conflicts 2013-05-28 14:42:28 -04:00
Danny Gershman
9a73eb8994 created CSharp codegen templating 2013-05-28 14:17:41 -04:00
Tony Tam
181e7a8b55 Update README.md 2013-05-20 14:26:09 -06:00
Tony Tam
6635616826 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-05-20 13:24:30 -07:00
Tony Tam
71426e58a3 added screenshot 2013-05-20 13:24:22 -07:00
Tony Tam
00d279ccd5 Merge pull request #54 from sibblegp/master
Make injection of .format in Ruby optional
2013-05-18 15:02:29 -07:00
Mike
a4cd839c1e Make the injection of '.{format}' into the root path component optional 2013-05-18 20:25:55 +00:00
George Sibble
4354002bce Merge branch 'master' of git://github.com/wordnik/swagger-codegen 2013-05-18 16:10:37 -04:00
George Sibble
106e2b7cb9 Merge branch 'master' of github.com:sibblegp/swagger-codegen 2013-05-18 16:09:42 -04:00
George Sibble
8443e7a749 Remove "Content-Type" Header from requests with no request body 2013-05-18 16:09:28 -04:00
Tony Tam
3f3471997e removed swagger-core deps 2013-05-18 16:09:28 -04:00
Tony Tam
90fbbec405 removed swagger-core deps 2013-05-18 16:09:28 -04:00
David M. Lee
384ac98295 Display an error when an API fails to parse. 2013-05-18 16:09:28 -04:00
David M. Lee
53f1394c25 Corrected typo in statis HTML API docs 2013-05-18 16:09:28 -04:00
Tony Tam
5eff3fd976 added CORS filter 2013-05-18 16:09:28 -04:00
Tony Tam
f4c859aede removed unused files 2013-05-18 16:09:28 -04:00
Tony Tam
65f2ec1f79 updated links 2013-05-18 16:09:28 -04:00
Tony Tam
c3cb548fb3 updated links 2013-05-18 16:09:28 -04:00
Tony Tam
996e605008 fixed typo 2013-05-18 16:09:28 -04:00
Tony Tam
92ac02e6c6 added java sample 2013-05-18 16:09:27 -04:00
Tony Tam
ffc6a2fc9e updated to snapshot 2013-05-18 16:09:27 -04:00
Tony Tam
36bf178947 updated readme 2013-05-18 16:09:27 -04:00
Tony Tam
a757416a0e removed commented out block 2013-05-18 16:09:27 -04:00
Tony Tam
f167959a38 updated example 2013-05-18 16:09:27 -04:00
Tony Tam
e8e8c18c8f added field 2013-05-18 16:09:27 -04:00
Tony Tam
e91df944cc formatting 2013-05-18 16:09:27 -04:00
Tony Tam
cc4fecb217 formatting 2013-05-18 16:09:27 -04:00
Tony Tam
2443d3d91b updated readme 2013-05-18 16:09:27 -04:00
Tony Tam
f2f33b98f7 updated to scalatra 2.2.0 2013-05-18 16:09:27 -04:00
Tony Tam
184a9d0d5c added README 2013-05-18 16:09:27 -04:00
Eugen Anghel
90aa2ab4eb made Models optional 2013-05-18 16:09:27 -04:00
Tony Tam
2fab0b46c8 added files 2013-05-18 16:09:27 -04:00
Tony Tam
bff8736889 added file upload support 2013-05-18 16:09:27 -04:00
Tony Tam
37e5571965 added file upload support 2013-05-18 16:09:27 -04:00
Tony Tam
6c3935f7ea added file support 2013-05-18 16:09:27 -04:00
Tony Tam
dbf42de407 added file upload support 2013-05-18 16:09:26 -04:00
Tony Tam
900fbe6e75 removed files 2013-05-15 15:21:50 -07:00
Tony Tam
fe4af50fb0 added more logic for static files 2013-05-15 15:21:11 -07:00
Ivan Porto Carrero
81c103b12d use async http client with service locator 2013-05-12 20:13:58 -07:00
Ivan Porto Carrero
023013b6fe have an empty body param for setting a different value for write requests 2013-05-12 17:18:15 -07:00
Ivan Porto Carrero
dfdd8cac94 fixes #52: running the validator now uses the sbt-assembly generated jar 2013-05-09 20:43:55 -06:00
Tony Tam
d30441dd27 Merge pull request #51 from spatex/master
fixes for error messages in Java/JaxRS generated code
2013-05-06 12:46:18 -07:00
Ivan Porto Carrero
bd565be660 update logback in generated client and use package as organization 2013-05-05 22:38:59 -07:00
Ivan Porto Carrero
ad81434310 integrate with sbt assembly generated jar 2013-05-05 22:06:59 -07:00
Ivan Porto Carrero
965df0bc2a Adds shell script for generating async scala client 2013-05-05 21:57:24 -07:00
Tony Tam
cb1c36721c added files 2013-05-05 15:31:21 -07:00
Tony Tam
fede9e97e4 updated templates 2013-05-05 15:29:40 -07:00
Tony Tam
617baa29cd updated docs 2013-05-05 15:29:01 -07:00
Tara Neier
645109111e adding handling for api error messages in java-jaxrs template 2013-05-04 20:30:01 -07:00
Tony Tam
24aa603230 regenerated client 2013-04-22 09:50:02 -07:00
Tony Tam
8b8a956155 regenerated sample 2013-04-22 09:49:45 -07:00
Tony Tam
5e801dd1d7 updated repos, removed scala runtime 2013-04-22 09:49:15 -07:00
Ivan Porto Carrero
98200e6b39 add logger 2013-04-10 18:39:41 +02:00
Ivan Porto Carrero
f3405bcf29 really fix stackoverflow 2013-04-09 19:33:22 +02:00
Ivan Porto Carrero
1724c9328e Make recurseModel method tail-recursive, fix stack overflow error 2013-04-09 17:20:08 +02:00
Ivan Porto Carrero
025502efad Adds async scala client generation 2013-04-09 16:28:47 +02:00
George Sibble
397ebd4bdb Remove "Content-Type" Header from requests with no request body 2013-04-06 13:54:59 -07:00
Tony Tam
6adf368c08 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-04-04 22:18:03 -07:00
Tony Tam
871e0e30f1 removed swagger-core deps 2013-04-04 22:17:25 -07:00
Tony Tam
07ab7d98a6 removed swagger-core deps 2013-04-04 22:16:52 -07:00
Tony Tam
69d4c2a27b Merge pull request #47 from leedm777/parse-failures
Display an error when an API fails to parse.
2013-04-03 13:26:59 -07:00
David M. Lee
0b4fa11486 Display an error when an API fails to parse. 2013-04-03 15:12:57 -05:00
Tony Tam
7929dbfee1 Merge pull request #46 from leedm777/static-docs-typo
Corrected typo in statis HTML API docs
2013-04-03 12:52:03 -07:00
David M. Lee
73b234fd23 Corrected typo in statis HTML API docs 2013-04-03 14:44:49 -05:00
Tony Tam
df333fdfb5 added CORS filter 2013-04-03 00:27:51 -07:00
Tony Tam
99c292a7ad removed unused files 2013-04-03 00:27:41 -07:00
Tony Tam
8cd540e2e1 updated links 2013-04-03 00:22:33 -07:00
Tony Tam
9bef2a8ac6 updated links 2013-04-03 00:20:32 -07:00
Tony Tam
e3ac63da93 fixed typo 2013-04-03 00:19:27 -07:00
Tony Tam
958206c469 added java sample 2013-04-03 00:19:21 -07:00
Tony Tam
98f1941b30 updated to snapshot 2013-03-22 11:03:21 -07:00
Tony Tam
812dc0f528 updated readme 2013-03-21 21:50:42 -07:00
Tony Tam
9fa5737f54 removed commented out block 2013-03-21 21:47:01 -07:00
Tony Tam
0188c719d0 updated example 2013-03-21 21:44:19 -07:00
Tony Tam
45ac101779 added field 2013-03-21 21:43:53 -07:00
Tony Tam
a75a406e05 formatting 2013-03-20 22:27:03 -07:00
Tony Tam
80b031710e formatting 2013-03-20 22:26:24 -07:00
Tony Tam
87b1d71f72 updated readme 2013-03-20 21:38:23 -07:00
Tony Tam
9a86b1df8b updated to scalatra 2.2.0 2013-03-20 21:35:41 -07:00
Tony Tam
b86eb53256 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-03-20 16:17:15 -07:00
Tony Tam
9f5be1cf5a added README 2013-03-20 16:17:04 -07:00
Tony Tam
a1da95c9a5 Merge pull request #40 from eugen/make-models-optional
made Models optional
2013-03-20 07:18:48 -07:00
Eugen Anghel
cb422950f8 made Models optional 2013-03-20 09:49:56 +02:00
Tony Tam
af5f8909a6 added files 2013-03-13 23:47:05 -07:00
Tony Tam
0a7e606650 added file upload support 2013-03-13 23:45:26 -07:00
Tony Tam
c47e553425 added file upload support 2013-03-13 23:45:10 -07:00
Tony Tam
7659ab5a47 added file support 2013-03-13 20:06:48 -07:00
Tony Tam
a31ae97ea0 added file upload support 2013-03-13 19:59:15 -07:00
Ivan Porto Carrero
3cbf2abc5c Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-03-08 23:02:03 +01:00
mrjf
d92294695d Merge pull request #37 from sibblegp/master
Fix Object Type Detection
2013-03-07 12:53:29 -08:00
George Sibble
d7e93cbda9 Fix Object Type Detection to Not Incorrectly Convert Booleans and 0 Integers to None
Prior to this patch, zero integers and False booleans were being converted to None since both evaluate the origin if statement (it not obj) to True.

Signed-off-by: George Sibble <gsibble@gmail.com>
2013-03-07 12:43:46 -06:00
mrjf
a9e0635d31 Merge pull request #34 from sibblegp/master
Add URL query parameters to all calls, not just GET
2013-03-06 22:35:28 -08:00
mrjf
f22dbc510d Merge pull request #36 from mrjf/master
in Swagger.php, use dirname instead of grepping for slash, which could be / or \
2013-03-06 10:08:13 -08:00
Russell Horton
16aa731867 in Swagger.php, use dirname instead of grepping for slash, which could be / or \ 2013-03-06 10:06:35 -08:00
Tony Tam
e1f295398e added files per #35 2013-03-05 17:44:21 -08:00
George Sibble
d00c5d0ad8 Fix typo in python template 2013-03-04 20:05:11 -06:00
George Sibble
29a132496e Fix My Own Mistake (GET Triggered an error)
Signed-off-by: George Sibble <gsibble@gmail.com>
2013-03-04 19:58:59 -06:00
George Sibble
c032b3c2d4 Move URL Query Parameters into All HTTP Verbs
HTTP Spec states that URL query parameters can be in all verbs.  Should probably check all languages to make sure that query parameters are always passed even if it is not a GET call.

Signed-off-by: George Sibble <gsibble@gmail.com>
2013-03-04 19:30:24 -06:00
Tony Tam
68ce5d78f9 added test to verify nested List objects are recursed 2013-03-01 14:37:28 -08:00
Tony Tam
70fef15f81 name clean-up 2013-02-28 20:22:02 -08:00
Tony Tam
7b651dedcd removed null guards 2013-02-28 20:19:04 -08:00
Tony Tam
a6af380833 removed println 2013-02-28 17:28:15 -08:00
Tony Tam
b0993379ee added model test 2013-02-28 17:27:56 -08:00
Tony Tam
7e7005abe2 Merge pull request #33 from sibblegp/master
Bug Fix:  Null JSON value breaks integer conversion
2013-02-28 17:27:06 -08:00
George Sibble
55cf01d9f7 Also for Python 3 2013-02-28 15:06:59 -08:00
George Sibble
7354d6722f Include TypeError Detection
Check for NoneType in Python
2013-02-28 15:04:35 -08:00
Ivan Porto Carrero
8e7c3b7164 update sbt script 2013-02-25 10:27:31 +01:00
Tony Tam
c33358d48f updated docs 2013-02-22 19:15:17 -08:00
Tony Tam
ea541a6cf7 updated docs 2013-02-22 19:12:35 -08:00
Tony Tam
9a067c7821 added sample output docs 2013-02-22 19:04:01 -08:00
Tony Tam
67d48e4e35 fixed data type 2013-02-22 19:03:43 -08:00
Tony Tam
1b89879a47 updated output path 2013-02-22 19:03:32 -08:00
Tony Tam
79c4a09181 changed to use java 2013-02-22 19:03:22 -08:00
Tony Tam
ea35f2cf0e disabled parallel tests 2013-02-22 18:55:13 -08:00
Tony Tam
828607c67b added static doc script 2013-02-22 18:23:27 -08:00
Tony Tam
64ffd7be36 removed fail on warning 2013-02-22 18:19:01 -08:00
Tony Tam
4003a0d61c turned model into map 2013-02-22 18:18:17 -08:00
Tony Tam
631b44fee2 updated path 2013-02-22 18:16:59 -08:00
Tony Tam
c2c1bbc417 Merge pull request #23 from mrjf/master
wordnik.com api clients for python, python3 and php
2013-02-21 11:07:02 -08:00
Tony Tam
10c5a8346f Merge pull request #31 from ceraslabs/master
Fixed compilation error
2013-02-21 11:03:57 -08:00
Hongbin Lu
c0c2f0bebc Fixed an error that escaping a non-string object 2013-02-21 17:33:37 +00:00
Hongbin Lu
85e8ead0cf Fixed a ArrayList cannot be resolved error 2013-02-21 17:19:16 +00:00
Tony Tam
2e0ac79f0c Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-02-21 00:24:32 -05:00
Tony Tam
b7dae2a846 cleaned up compiler warnings 2013-02-21 00:24:20 -05:00
Ivan Porto Carrero
cf470009ba update to sbt 0.12.2 2013-02-20 18:26:11 +01:00
Russell Horton
434102550f update php wordnik sample app 2013-02-10 13:24:39 -08:00
Russell Horton
00ac23c462 separate PHP query, header and path param serialization and encoding 2013-02-10 13:24:01 -08:00
Tony Tam
402266e65b removed optional name field for models 2013-02-06 17:03:30 -08:00
Tony Tam
852eb0bf49 added error handling 2013-02-06 17:03:19 -08:00
Tony Tam
84e17c7707 made public 2013-02-06 16:39:44 -08:00
Tony Tam
fb4a6c968c better error messages 2013-02-06 16:39:31 -08:00
Tony Tam
b3076d95b2 began adding friendly validation messages 2013-02-05 17:52:17 -08:00
Tony Tam
a2bff39427 added credentials for publish 2013-01-14 14:22:15 -08:00
Tony Tam
0d82786715 fixed scalate deps for mvn build 2013-01-14 13:49:16 -08:00
Tony Tam
17a433fb59 Merge pull request #24 from wordnik/sbtify
use sbt for building, only use json4s-jackson
2013-01-14 13:41:23 -08:00
Ivan Porto Carrero
55ce19a233 also build for 2.10 2013-01-14 01:56:19 +01:00
Ivan Porto Carrero
59d74a83af use sbt for building, only use json4s-jackson 2013-01-14 01:06:19 +01:00
Tony Tam
dea4b746b7 Merge branch 'master' of github.com:wordnik/swagger-codegen 2013-01-04 11:08:49 -08:00
Tony Tam
61f5031f8a updated with npm-managed swagger package 2013-01-04 11:08:20 -08:00
Tony Tam
5d60632aa6 updated with npm-managed swagger package 2013-01-04 11:07:12 -08:00
ramesh
fe30ed3580 Fixed issue in configuring output path for supporting files. 2013-01-03 14:27:43 -08:00
Tony Tam
7370354535 fixed repo 2012-12-26 21:22:50 -08:00
Tony Tam
b2890a00a3 removed println 2012-12-26 20:06:29 -08:00
Tony Tam
f329b94625 fixed string bug 2012-12-26 20:02:03 -08:00
Russell Horton
62352a126e removing unneeded capitalized data types 2012-12-21 11:27:48 -08:00
Russell Horton
16be3a7f54 added sample readmes 2012-12-20 15:32:05 -08:00
Russell Horton
1de97d204d updated env var documentation 2012-12-20 14:53:51 -08:00
Russell Horton
2bc8cc01a5 tests for python3 wordnik.com api client 2012-12-20 14:38:15 -08:00
Russell Horton
6266a94857 generated python3 client for wordnik.com api 2012-12-20 14:35:48 -08:00
Russell Horton
bd19ef489c python3 wordnik.com api client generation 2012-12-20 14:35:27 -08:00
Russell Horton
a7b9a930e5 tests for python wordnik.com api client 2012-12-20 14:35:10 -08:00
Russell Horton
39659d8c36 generated python wordnik.com api client 2012-12-20 14:34:33 -08:00
Russell Horton
22ebb85c35 python wordnik.com api generation 2012-12-20 14:34:01 -08:00
Russell Horton
30109204d9 generated php client for wordnik.com api 2012-12-20 14:33:45 -08:00
Russell Horton
3cd48e17d2 php tests for wordnik.com api client 2012-12-20 14:32:51 -08:00
Russell Horton
da5c7a77c3 php wordnik.com api client generation 2012-12-20 14:32:29 -08:00
Russell Horton
43708f6395 map lower case type names as well as upper 2012-12-20 14:26:19 -08:00
Russell Horton
29cec989b2 better escaping for path parameters 2012-12-20 14:25:47 -08:00
Russell Horton
93c0134da9 better url escaping for path values 2012-12-20 14:25:14 -08:00
Russell Horton
5840120124 added Scrabble score method and model 2012-12-20 14:24:42 -08:00
Tony Tam
9d014e89bc added distro target 2012-12-18 23:25:27 -08:00
Tony Tam
15a3e15f2f Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-12-18 22:54:12 -08:00
Tony Tam
95d77807c2 cleaned up toApiName to strip bad chars 2012-12-18 22:53:46 -08:00
Tony Tam
28221b5f5a added more lenient int extraction, optional basepath 2012-12-18 22:53:25 -08:00
Tony Tam
c9397ce1e7 changed to use paramName instead of baseName to support the toParamName method 2012-12-18 22:53:03 -08:00
Tony Tam
a1f8bcd0ae Update README.md 2012-12-08 21:16:40 -08:00
Tony Tam
f1f466b69f made extracter smarter with bool, int, string 2012-12-08 12:52:03 -08:00
Tony Tam
df48f4d8a9 added models to map 2012-12-05 07:38:10 -08:00
Tony Tam
4c6cea87f1 [maven-release-plugin] prepare for next development iteration 2012-12-04 17:55:57 -08:00
Tony Tam
828cc5d1bf [maven-release-plugin] prepare release swagger-codegen_2.9.1-2.0.1 2012-12-04 17:55:50 -08:00
Tony Tam
59328ae65a added scaladocs 2012-12-04 17:53:09 -08:00
Tony Tam
6d76738427 updated from new codegen 2012-12-04 17:23:38 -08:00
Tony Tam
0f3087cbd6 forcing allowableListValues to be String 2012-12-04 17:06:34 -08:00
Tony Tam
4c19ff30ed added special handling for parameter ordering 2012-12-04 15:42:00 -08:00
Tony Tam
a38fbe8d21 updated with latest codegen 2012-12-04 15:39:27 -08:00
Tony Tam
8c1539ab24 updated templates 2012-12-04 15:38:50 -08:00
Tony Tam
af3b3eb323 removed path 2012-12-04 11:21:44 -08:00
Tony Tam
c8f6d8a7f2 updated to lateest codegen 2012-12-04 11:04:26 -08:00
Tony Tam
cf52e7d788 updated order of wordlist 2012-12-04 10:37:07 -08:00
Tony Tam
8eb34c5141 updated to latest codegen 2012-12-04 10:36:45 -08:00
Tony Tam
2a9cf7c06d updated to latest codegen 2012-12-04 10:36:12 -08:00
Tony Tam
f4cd02283b updated with latest codegen 2012-12-04 10:20:59 -08:00
Tony Tam
99cca5d249 updated with latest codegen 2012-12-04 10:20:04 -08:00
Tony Tam
5d8877a679 updated to proper model property order 2012-12-04 08:40:25 -08:00
Tony Tam
d18cc2d3e4 updated samples with correct property ordering 2012-12-04 08:32:23 -08:00
Tony Tam
0ae00dc79c fixed filemap args 2012-12-04 07:50:23 -08:00
Tony Tam
e1bfdfbc5e removed println 2012-12-04 07:08:50 -08:00
Tony Tam
c2d332ce20 updated scripts 2012-12-04 07:08:35 -08:00
Tony Tam
35a4039955 fixed npes from extraction 2012-12-04 00:48:01 -08:00
Tony Tam
b7368654f1 updated deps 2012-12-04 00:24:20 -08:00
Tony Tam
87bad7b36d migrated to json4s 2012-12-04 00:15:55 -08:00
Tony Tam
25837e3367 updated serializers, tests 2012-12-03 22:12:40 -08:00
Tony Tam
61a9cc6e6a fixed formats 2012-12-03 13:52:25 -08:00
Tony Tam
8b5e638409 detabbed 2012-12-03 13:48:00 -08:00
Tony Tam
69fe17380c added serializer test 2012-12-03 13:46:41 -08:00
Tony Tam
98ca711e44 added to support json4s 2012-12-03 13:45:14 -08:00
Tony Tam
b9ec912698 added json4s 2012-12-03 13:45:04 -08:00
Tony Tam
bc0fd47522 renamed to avoid collisions 2012-12-03 13:44:58 -08:00
Cody Allen
3e527e3141 Add missing slash in ApiInvoker path 2012-11-30 19:59:46 -08:00
Tony Tam
ed423a4a8e added filename to supporting file writer 2012-11-30 14:14:44 -08:00
Tony Tam
f88b500ee8 added filename to supporting file writer 2012-11-30 14:02:01 -08:00
Tony Tam
32d645572c updated resource path 2012-11-26 09:00:27 -08:00
Tony Tam
4a6ab18b73 updated resource path 2012-11-26 09:00:09 -08:00
Tony Tam
8ec999089a updated resource path 2012-11-26 08:59:49 -08:00
Tony Tam
1a07c0796f updated resource path 2012-11-26 08:59:32 -08:00
Tony Tam
d4baff8d90 updated resource path 2012-11-26 08:59:15 -08:00
Tony Tam
8aa414360e updated resource path 2012-11-26 08:58:58 -08:00
Tony Tam
3b7de86b99 updated resource path 2012-11-26 08:58:39 -08:00
Tony Tam
feb6c5928f updated resource path 2012-11-26 08:58:17 -08:00
Tony Tam
d9c3277f9e Update README.md 2012-11-26 07:27:24 -08:00
fehguy
1d33b33f28 Update README.md 2012-10-11 20:18:58 -07:00
fehguy
e51179ed0f Update README.md 2012-10-11 11:54:12 -07:00
Tony Tam
3a8db77200 [maven-release-plugin] prepare for next development iteration 2012-10-11 10:54:23 -07:00
Tony Tam
55bb1f2a76 [maven-release-plugin] prepare release swagger-codegen_2.9.1-2.0.0 2012-10-11 10:54:09 -07:00
Tony Tam
cb534047ee added class for remote urls to avoid Source.io 2012-10-11 10:49:39 -07:00
Tony Tam
735f5c61b3 updated scala plugin 2012-10-11 10:49:27 -07:00
Tony Tam
73a2fc216e added null checks 2012-10-09 17:53:07 -07:00
Tony Tam
46323fae7c updated to new scalatra allowable values 2012-10-09 09:37:49 -07:00
Tony Tam
7fde848680 Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-10-07 09:49:06 -07:00
Tony Tam
aef4190624 added support for copying directories 2012-10-07 09:46:58 -07:00
Tony Tam
4be326152f removed old ref 2012-10-06 05:49:55 -07:00
Tony Tam
51437245e4 removed old refs 2012-10-05 21:12:31 -07:00
Tony Tam
36f4239c93 removed old refs 2012-10-05 21:08:55 -07:00
Tony Tam
87ebc8a7f3 added java-wordnik-api script 2012-10-06 05:57:58 +02:00
Tony Tam
a4afa9bac2 updated to use case classes, removed swagger-core deps 2012-10-06 05:57:21 +02:00
Tony Tam
7af8b0de18 added java sample 2012-10-06 05:56:52 +02:00
Tony Tam
66dd67597c added readme, sample 2012-09-27 11:38:41 -07:00
Tony Tam
f5fae2df48 added readme, sample 2012-09-27 11:36:52 -07:00
Tony Tam
adbadfe500 added tests 2012-09-27 11:29:18 -07:00
Tony Tam
f7b1e25453 removed comments 2012-09-26 22:23:56 -07:00
Tony Tam
a0b0e7bcb7 added wordnik api script 2012-09-26 22:16:41 -07:00
Tony Tam
6aa5b8f089 added license info 2012-09-26 22:16:31 -07:00
Tony Tam
e9ef124f59 removed old file 2012-09-26 22:16:25 -07:00
Tony Tam
5d2ae3d353 formatting 2012-09-26 22:16:09 -07:00
Tony Tam
031dd20072 removed raw 2012-09-26 22:15:52 -07:00
Tony Tam
67ce62c622 added license info 2012-09-26 22:15:28 -07:00
Tony Tam
b4efa892a1 added objc wordnik sample 2012-09-26 22:15:16 -07:00
Tony Tam
ddc94bcb7c removed comments 2012-09-26 22:12:55 -07:00
Tony Tam
bee14e82b2 updated tests 2012-09-26 22:08:51 -07:00
Tony Tam
4765c56b2a removed raw value 2012-09-26 22:07:41 -07:00
Tony Tam
0b7db0ce2d clean up of formatting 2012-09-26 14:01:57 -07:00
Tony Tam
68436f6cbe removed println 2012-09-26 13:52:50 -07:00
Tony Tam
444de037bc Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-09-26 13:43:47 -07:00
Tony Tam
ce1b4ec347 added contianer check to simplify models 2012-09-26 13:43:38 -07:00
fehguy
b65de5466c added objc, ruby to examples 2012-09-26 13:07:57 -07:00
Tony Tam
58cfacc4cf added ruby sample 2012-09-26 13:02:27 -07:00
Tony Tam
cbb61b1002 updated package 2012-09-26 13:01:52 -07:00
Tony Tam
62c3a70843 added tests back 2012-09-26 11:53:39 -07:00
Tony Tam
e0d8a75441 updated settings 2012-09-26 11:51:20 -07:00
Tony Tam
687eff49a5 updated settings 2012-09-26 11:50:03 -07:00
Tony Tam
9f2a90722b added files 2012-09-26 11:33:19 -07:00
Tony Tam
90b5490f00 added test supporting files 2012-09-26 11:32:31 -07:00
Tony Tam
0bdf466e32 restored files 2012-09-26 11:20:56 -07:00
Tony Tam
a8109930ed moved folders 2012-09-26 11:12:12 -07:00
Tony Tam
a3f08e87fd moved folders 2012-09-26 11:10:14 -07:00
Tony Tam
e65e5a730d moved folders 2012-09-26 11:09:40 -07:00
Tony Tam
8d4afdf5ad fixed string escape, comma encoding 2012-09-26 11:09:24 -07:00
Tony Tam
0a7f8f1055 added api file test 2012-09-25 22:32:21 -07:00
Tony Tam
93b11410a9 updated location for writing api invoker 2012-09-25 22:32:06 -07:00
Tony Tam
667b1cf7a5 fixed default values 2012-09-25 22:31:52 -07:00
Tony Tam
93d81b84dc updated location for writing api invoker 2012-09-25 22:31:39 -07:00
Tony Tam
3f55736f33 detabbed 2012-09-25 22:31:20 -07:00
Tony Tam
91c2af2a98 moved template files to base class 2012-09-25 22:31:08 -07:00
Tony Tam
548b86aef1 fixed package 2012-09-25 22:30:47 -07:00
Tony Tam
7baae391eb added objc files 2012-09-25 22:30:35 -07:00
Tony Tam
22783f8f0a updated package 2012-09-25 22:29:49 -07:00
Tony Tam
55d60aca50 added tests 2012-09-25 22:29:18 -07:00
Tony Tam
dd88a6b0ac added apiToMap test 2012-09-25 11:30:33 -07:00
Tony Tam
b0c15d1c9b added wordnik api sample 2012-09-25 09:21:11 -07:00
Tony Tam
7a379a7b40 fixed whitespace 2012-09-24 23:03:32 -07:00
Tony Tam
674fdff35b added objc sample 2012-09-24 22:59:37 -07:00
fehguy
94919895bc added objc script 2012-09-24 22:57:17 -07:00
Tony Tam
c4e2515c8f Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-09-24 22:55:30 -07:00
Tony Tam
85a0a728de added objc sample 2012-09-24 22:55:17 -07:00
Tony Tam
89ec4010e2 moved path util tests into separate file 2012-09-24 22:52:29 -07:00
Tony Tam
b3d5b49e90 added config for model name prefix 2012-09-24 22:51:59 -07:00
fehguy
dbfeb59820 Update README.md 2012-09-23 20:25:17 -07:00
fehguy
3ce7dbd960 Update README.md 2012-09-23 20:24:20 -07:00
fehguy
cef535f380 Update README.md 2012-09-23 20:23:07 -07:00
Tony Tam
3d1678a087 added ingores for server generator 2012-09-23 20:14:33 -07:00
Tony Tam
ac9cff08d4 updated to match templates 2012-09-23 20:13:05 -07:00
Tony Tam
5671bcf746 formatting 2012-09-23 20:12:44 -07:00
Tony Tam
31fa05599e added python3 runnable 2012-09-23 20:12:26 -07:00
Tony Tam
f20748f0d5 moved to client folder 2012-09-23 20:12:13 -07:00
Tony Tam
155251951b formatting 2012-09-23 20:11:20 -07:00
Tony Tam
e2dbe61adf updated to use swagger 1.1.0 2012-09-23 18:43:14 -07:00
Tony Tam
236a9697ad moved to client folder 2012-09-23 18:41:54 -07:00
Tony Tam
2f93e37645 moved to client folder 2012-09-23 18:41:29 -07:00
Tony Tam
56abce3fbd moved to client folder 2012-09-23 18:41:09 -07:00
Tony Tam
b6b80474b7 moved to client folder 2012-09-23 18:40:47 -07:00
Tony Tam
bab5973dd0 moved to client folder 2012-09-23 18:38:27 -07:00
Tony Tam
a29c580205 updated links in readme 2012-09-23 16:38:32 -07:00
Tony Tam
dec7bdfb82 moved to client dir 2012-09-23 16:35:47 -07:00
Tony Tam
b6a85a4b2e moved to client dir 2012-09-23 16:35:19 -07:00
Tony Tam
611cc6075b moved to client dir 2012-09-23 16:34:59 -07:00
Tony Tam
1e8c4668b7 moved to client folder 2012-09-23 16:26:46 -07:00
Tony Tam
84fb24ada5 updated swagger version dep, added json4s 2012-09-23 16:13:22 -07:00
Tony Tam
1077e48e7e moved to client subdirectory 2012-09-23 16:12:56 -07:00
Tony Tam
ad5d44769b updated script location 2012-09-23 16:12:24 -07:00
Tony Tam
e2c383bd80 made more testable, changed to use case classes + native scala lists 2012-09-23 16:11:47 -07:00
Tony Tam
44d018b642 added scala json mapper 2012-09-23 16:11:16 -07:00
Tony Tam
cec3fa5810 refactored to make more testable 2012-09-23 12:18:22 -07:00
Ivan Porto Carrero
d6cf7fc9aa fix the scalatra sample 2012-09-20 23:38:47 -07:00
Ivan Porto Carrero
256e746364 fix the scalatra sample 2012-09-20 23:38:08 -07:00
Tony Tam
0504f68b41 updated defaults 2012-09-20 23:04:52 -07:00
Tony Tam
21265454ab updated files 2012-09-20 23:04:21 -07:00
Tony Tam
cdc1bbc133 split up for testability 2012-09-20 22:13:09 -07:00
Tony Tam
2579ed311a added tests 2012-09-20 18:01:41 -07:00
Tony Tam
cdfbedb0ea implemented tests 2012-09-20 18:01:27 -07:00
Tony Tam
46249530a3 made extraction logic more testable 2012-09-20 18:01:00 -07:00
Tony Tam
7881786fe8 added java codegen test 2012-09-20 16:04:37 -07:00
Tony Tam
5a9979633c added tests 2012-09-20 14:19:58 -07:00
Tony Tam
3d379c82d1 Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-09-20 14:19:27 -07:00
Tony Tam
77141cd55a added default value 2012-09-20 14:16:51 -07:00
Tony Tam
26bcc80ae3 removed unused method 2012-09-20 14:16:34 -07:00
Tony Tam
59cd5380aa added default value for key 2012-09-20 14:16:20 -07:00
Tony Tam
c3b36c6944 removed overridden methods 2012-09-20 14:15:44 -07:00
Tony Tam
f85c06628b removed overridden methods 2012-09-20 14:15:32 -07:00
Gregg
7c55dddf43 fixed a null pointer exception bug 2012-09-20 12:12:54 -07:00
Tony Tam
374c68d8da fixed return type inside containers 2012-09-12 09:52:14 -07:00
Tony Tam
de1ef1dde3 added looking into 2nd-level objects 2012-09-12 09:51:53 -07:00
Tony Tam
f5a69a5a3b removed println 2012-09-12 06:37:09 -07:00
Tony Tam
5afd4b260a formatting 2012-09-12 06:37:00 -07:00
Tony Tam
b648f84980 moved to samples dir 2012-09-12 06:36:45 -07:00
Tony Tam
bc28ee97da moved to samples dir 2012-09-12 06:36:29 -07:00
Tony Tam
a647576c97 moved to samples dir 2012-09-12 06:35:54 -07:00
Tony Tam
45e4c1a53d added null check, override 2012-09-11 21:32:15 -07:00
Tony Tam
6e4e375589 formatting 2012-09-11 21:31:51 -07:00
Tony Tam
3e5e85509d moved override 2012-09-11 21:28:29 -07:00
Tony Tam
92c0fc5afb added override 2012-09-11 21:27:14 -07:00
Tony Tam
5e90e2a24a reduced type specification 2012-09-11 21:26:27 -07:00
Russell Horton
53c612c13b can't pass JAVA_OPTS directly to Scala compiler 2012-09-10 01:56:02 -07:00
Russell Horton
2a1b1817c5 update ignored files to add generated-code, python compilcation results 2012-09-10 01:55:10 -07:00
Russell Horton
e9a8a8d755 add readme to PHP sample app 2012-09-10 01:53:49 -07:00
Russell Horton
9a6392a758 reorganize and update python sample app 2012-09-10 01:53:13 -07:00
Russell Horton
0fbae2736d add README to python sample app 2012-09-10 01:52:11 -07:00
Russell Horton
85a4aacefa add datetime conversion to python 2012-09-10 01:50:54 -07:00
Russell Horton
5189a85966 add JSON header 2012-09-10 00:35:13 -07:00
Russell Horton
4d15674803 Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-09-10 00:28:08 -07:00
Russell Horton
274b9e7c43 added python3 sample app 2012-09-10 00:25:31 -07:00
Russell Horton
cf53a24271 added python3 support 2012-09-09 23:48:30 -07:00
Russell Horton
4c0cd15a40 updated and restructed PHP petstore sample app 2012-09-09 09:01:42 -07:00
fehguy
6829014393 Update samples/server-generator/scalatra/README.md 2012-09-07 14:18:04 -07:00
fehguy
2647f96c81 Update samples/server-generator/sinatra/README.md 2012-09-07 14:17:06 -07:00
Tony Tam
bbcdee8b28 Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-09-07 14:13:56 -07:00
Tony Tam
8d79437c8d added readme 2012-09-07 14:13:46 -07:00
fehguy
a4c9e26018 Update samples/server-generator/sinatra/output/README.md 2012-09-07 07:39:23 -07:00
Russell Horton
a38fc6eb06 Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-09-06 15:16:34 -07:00
Tony Tam
b6a070e604 added gemfile 2012-09-06 09:19:13 -07:00
Tony Tam
e9146234c7 updated sinatra sample 2012-09-06 09:12:11 -07:00
Tony Tam
1e73944722 added ruby generator stub 2012-09-06 09:11:34 -07:00
Tony Tam
f37f284605 updated to make names friendly 2012-09-06 09:09:47 -07:00
Tony Tam
a7156e6f00 removed println 2012-09-06 09:09:28 -07:00
Tony Tam
7c812c2426 updated script 2012-09-06 09:09:12 -07:00
Tony Tam
2dcfebea98 added sinatra samples 2012-09-05 17:48:37 -07:00
Tony Tam
812213164f added sinatra samples 2012-09-05 17:45:07 -07:00
Tony Tam
4b43e70555 added sinatra samples 2012-09-05 17:43:21 -07:00
Tony Tam
5662891d62 added sinatra server generator 2012-09-05 17:25:01 -07:00
Russell Horton
a7f38e40c4 Merge branch 'master' of github.com:wordnik/swagger-codegen 2012-09-01 22:47:19 -07:00
Tony Tam
66f98ebaa8 updated readme 2012-08-29 17:52:40 -07:00
Tony Tam
3c53c13685 added readme 2012-08-29 17:49:50 -07:00
Tony Tam
ae271fb57a reverted basePart injection 2012-08-29 17:26:41 -07:00
Tony Tam
53721239f4 added main app, now validates with 51756c1d8e 2012-08-29 16:57:47 -07:00
Tony Tam
6636acf2d3 updated with dataType in paths, now validates 2012-08-29 16:56:13 -07:00
Tony Tam
b7ed61b8f9 updated sample 2012-08-29 16:55:40 -07:00
Tony Tam
02b5a929ac added main app 2012-08-29 16:54:48 -07:00
Tony Tam
5482cb7822 updated to support raw swagger types 2012-08-29 16:54:14 -07:00
Tony Tam
6113826180 updated versions 2012-08-29 10:40:12 -07:00
Tony Tam
de1a4059b1 updated some formatting 2012-08-29 09:32:12 -07:00
Tony Tam
267ecec8f2 removed unneeded files 2012-08-29 09:28:41 -07:00
Tony Tam
07addb366e added scalatra server generator (WIP) 2012-08-29 09:27:55 -07:00
Tony Tam
21848c3cf3 updated swagger-core version 2012-08-29 09:25:49 -07:00
Tony Tam
45745f6f14 formatting, added more params for server generators 2012-08-29 09:25:30 -07:00
Tony Tam
f7a929bd02 renamed template dir 2012-08-28 16:52:18 -07:00
Tony Tam
cb55d38a38 formatting 2012-08-28 16:31:24 -07:00
Tony Tam
5eb1372e08 updated license 2012-08-28 16:30:51 -07:00
Tony Tam
73b15dce53 excluding default models 2012-08-28 16:30:36 -07:00
Tony Tam
9227d7b046 added null check for item refs 2012-08-28 15:53:12 -07:00
Russell Horton
de0dffe83f cast to string for query param replacements in case ids are submitted as int, long, etc 2012-08-28 15:18:21 -07:00
Russell Horton
3550309544 faciliatate serialization to JSON of deeply nested objects 2012-08-28 15:17:25 -07:00
Russell Horton
153de3077e account for possibly empty / null list-type attributes 2012-08-28 15:16:28 -07:00
Russell Horton
bbb7e7138c added DateTime support to PHP 2012-08-28 15:15:53 -07:00
Russell Horton
c777640f04 add lowercase long field map 2012-08-28 13:55:47 -07:00
Tony Tam
6df5008310 changed to use class instead of script 2012-08-28 01:01:46 -07:00
Tony Tam
37efc32374 changed to use class instead of script 2012-08-28 01:00:24 -07:00
Tony Tam
275098a8ef updated template 2012-08-28 00:58:04 -07:00
Tony Tam
52a9195411 added invoker param 2012-08-28 00:57:49 -07:00
Tony Tam
5f81594f03 updated instructions 2012-08-27 21:15:05 -07:00
Tony Tam
f295fe698a added readme 2012-08-27 21:14:05 -07:00
Tony Tam
8805a7acbb added sample, README 2012-08-27 21:05:03 -07:00
Tony Tam
b4485b1196 added server generator 2012-08-27 20:33:10 -07:00
Tony Tam
a929fce3a0 renamed method 2012-08-27 20:24:58 -07:00
Tony Tam
f4c8dd9dec added invoker package, updated writing supporting files 2012-08-27 17:30:25 -07:00
Tony Tam
79f2be422b made prettier 2012-08-25 18:20:20 -05:00
Tony Tam
b92a84eed8 added notes about generating your own files 2012-08-24 22:41:35 -07:00
Tony Tam
a50f0627f9 updated instructions 2012-08-24 20:42:28 -07:00
Tony Tam
d6f5231e93 updated instructions, package 2012-08-24 20:32:28 -07:00
Tony Tam
6a9ba75640 added package 2012-08-24 20:32:15 -07:00
Tony Tam
95f6b00704 added flash generator 2012-08-24 19:59:19 -07:00
Tony Tam
00fce59737 added php codegen 2012-08-24 19:49:23 -07:00
Tony Tam
384a549807 added python files 2012-08-24 19:39:34 -07:00
Tony Tam
af41b43c56 added validator documentation, script 2012-08-24 19:33:23 -07:00
Tony Tam
b146310c1a fixed path in readme 2012-08-24 19:24:06 -07:00
Tony Tam
7138a3f8c2 fixed path in readme 2012-08-24 19:23:39 -07:00
Tony Tam
038402abb3 added java petstore sample 2012-08-24 19:21:40 -07:00
Tony Tam
52587de715 added license info 2012-08-24 18:37:03 -07:00
Tony Tam
5773626d53 added petstore sample 2012-08-24 18:31:09 -07:00
Tony Tam
2d45c80415 added petstore sample 2012-08-24 18:29:06 -07:00
Tony Tam
432965fa0e changed output directory 2012-08-24 18:22:35 -07:00
Tony Tam
63f2075410 updated invoker for quoted strings 2012-08-24 18:22:24 -07:00
Tony Tam
f1c9e6c64e added file 2012-08-24 15:32:50 -07:00
Tony Tam
05ccb75ebf updated pom.xml 2012-08-24 15:31:49 -07:00
Tony Tam
58ce2a1298 updated to 2.0 2012-08-24 15:29:26 -07:00
Tony Tam
7e823f879e updated to 2.0 2012-08-24 15:27:27 -07:00
Tony Tam
9e3fc6603f updated to 2.0 2012-08-24 15:27:18 -07:00
Tony Tam
aa162b9393 updated to 2.0 2012-08-24 15:27:08 -07:00
fehguy
a33df3ac33 added license info 2012-07-30 09:50:35 -07:00
fehguy
c0aecff3dc Merge pull request #10 from marek-stoj/master
added support for C# (thanks @marek-stoj)
2012-05-14 08:50:14 -07:00
Marek Stój
43d15d4d00 Fixed CSharpDataTypeMappingProvider for string type. 2012-05-12 10:56:59 +02:00
Marek Stój
2633eb77e2 Fix in readme.md. 2012-05-12 09:41:49 +02:00
Marek Stój
094a1f2040 Added support for the C# language. 2012-05-12 09:39:52 +02:00
mrjf
fc7c8c6a8f Merge pull request #9 from gthomas/master
Fix python VersionChecker template
2012-05-08 17:29:09 -07:00
Grant Thomas
404c5ab8c3 Really fix indentation. Github browser-editor fail\! 2012-05-08 07:05:12 -07:00
Grant Thomas
6db5c15037 Ensure correct indentation. 2012-05-08 07:01:48 -07:00
Grant Thomas
94ab81c1a2 Now it is Python! 2012-05-08 06:57:42 -07:00
Tony Tam
e2d8f97e13 removed repositories 2012-04-12 17:50:43 -07:00
Tony Tam
9be7a3f53c [maven-release-plugin] prepare for next development iteration 2012-04-12 17:41:22 -07:00
1076 changed files with 103491 additions and 14715 deletions

17
.gitignore vendored
View File

@@ -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

3
.travis.yml Normal file
View File

@@ -0,0 +1,3 @@
language: scala
scala:
- 2.10.0

11
LICENSE Normal file
View File

@@ -0,0 +1,11 @@
Copyright 2014 Reverb Technologies, 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 [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

398
README.md
View File

@@ -1,190 +1,246 @@
# Swagger Client Code-Generator
# Swagger Code Generator
[![Build Status](https://travis-ci.org/wordnik/swagger-codegen.png)](https://travis-ci.org/wordnik/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, Swager removes the guesswork in calling the service.
Check out [Swagger-Spec](https://github.com/wordnik/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
### Prerequisites
You need the following installed and available in your $PATH:
<li>- Java 1.6 or greater (http://java.oracle.com)
* [Java 1.7](http://java.oracle.com)
<li>- Apache ant 1.7 or greater (http://ant.apache.org/)
Note! Some folks have had issues with OOM errors with java version "1.6.0_51". It's strongly suggested that you upgrade to 1.7!
<li>- Scala 2.x or greater (http://www.scala-lang.org/downloads)
* [Apache maven 3.0.3 or greater](http://maven.apache.org/)
You also need to set an environment variable for SCALA_HOME:
* [Scala 2.9.1](http://www.scala-lang.org)
* [sbt (only download if you're building on Windows)](http://www.scala-sbt.org/)
You also need to add the scala binary to your PATH.
After cloning the project, you need to build it from source with this command:
```
./sbt assembly
```
or for Windows...
```
sbt assembly
```
### To generate a sample client library
You can build a client against Wordnik's [petstore](http://petstore.swagger.wordnik.com) API as follows:
```
./bin/scala-petstore.sh
```
This will run the script in [samples/client/petstore/ScalaPetstoreCodegen.scala](https://github.com/wordnik/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) and create the client. You can then
compile and run the client, as well as unit tests against it:
```
cd samples/client/petstore/scala
mvn package
```
Other languages have petstore samples, too:
```
./bin/flash-petstore.sh
./bin/java-petstore.sh
./bin/objc-petstore.sh
./bin/php-petstore.sh
./bin/python-petstore.sh
./bin/python3-petstore.sh
./bin/ruby-petstore.sh
```
### Generating libraries from your server
It's just as easy--you can either run the default generators:
```
./bin/runscala.sh com.wordnik.swagger.codegen.BasicScalaGenerator http://petstore.swagger.wordnik.com/api/api-docs special-key
```
Replace `Scala` with `Flash`, `Java`, `Objc`, `PHP`, `Python`, `Python3`, `Ruby`.
You will probably want to override some of the defaults--like packages, etc. For doing this, just create a scala
script with the overrides you want. Follow [ScalaPetstoreCodegen](https://github.com/wordnik/swagger-codegen/blob/master/samples/client/petstore/scala/ScalaPetstoreCodegen.scala) as an example:
For example, create `src/main/scala/MyCodegen.scala` with these contents:
```scala
import com.wordnik.swagger.codegen.BasicScalaGenerator
object MyCodegen extends BasicScalaGenerator {
def main(args: Array[String]) = generateClient(args)
// location of templates
override def templateDir = "scala"
// where to write generated code
override def destinationDir = "client/scala/src/main/scala"
// api invoker package
override def invokerPackage = "com.myapi.client"
// package for models
override def modelPackage = Some("com.myapi.client.model")
// package for api classes
override def apiPackage = Some("com.myapi.client.api")
// supporting classes
override def supportingFiles = List(
("apiInvoker.mustache", destinationDir + java.io.File.separator + packageName.replaceAll("\\.", java.io.File.separator), "ApiInvoker.scala"),
("pom.mustache", destinationDir, "pom.xml")
)
}
```
Now you can generate your client like this:
```
./bin/runscala.sh src/main/scala/MyCodegen.scala http://my.api.com/resources.json super-secret-key
```
w00t! Thanks to the scala interpretor, you didn't even need to recompile.
### Modifying the client library format
Don't like the default swagger client syntax? Want a different language supported? No problem! Swagger codegen
processes mustache templates with the [scalate](http://scalate.fusesource.org/) engine. You can modify our templates or
make your own.
You can look at `src/main/resources/${your-language}` for examples. To make your own templates, create your own files
and override the `templateDir` in your script to point to the right place. It actually is that easy.
### Where is Javascript???
See our [javascript library](http://github.com/wordnik/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:
```
-DfileMap=/path/to/resource-listing
```
Or for example:
```
./bin/java-petstore-filemap.sh
```
Which simple passes `-DfileMap=src/test/resources/petstore` as an argument. Great for creating libraries on your
ci server... or while coding on an airplane.
### Validating your swagger spec
You can use the validation tool to see that your server is creating a proper spec file. If you want to learn
more about the spec file and format, please see [swagger-core](https://github.com/wordnik/swagger-core/wiki). This
tool will read the server and generate a report of any violations of the spec. If there are violations, the
client codegen and ui may not work correctly.
To validate an api and write output to ./swagger-errors.html:
```
./bin/validate.sh http://petstore.swagger.wordnik.com/api/api-docs "specia-key" ./swagger-errors.html
```
### Generating static api documentation
If you need to make static pages or don't want the sandbox of the swagger-ui, you can use the codegen to build them. Remember, the engine is just using mustache templates--the output format is your call.
```
./bin/static-docs.sh
```
Will produce the output here:
```
https://github.com/wordnik/swagger-codegen/tree/master/samples/docs/swagger-static-docs
```
which is based on these templates:
```
https://github.com/wordnik/swagger-codegen/tree/master/src/main/resources/swagger-static
```
and looks like this
![Image](https://raw.github.com/wordnik/swagger-codegen/master/samples/docs/swagger-static-docs/static-docs.png)
### To build a server stub
You can also use the codegen to generate a server for a couple different frameworks. Take a look here:
* [javascript node.js Server generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/node)
* [ruby sinatra generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/sinatra)
* [scala scalatra generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/scalatra)
* [java jax-rs generator](https://github.com/wordnik/swagger-codegen/tree/master/samples/server-generator/java-jaxrs)
### Migrating from Swagger 1.1 to 1.2 format
If you've spent time hand-crafting your swagger spec files, you can use the [SpecConverter](https://github.com/wordnik/swagger-codegen/blob/master/src/main/scala/com/wordnik/swagger/codegen/SpecConverter.scala) to do the dirty work. For example:
```bash
$ ./bin/update-spec.sh http://developer.wordnik.com/v4/resources.json wordnik-developer
writing file wordnik-developer/api-docs
calling: http://developer.wordnik.com/v4/account.json
calling: http://developer.wordnik.com/v4/word.json
calling: http://developer.wordnik.com/v4/words.json
calling: http://developer.wordnik.com/v4/wordList.json
calling: http://developer.wordnik.com/v4/wordLists.json
writing file wordnik-developer/account
writing file wordnik-developer/word
writing file wordnik-developer/words
writing file wordnik-developer/wordList
writing file wordnik-developer/wordLists
```
Will read the 1.1 spec from wordnik developer and write it into the folder called `wordnik-developer`.
<pre>
export SCALA_HOME={PATH_TO_YOUR_SCALA_DEPLOYMENT}
</pre>
### To build the codegen library
You can build the client with the following:
This will create the swagger-codegen library from source.
````
mvn package
````
```
./sbt assembly
```
### 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 modify your codegen script to use a file path!
#### 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 2014 Wordnik, 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.

8
bin/Version.scala Normal file
View File

@@ -0,0 +1,8 @@
val version = scala.util.Properties.scalaPropOrElse("version.number", "unknown").toString match {
case "2.10.0" => "2.10"
case "2.10.2" => "2.10"
case "2.10.3" => "2.10"
case "2.10.4" => "2.10"
case e: String => e
}
println(version)

37
bin/all-petstore.sh Executable file
View File

@@ -0,0 +1,37 @@
#!/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/java-wordnik-api.sh
./bin/php-wordnik-api.sh
./bin/python3-wordnik-api.sh
./bin/objc-wordnik-api.sh
./bin/python-wordnik-api.sh
./bin/scala-wordnik-api.sh
./bin/android-java-petstore.sh
./bin/csharp-petstore.sh
./bin/flash-petstore.sh
./bin/java-petstore.sh
./bin/objc-petstore.sh
./bin/php-petstore.sh
./bin/python-petstore.sh
./bin/python3-petstore.sh
./bin/ruby-petstore.sh
./bin/scala-petstore.sh

32
bin/android-java-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/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
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
# 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="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/android-java-wordnik-api.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/android-java/AndroidJavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/csharp-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/csharp/CsharpPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/flash-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/flash/FlashPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

View File

@@ -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 "$@"

View File

@@ -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 "$@"

View File

@@ -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 "$@"

View File

@@ -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 "$@"

View File

@@ -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 "$@"

View File

@@ -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 "$@"

32
bin/java-petstore-filemap.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DfileMap=src/test/resources/petstore-1.1/resources.json -DloggerPath=conf/log4j.properties"
ags="$@ samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/java-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/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
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
# 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="$@ samples/client/petstore/java/JavaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/java-wordnik-api.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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 -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
ags="$@ samples/client/wordnik-api/java/JavaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

34
bin/objc-petstore.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
version="$(scala ./bin/Version.scala)"
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
# 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="$@ samples/client/petstore/objc/ObjcPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/objc-wordnik-api.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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 -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
ags="$@ samples/client/wordnik-api/objc/ObjcWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/php-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/php/PHPPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/php-wordnik-api.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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 -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
ags="$@ samples/client/wordnik-api/php/PHPWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/python-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/python/PythonPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/python-wordnik-api.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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 -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
ags="$@ samples/client/wordnik-api/python/PythonWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/python3-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/python3/Python3PetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/python3-wordnik-api.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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 -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
ags="$@ samples/client/wordnik-api/python3/Python3WordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/ruby-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/ruby/RubyPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

View File

@@ -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"

View File

@@ -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 "$@"

View File

@@ -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 "$@"

View File

@@ -1,17 +1,32 @@
#!/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;
#!/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
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 "$@"
if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi
cd $APP_DIR
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
# 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="$@"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

31
bin/scala-async.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=2.10 #$(scala ./bin/Version.scala)
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
# if you've executed sbt assembly previously it will use that instead.
ags="com.wordnik.swagger.codegen.ScalaAsyncClientGenerator $@"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
java -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/scala-petstore.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ samples/client/petstore/scala/ScalaPetstoreCodegen.scala http://petstore.swagger.wordnik.com/api/api-docs special-key"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/scala-wordnik-api.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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 -DfileMap=samples/client/wordnik-api/spec-files/resources.json"
ags="$@ samples/client/wordnik-api/scala/ScalaWordnikApiCodegen.scala http://api.wordnik.com/v4/resources.json"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

32
bin/static-docs.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# 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="$@ com.wordnik.swagger.codegen.SwaggerDocGenerator http://petstore.swagger.wordnik.com/api/api-docs"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

View File

@@ -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

View File

@@ -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

31
bin/update-spec.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# if you've executed sbt assembly previously it will use that instead.
ags="com.wordnik.swagger.codegen.SpecConverter $@"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

31
bin/validate.sh Executable file
View File

@@ -0,0 +1,31 @@
#!/bin/sh
SCRIPT="$0"
SCALA_RUNNER_VERSION=$(scala ./bin/Version.scala)
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
# if you've executed sbt assembly previously it will use that instead.
ags="com.wordnik.swagger.codegen.spec.Validator $@"
if [ -f $APP_DIR/target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar ]; then
scala -cp target/scala-$SCALA_RUNNER_VERSION/swagger-codegen.jar $ags
else
echo "Please set scalaVersion := \"$SCALA_RUNNER_VERSION\" in build.sbt and run ./sbt assembly"
fi

56
bin/yml2swagger.js Normal file
View File

@@ -0,0 +1,56 @@
fs = require('fs')
yaml = require('js-yaml')
var args = process.argv.splice(2);
if(args.length == 0) {
process.exit(1);
}
var arg0 = args[0];
var outputdir = ".";
if(args.length > 1) {
outputdir = args[1];
}
var file = fs.lstatSync(arg0);
if(file.isFile()) {
convert(arg0, outputdir);
}
else if (file.isDirectory()) {
var files = fs.readdirSync(arg0);
files.map(function(item) {
var filename = arg0 + "/" + item;
var file = fs.lstatSync(filename);
if(file.isFile()) {
convert(filename, outputdir);
}
});
}
function convert(filename, outputdir) {
console.log("converting " + filename);
fs.readFile(filename, "utf8", function (err, data) {
if(err) {
console.log(err);
}
else {
try {
var js = yaml.load(data);
var prettyJs = JSON.stringify(js, undefined, 2);
var outputFilename = outputdir + "/" + filename.split("/").pop().replace(".yml", "") + ".json";
console.log("writing to " + outputFilename);
fs.writeFile(outputFilename, prettyJs, function(err) {
if(err) {
console.log(err);
}
});
}
catch (err) {
console.log(err);
}
}
});
}

136
build.sbt Normal file
View File

@@ -0,0 +1,136 @@
import xml.Group
import AssemblyKeys._
organization := "com.wordnik"
name := "swagger-codegen"
version := "2.0.17"
crossVersion := CrossVersion.full
javacOptions ++= Seq("-target", "1.6", "-source", "1.6", "-Xlint:unchecked", "-Xlint:deprecation")
scalacOptions ++= Seq("-optimize", "-unchecked", "-deprecation", "-Xcheckinit", "-encoding", "utf8")
crossScalaVersions := Seq("2.10.0", "2.10.1", "2.10.2", "2.10.3", "2.10.4", "2.11.0", "2.11.1")
scalaVersion := "2.11.1"
libraryDependencies ++= Seq(
"org.json4s" %% "json4s-jackson" % "3.2.10",
"io.backchat.inflector" %% "scala-inflector" % "1.3.5",
"commons-io" % "commons-io" % "2.3",
"ch.qos.logback" % "logback-classic" % "1.0.13" % "provided",
"org.rogach" %% "scallop" % "0.9.5",
"junit" % "junit" % "4.11" % "test",
"org.scalatest" %% "scalatest" % "2.1.7" % "test"
)
libraryDependencies <+= scalaVersion {
case v if v.startsWith("2.9") =>
"org.fusesource.scalate" % "scalate-core_2.9" % "1.6.1"
case v if v.startsWith("2.10") =>
"org.scalatra.scalate" %% "scalate-core" % "1.7.0"
case v if v.startsWith("2.11") =>
"org.scalatra.scalate" %% "scalate-core" % "1.7.0"
}
libraryDependencies ++= {
scalaVersion.toString match {
case v if v.startsWith("2.10") || v.startsWith("2.11") => Seq("org.scala-lang" % "scala-reflect" % v)
case _ => Seq()
}
}
resolvers += "Typesafe releases" at "http://repo.typesafe.com/typesafe/releases"
packageOptions <+= (name, version, organization) map {
(title, version, vendor) =>
Package.ManifestAttributes(
"Created-By" -> "Simple Build Tool",
"Built-By" -> System.getProperty("user.name"),
"Build-Jdk" -> System.getProperty("java.version"),
"Specification-Title" -> title,
"Specification-Version" -> version,
"Specification-Vendor" -> vendor,
"Implementation-Title" -> title,
"Implementation-Version" -> version,
"Implementation-Vendor-Id" -> vendor,
"Implementation-Vendor" -> vendor
)
}
publishTo <<= (version) { version: String =>
if (version.trim.endsWith("SNAPSHOT"))
Some("Sonatype Nexus Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots")
else
Some("Sonatype Nexus Releases" at "https://oss.sonatype.org/service/local/staging/deploy/maven2")
}
// publishTo := Some(Resolver.file("file", new File(Path.userHome.absolutePath+"/.m2/repository")))
artifact in (Compile, assembly) ~= { art =>
art.copy(`classifier` = Some("assembly"))
}
addArtifact(artifact in (Compile, assembly), assembly)
publishMavenStyle := true
publishArtifact in Test := false
pomIncludeRepository := { x => false }
credentials += Credentials(Path.userHome / ".ivy2" / ".credentials")
homepage := Some(new URL("https://github.com/wordnik/swagger-codegen"))
parallelExecution in Test := false
startYear := Some(2009)
licenses := Seq(("Apache License 2.0", new URL("http://www.apache.org/licenses/LICENSE-2.0.html")))
pomExtra <<= (pomExtra, name, description) {(pom, name, desc) => pom ++ Group(
<scm>
<connection>scm:git:git@github.com:wordnik/swagger-codegen.git</connection>
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
<url>https://github.com/wordnik/swagger-codegen</url>
</scm>
<issueManagement>
<system>github</system>
<url>https://github.com/wordnik/swagger-codegen/issues</url>
</issueManagement>
<developers>
<developer>
<id>rpidikiti</id>
<name>Ramesh Pidikiti</name>
<email>ramesh@wordnik.com</email>
</developer>
<developer>
<id>ayush</id>
<name>Ayush Gupta</name>
<email>ayush@glugbot.com</email>
</developer>
<developer>
<id>fehguy</id>
<name>Tony Tam</name>
<email>fehguy@gmail.com</email>
</developer>
<developer>
<id>casualjim</id>
<name>Ivan Porto Carrero</name>
<url>http://flanders.co.nz/</url>
</developer>
<developer>
<id>radius314</id>
<name>Danny Gershman</name>
<email>danny.gershman@gmail.com</email>
</developer>
</developers>
)}
assemblySettings
// jarName in assembly := "swagger-codegen.jar"

View File

@@ -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"
}

View File

@@ -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
}
]
}

View File

@@ -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"
}
]
}
]
}
]
}

View File

@@ -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;
}
}
}

View File

@@ -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>

View File

@@ -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;
// }
}
}

View File

@@ -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());
}
};

View File

@@ -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$}$
}
}

View File

@@ -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$}$
}
}

View File

@@ -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;
}
}$
}
}

View File

@@ -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;
}
}
}

View File

@@ -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$}$
}
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"
}

View File

@@ -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
}
]
}

View File

@@ -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"
}
]
}
]
}
]
}

View File

@@ -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());
}
}

View File

@@ -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$;
}
}$
}

View File

@@ -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;
}
}

View File

@@ -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"
}

File diff suppressed because one or more lines are too long

View File

@@ -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>

View File

@@ -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(",");
}
};

View File

@@ -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());
}
};

View File

@@ -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;
}
}

View File

@@ -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};
}
}$
}

View File

@@ -1,8 +0,0 @@
/**
* Maintains the compatible server version against which the drive is written
*
*/
var VersionChecker = new function() {
this.compatibleVersion = "$apiVersion$";
}

View File

@@ -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$}$
}

View File

@@ -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;
}
}
?>

View File

@@ -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$
}
}$
}

View File

@@ -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

View File

@@ -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$
}$

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"
}

View File

@@ -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
}
]
}

View File

@@ -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"
}
]
}
]
}
]
}

View File

@@ -1 +0,0 @@
# nothing to see yet

View File

@@ -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

View File

@@ -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
}$

View File

@@ -1,5 +0,0 @@
module $resource$
def get_compatible_version(*args)
'$apiVersion$'
end

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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"
}

View File

@@ -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
}
]
}

View File

@@ -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"
}
]
}
]
}
]
}

View File

@@ -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 "$ + "]"
}
}

View File

@@ -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;
}
}

124
distro/pom.xml.disabled Normal file
View File

@@ -0,0 +1,124 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>5</version>
</parent>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen-distribution</artifactId>
<packaging>jar</packaging>
<version>2.0.2-SNAPSHOT</version>
<name>swagger-codegen-distribution</name>
<url>https://github.com/wordnik/swagger-codegen</url>
<scm>
<connection>scm:git:git@github.com:wordnik/swagger-codegen.git</connection>
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
<url>https://github.com/wordnik/swagger-codegen</url>
</scm>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<developers>
<developer>
<id>fehguy</id>
<name>Tony Tam</name>
<email>fehguy@gmail.com</email>
</developer>
</developers>
<issueManagement>
<system>github</system>
<url>https://github.com/wordnik/swagger-codegen/issues</url>
</issueManagement>
<mailingLists>
<mailingList>
<name>wordnik-api</name>
<archive>https://groups.google.com/forum/#!forum/wordnik-api</archive>
</mailingList>
</mailingLists>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<build>
<plugins>
<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>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<executions>
<execution>
<id>distro-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.3</version>
<configuration>
<descriptors>
<descriptor>src/main/assembly/distribution.xml</descriptor>
</descriptors>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>src-dependencies</id>
<phase>package</phase>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeGroupIds>com.wordnik</includeGroupIds>
<includeArtifactIds>text-data</includeArtifactIds>
<outputDirectory>${project.build.directory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen_2.9.1</artifactId>
<version>${swagger.codegen.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>
<swagger.codegen.version>2.0.2-SNAPSHOT</swagger.codegen.version>
</properties>
</project>

View File

@@ -0,0 +1,29 @@
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>distribution</id>
<baseDirectory>swagger-codegen</baseDirectory>
<includeBaseDirectory>false</includeBaseDirectory>
<formats>
<format>zip</format>
</formats>
<dependencySets>
<dependencySet>
<scope>compile</scope>
<outputDirectory>target/lib</outputDirectory>
<includes>
<include>*:jar:*</include>
</includes>
</dependencySet>
</dependencySets>
<fileSets>
<fileSet>
<directory>../bin</directory>
<includes>
<include>*.*</include>
</includes>
<outputDirectory>bin</outputDirectory>
</fileSet>
</fileSets>
</assembly>

16
package.json Normal file
View File

@@ -0,0 +1,16 @@
{
"name": "swagger-yaml",
"version": "2.0.1",
"description": "Converts yaml to swagger json",
"author": {
"name": "Tony Tam",
"email": "fehguy@gmail.com",
"url": "http://developer.wordnik.com"
},
"license": "Apache",
"readmeFilename": "README.md",
"dependencies": {
"json2yaml": "~1.0",
"js-yaml": "~3.0"
}
}

405
pom.xml
View File

@@ -1,405 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wordnik</groupId>
<artifactId>swagger-codegen_2.9.1</artifactId>
<packaging>jar</packaging>
<name>swagger-codegen</name>
<version>1.1</version>
<scm>
<connection>scm:git:git@github.com:wordnik/swagger-codegen.git</connection>
<developerConnection>scm:git:git@github.com:wordnik/swagger-codegen.git</developerConnection>
<url>https://github.com/wordnik/swagger-codegen</url>
</scm>
<prerequisites>
<maven>2.2.0</maven>
</prerequisites>
<pluginRepositories>
<pluginRepository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>copy-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/conf</outputDirectory>
<resources>
<resource>
<directory>conf</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-java-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/conf/java/structure/src/main/java/com/wordnik/swagger/runtime</outputDirectory>
<resources>
<resource>
<directory>src/main/java/com/wordnik/swagger/runtime/</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>copy-scala-resources</id>
<!-- here the phase you need -->
<phase>validate</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/conf/scala/structure/src/main/java/com/wordnik/swagger/runtime</outputDirectory>
<resources>
<resource>
<directory>src/main/java/com/wordnik/swagger/runtime/</directory>
<filtering>true</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</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>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add_sources</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>src/main/java</source>
</sources>
</configuration>
</execution>
<execution>
<id>add_test_sources</id>
<phase>generate-test-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>src/test/java</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<id>scala-compile-first</id>
<phase>process-resources</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>scala-test-compile</id>
<phase>process-test-resources</phase>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<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>org.scala-tools</groupId>
<artifactId>maven-scala-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>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin>
</plugins>
</reporting>
<dependencies>
<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>1.4.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-ext</artifactId>
<version>${slf4j-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>${jersey-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>${jersey-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${jersey-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${jersey-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.antlr</groupId>
<artifactId>stringtemplate</artifactId>
<version>${org.antlr-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala-version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.1</artifactId>
<version>${scala-test-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons-lang-version}</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>oss.sonatype.org</id>
<url>http://oss.sonatype.org/content/repositories/releases</url>
</repository>
<repository>
<id>oss.sonatype.org-snapshot</id>
<url>http://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
<repository>
<id>scala-tools.org</id>
<name>Scala-Tools Maven2 Repository</name>
<url>http://scala-tools.org/repo-releases</url>
</repository>
<repository>
<id>jboss</id>
<url>https://repository.jboss.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>codehaus</id>
<name>repository.codehaus.org</name>
<url>http://repository.codehaus.org</url>
</repository>
<repository>
<id>codehaus-snapshots</id>
<url>http://snapshots.repository.codehaus.org</url>
</repository>
</repositories>
<properties>
<scala-version>2.9.1-1</scala-version>
<scala-test-version>1.6.1</scala-test-version>
<swagger-codegen-version>1.1</swagger-codegen-version>
<servlet-api-version>2.5</servlet-api-version>
<jersey-version>1.7</jersey-version>
<jackson-version>1.7.7</jackson-version>
<junit-version>4.8.1</junit-version>
<maven-plugin.version>1.0.0</maven-plugin.version>
<commons-beanutils-version>1.8.0</commons-beanutils-version>
<commons-lang-version>2.4</commons-lang-version>
<slf4j-version>1.5.8</slf4j-version>
<org.antlr-version>3.2</org.antlr-version>
</properties>
</project>

1
project/build.properties Normal file
View File

@@ -0,0 +1 @@
sbt.version=0.13.0

5
project/plugins.sbt Normal file
View File

@@ -0,0 +1,5 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.2")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.9.1")
resolvers += "Sonatype OSS Releases" at "https://oss.sonatype.org/content/repositories/releases"

Some files were not shown because too many files have changed in this diff Show More