Compare commits

...

428 Commits

Author SHA1 Message Date
ShubhamRwt
c2597a585e Publish of Github pages from Gradle. 2022-03-01 00:38:53 +05:30
Travis CI User
4df779b4cc Publish of Github pages from Gradle. 2019-03-21 14:46:25 +00:00
Travis CI User
8b9d3fe588 Publish of Github pages from Gradle. 2019-03-21 14:45:30 +00:00
Travis CI User
4d4f4ad7d2 Publish of Github pages from Gradle. 2018-11-21 12:08:28 +00:00
Travis CI User
40467c0186 Publish of Github pages from Gradle. 2018-11-05 09:47:30 +00:00
Travis CI User
a2dc4080d5 Publish of Github pages from Gradle. 2018-10-22 18:25:29 +00:00
Travis CI User
76dced1209 Publish of Github pages from Gradle. 2018-10-18 07:25:26 +00:00
Travis CI User
1060b78622 Publish of Github pages from Gradle. 2018-10-15 08:19:24 +00:00
Travis CI User
23d3f336d5 Publish of Github pages from Gradle. 2018-08-06 10:54:24 +00:00
Travis CI User
5a70512c23 Publish of Github pages from Gradle. 2018-08-06 08:34:24 +00:00
Travis CI User
3c94b8605f Publish of Github pages from Gradle. 2018-07-12 13:28:18 +00:00
Travis CI User
e17311bd7e Publish of Github pages from Gradle. 2018-05-01 19:39:44 +00:00
Travis CI User
fecb5e2e61 Publish of Github pages from Gradle. 2018-04-29 09:46:16 +00:00
Travis CI User
79629d11ae Publish of Github pages from Gradle. 2018-04-27 11:47:33 +00:00
Robert Winkler
6f1efabf94 Publish of Github pages from Gradle. 2018-04-27 11:39:52 +00:00
Travis CI User
393bbe10fd Publish of Github pages from Gradle. 2017-10-09 09:00:12 +00:00
Travis CI User
ab0ce79172 Publish of Github pages from Gradle. 2017-10-05 17:44:55 +00:00
travis
1311ce90b9 Publish of Github pages from Gradle. 2017-07-20 14:37:35 +00:00
travis
e19ed182ff Publish of Github pages from Gradle. 2017-07-17 07:18:40 +00:00
travis
8797e00321 Publish of Github pages from Gradle. 2017-07-17 07:17:54 +00:00
travis
1721a95e07 Publish of Github pages from Gradle. 2017-07-11 07:09:07 +00:00
travis
dac7550bcc Publish of Github pages from Gradle. 2017-05-15 11:08:59 +00:00
travis
44c0507b4e Publish of Github pages from Gradle. 2017-05-15 06:49:19 +00:00
travis
e69b8295dd Publish of Github pages from Gradle. 2017-03-20 11:36:59 +00:00
travis
e8cec2467b Publish of Github pages from Gradle. 2017-03-20 11:33:58 +00:00
Robert Winkler
2cf2593e96 Publish of Github pages from Gradle. 2017-03-20 12:33:47 +01:00
travis
f1a1e52988 Publish of Github pages from Gradle. 2017-03-20 11:32:21 +00:00
travis
820d6dcb47 Publish of Github pages from Gradle. 2017-03-17 08:28:47 +00:00
travis
ea7643fc67 Publish of Github pages from Gradle. 2017-03-16 08:04:55 +00:00
travis
72b84a184e Publish of Github pages from Gradle. 2017-03-14 15:46:39 +00:00
travis
42b0cf8cf0 Publish of Github pages from Gradle. 2017-02-20 07:45:53 +00:00
travis
b0390b1f9a Publish of Github pages from Gradle. 2017-02-20 07:43:57 +00:00
travis
634598c5d4 Publish of Github pages from Gradle. 2017-02-20 07:42:15 +00:00
travis
e08de663d5 Publish of Github pages from Gradle. 2017-02-20 07:41:36 +00:00
Robert Winkler
76347aa49e Publish of Github pages from Gradle. 2017-02-20 08:36:53 +01:00
travis
b0d6183de3 Publish of Github pages from Gradle. 2017-02-03 08:37:29 +00:00
travis
67fe8f70b3 Publish of Github pages from Gradle. 2017-02-03 08:11:18 +00:00
travis
8bcbb5fcfa Publish of Github pages from Gradle. 2017-02-02 08:00:52 +00:00
travis
972497a9a5 Publish of Github pages from Gradle. 2017-01-21 09:37:50 +00:00
travis
fbb98fb446 Publish of Github pages from Gradle. 2017-01-19 13:28:45 +00:00
travis
27a34c519b Publish of Github pages from Gradle. 2017-01-19 13:21:53 +00:00
travis
8ab88d95c8 Publish of Github pages from Gradle. 2017-01-19 09:27:37 +00:00
travis
ca60025907 Publish of Github pages from Gradle. 2017-01-18 11:01:05 +00:00
travis
184b0222a3 Publish of Github pages from Gradle. 2017-01-18 10:55:07 +00:00
travis
b6f4cec736 Publish of Github pages from Gradle. 2017-01-17 09:46:43 +00:00
travis
66fad7ea30 Publish of Github pages from Gradle. 2017-01-13 13:16:54 +00:00
travis
57fa494b95 Publish of Github pages from Gradle. 2017-01-13 13:16:12 +00:00
travis
5ec39bba49 Publish of Github pages from Gradle. 2017-01-13 13:15:29 +00:00
travis
9ecad42092 Publish of Github pages from Gradle. 2017-01-13 13:15:23 +00:00
travis
8914176db0 Publish of Github pages from Gradle. 2017-01-13 12:56:11 +00:00
travis
66757a39fd Publish of Github pages from Gradle. 2017-01-13 12:55:55 +00:00
travis
05818f8abf Publish of Github pages from Gradle. 2017-01-09 11:23:23 +00:00
travis
f6edc96b49 Publish of Github pages from Gradle. 2017-01-05 13:33:25 +00:00
travis
5818025e65 Publish of Github pages from Gradle. 2017-01-05 13:33:07 +00:00
Robert Winkler
cd4a65c3d8 Publish of Github pages from Gradle. 2017-01-05 14:28:10 +01:00
travis
6f0e33c6d5 Publish of Github pages from Gradle. 2017-01-03 15:04:35 +00:00
travis
8a4ec35d47 Publish of Github pages from Gradle. 2017-01-03 14:31:53 +00:00
travis
319a8b68a8 Publish of Github pages from Gradle. 2017-01-03 10:25:50 +00:00
travis
109710b94e Publish of Github pages from Gradle. 2017-01-02 12:50:46 +00:00
travis
f02606abfc Publish of Github pages from Gradle. 2016-12-20 13:10:53 +00:00
travis
324f9a719c Publish of Github pages from Gradle. 2016-12-19 15:08:47 +00:00
travis
ac8332f1ed Publish of Github pages from Gradle. 2016-12-13 09:48:01 +00:00
travis
0cc153d896 Publish of Github pages from Gradle. 2016-12-13 09:02:35 +00:00
travis
9652d91723 Publish of Github pages from Gradle. 2016-12-09 08:21:39 +00:00
travis
dfab76f1c2 Publish of Github pages from Gradle. 2016-11-30 08:22:40 +00:00
Robert Winkler
711886bb90 Publish of Github pages from Gradle. 2016-11-30 09:17:48 +01:00
Robert Winkler
4f001e104f Publish of Github pages from Gradle. 2016-11-30 09:16:40 +01:00
travis
2befad39d0 Publish of Github pages from Gradle. 2016-11-30 08:12:17 +00:00
travis
223250693c Publish of Github pages from Gradle. 2016-11-18 11:41:40 +00:00
travis
8e6737fe79 Publish of Github pages from Gradle. 2016-11-16 11:58:01 +00:00
travis
667bd30dfd Publish of Github pages from Gradle. 2016-11-15 13:54:25 +00:00
travis
4a6c1a6e32 Publish of Github pages from Gradle. 2016-11-15 10:16:09 +00:00
travis
b365766cb4 Publish of Github pages from Gradle. 2016-11-14 15:21:40 +00:00
travis
7279daf5df Publish of Github pages from Gradle. 2016-11-11 13:26:54 +00:00
travis
5af951598d Publish of Github pages from Gradle. 2016-11-10 11:48:01 +00:00
travis
ffa27aa177 Publish of Github pages from Gradle. 2016-11-09 15:35:07 +00:00
travis
57a61ce839 Publish of Github pages from Gradle. 2016-11-04 14:38:15 +00:00
travis
a6576761c7 Publish of Github pages from Gradle. 2016-11-02 07:52:04 +00:00
travis
c427efaca3 Publish of Github pages from Gradle. 2016-11-01 13:51:22 +00:00
travis
ff2e3654c1 Publish of Github pages from Gradle. 2016-11-01 08:01:19 +00:00
travis
86b7577fd0 Publish of Github pages from Gradle. 2016-11-01 06:10:51 +00:00
travis
dd04f559d5 Publish of Github pages from Gradle. 2016-10-28 07:14:15 +00:00
travis
d828ab31f9 Publish of Github pages from Gradle. 2016-10-25 13:33:40 +00:00
travis
586596c5a1 Publish of Github pages from Gradle. 2016-10-18 13:47:49 +00:00
travis
00e723fbb8 Publish of Github pages from Gradle. 2016-10-18 13:35:44 +00:00
travis
5f844db4c5 Publish of Github pages from Gradle. 2016-10-18 13:26:17 +00:00
travis
fe93add209 Publish of Github pages from Gradle. 2016-10-14 05:17:51 +00:00
travis
753ad57059 Publish of Github pages from Gradle. 2016-10-12 06:53:21 +00:00
travis
c2a8d0d5eb Publish of Github pages from Gradle. 2016-10-03 11:52:30 +00:00
travis
36958d78aa Publish of Github pages from Gradle. 2016-09-23 08:37:11 +00:00
travis
704e20ef5c Publish of Github pages from Gradle. 2016-09-23 08:27:38 +00:00
travis
0104b8cfe8 Publish of Github pages from Gradle. 2016-09-23 07:00:22 +00:00
travis
43292024b6 Publish of Github pages from Gradle. 2016-09-14 08:02:58 +00:00
travis
ca8cc35004 Publish of Github pages from Gradle. 2016-09-12 08:08:19 +00:00
travis
f427e77b78 Publish of Github pages from Gradle. 2016-09-12 07:56:01 +00:00
travis
4d876c33a6 Publish of Github pages from Gradle. 2016-08-31 08:29:02 +00:00
travis
04f6239fd3 Publish of Github pages from Gradle. 2016-08-25 11:56:37 +00:00
travis
156f1ce880 Publish of Github pages from Gradle. 2016-08-12 18:06:22 +00:00
travis
836fcd6829 Publish of Github pages from Gradle. 2016-08-04 10:16:16 +00:00
travis
4a741acda2 Publish of Github pages from Gradle. 2016-08-04 08:37:40 +00:00
travis
857dd34992 Publish of Github pages from Gradle. 2016-08-04 08:20:52 +00:00
travis
84ad0ccaa7 Publish of Github pages from Gradle. 2016-08-04 08:15:23 +00:00
travis
128710cf50 Publish of Github pages from Gradle. 2016-08-04 08:14:44 +00:00
Robert Winkler
26cd23941a Publish of Github pages from Gradle. 2016-08-04 10:06:56 +02:00
Robert Winkler
d51684196d Publish of Github pages from Gradle. 2016-08-04 09:55:43 +02:00
travis
3f2f91f134 Publish of Github pages from Gradle. 2016-08-03 08:18:53 +00:00
travis
c62bcb02c2 Publish of Github pages from Gradle. 2016-07-30 18:37:46 +00:00
travis
de76eac12e Publish of Github pages from Gradle. 2016-06-01 13:05:39 +00:00
travis
dee68deb4d Publish of Github pages from Gradle. 2016-05-29 05:16:30 +00:00
travis
df4b6b8684 Publish of Github pages from Gradle. 2016-05-28 19:23:56 +00:00
travis
b49b7e01b9 Publish of Github pages from Gradle. 2016-05-28 18:55:43 +00:00
travis
12d3a5569a Publish of Github pages from Gradle. 2016-05-28 18:54:01 +00:00
travis
839a67aa18 Publish of Github pages from Gradle. 2016-05-28 18:53:07 +00:00
travis
c9a4e174db Publish of Github pages from Gradle. 2016-05-28 18:40:39 +00:00
travis
92adc61544 Publish of Github pages from Gradle. 2016-05-28 18:31:39 +00:00
travis
de24d5811c Publish of Github pages from Gradle. 2016-05-28 18:30:21 +00:00
travis
35e953d6b2 Publish of Github pages from Gradle. 2016-05-28 18:26:24 +00:00
travis
2728708af3 Publish of Github pages from Gradle. 2016-05-26 14:28:17 +00:00
travis
6f75fb6649 Publish of Github pages from Gradle. 2016-05-26 11:28:28 +00:00
travis
19dc822316 Publish of Github pages from Gradle. 2016-05-26 09:30:26 +00:00
travis
94d08b24d1 Publish of Github pages from Gradle. 2016-05-26 06:29:44 +00:00
travis
0a92457e41 Publish of Github pages from Gradle. 2016-05-24 12:26:44 +00:00
travis
03f19e7c25 Publish of Github pages from Gradle. 2016-05-12 08:01:55 +00:00
travis
4ddab7c8be Publish of Github pages from Gradle. 2016-05-04 19:11:52 +00:00
travis
101883f3b3 Publish of Github pages from Gradle. 2016-05-02 11:29:16 +00:00
travis
49da3d0fef Publish of Github pages from Gradle. 2016-05-02 11:13:15 +00:00
travis
6858dcd424 Publish of Github pages from Gradle. 2016-04-19 11:14:15 +00:00
travis
21e37a8cb3 Publish of Github pages from Gradle. 2016-04-19 08:58:24 +00:00
travis
7f116674b5 Publish of Github pages from Gradle. 2016-04-19 08:44:28 +00:00
travis
9c31fc416c Publish of Github pages from Gradle. 2016-04-15 10:29:41 +00:00
travis
0da081c0b4 Publish of Github pages from Gradle. 2016-04-14 15:57:42 +00:00
travis
d4973918f6 Publish of Github pages from Gradle. 2016-04-14 14:52:22 +00:00
travis
0ecda51555 Publish of Github pages from Gradle. 2016-04-14 14:47:54 +00:00
travis
de26a4fec3 Publish of Github pages from Gradle. 2016-04-14 13:59:44 +00:00
travis
f6481a7f21 Publish of Github pages from Gradle. 2016-04-14 13:39:05 +00:00
travis
f5291e3450 Publish of Github pages from Gradle. 2016-04-14 10:43:33 +00:00
Robert Winkler
ddf3265d4b Publish of Github pages from Gradle. 2016-04-13 14:23:51 +02:00
Robert Winkler
653420fa02 Publish of Github pages from Gradle. 2016-04-13 14:07:15 +02:00
Robert Winkler
a98247adb4 Publish of Github pages from Gradle. 2016-04-12 16:06:31 +02:00
Robert Winkler
f26ba312a7 Publish of Github pages from Gradle. 2016-04-06 13:05:42 +02:00
Robert Winkler
447c4ca3c2 Publish of Github pages from Gradle. 2016-04-06 09:31:48 +02:00
Robert Winkler
6189f710e1 Publish of Github pages from Gradle. 2016-04-06 09:29:37 +02:00
Robert Winkler
5dcb0a3549 Publish of Github pages from Gradle. 2016-04-06 09:22:13 +02:00
Robert Winkler
060f3f859b Publish of Github pages from Gradle. 2016-04-06 09:04:53 +02:00
Robert Winkler
e465c7ff26 Publish of Github pages from Gradle. 2016-04-06 09:01:57 +02:00
Robert Winkler
152083bfa6 Publish of Github pages from Gradle. 2016-04-06 08:55:35 +02:00
Robert Winkler
5b2c34657e Publish of Github pages from Gradle. 2016-04-06 08:20:04 +02:00
Robert Winkler
d0fba73012 Publish of Github pages from Gradle. 2016-04-06 08:12:44 +02:00
Robert Winkler
1703b26626 Publish of Github pages from Gradle. 2016-04-06 08:01:49 +02:00
Robert Winkler
08e445c579 Publish of Github pages from Gradle. 2016-04-05 15:56:09 +02:00
Robert Winkler
da792f6fb8 Publish of Github pages from Gradle. 2016-04-05 15:54:50 +02:00
Robert Winkler
dd606d65ad Publish of Github pages from Gradle. 2016-04-05 15:53:40 +02:00
Robert Winkler
416aefdaf0 Publish of Github pages from Gradle. 2016-04-05 15:51:30 +02:00
Robert Winkler
b725e7324f Publish of Github pages from Gradle. 2016-04-05 15:47:36 +02:00
Robert Winkler
ffb53aac33 Publish of Github pages from Gradle. 2016-04-05 15:37:14 +02:00
Robert Winkler
cbf1b50107 Publish of Github pages from Gradle. 2016-04-05 15:21:09 +02:00
Robert Winkler
92438b20db Publish of Github pages from Gradle. 2016-04-05 15:14:04 +02:00
Robert Winkler
4134a78185 Publish of Github pages from Gradle. 2016-04-05 15:06:46 +02:00
Robert Winkler
ea8829a288 Publish of Github pages from Gradle. 2016-04-05 15:03:20 +02:00
Robert Winkler
268815ac10 Publish of Github pages from Gradle. 2016-04-05 14:57:10 +02:00
Robert Winkler
4ebfda1e94 Publish of Github pages from Gradle. 2016-04-05 14:53:52 +02:00
Robert Winkler
6c7a9ad46e Publish of Github pages from Gradle. 2016-04-05 13:43:44 +02:00
Robert Winkler
857ae5a3f7 Publish of Github pages from Gradle. 2016-04-05 13:18:16 +02:00
Robert Winkler
b881d7f8b5 Publish of Github pages from Gradle. 2016-04-04 16:39:03 +02:00
Robert Winkler
8014c4ba77 Publish of Github pages from Gradle. 2016-04-04 12:23:24 +02:00
Robert Winkler
8443ddc2dc Publish of Github pages from Gradle. 2016-04-04 11:19:21 +02:00
Robert Winkler
a6cf1b51c6 Publish of Github pages from Gradle. 2016-04-04 11:16:38 +02:00
Robert Winkler
5065d4c744 Publish of Github pages from Gradle. 2016-04-01 15:00:21 +02:00
Robert Winkler
7435dc8e1a Publish of Github pages from Gradle. 2016-04-01 14:56:41 +02:00
Robert Winkler
4eb0ee49f6 Publish of Github pages from Gradle. 2016-03-23 16:32:14 +01:00
Robert Winkler
b8984ca5f5 Publish of Github pages from Gradle. 2016-03-22 16:39:07 +01:00
Robert Winkler
b2bceaece0 Publish of Github pages from Gradle. 2016-03-22 16:34:23 +01:00
Robert Winkler
79446a84f1 Publish of Github pages from Gradle. 2016-03-10 10:06:42 +01:00
Robert Winkler
cd023a99b5 Updated introduction. 2016-03-09 16:44:49 +01:00
Robert Winkler
a339e78135 Added initial AsciiDoc documentation for release v1.0.0. 2016-03-09 16:41:30 +01:00
Robert Winkler
1425414b4a Moved AsciiDoc and Markdown documents which are required by the test into "src/test/resources/docs". 2016-03-09 16:16:52 +01:00
Robert Winkler
a8e189408a Merge branch 'develop' of https://github.com/Swagger2Markup/swagger2markup into develop 2016-03-09 15:19:58 +01:00
Robert Winkler
fbb535d241 Removed new line from swagger_inlineSchema.yaml 2016-03-09 15:18:26 +01:00
Robert Winkler
7d6fc09c24 Fixed expected test results after adding support for HTTP headers in Responses 2016-03-09 13:58:06 +01:00
Robert Winkler
00f62124af Added missing JavaDoc to DynamicSecurityDocumentExtension
Added missing Enums in DynamicSecurityDocumentExtension::apply
2016-03-09 13:35:12 +01:00
Robert Winkler
138be996db Renamed MarkupDocumentBuilder::typeProperties to MarkupDocumentBuilder::buildPropertiesTable
Renamed DefinitionsDocumentBuilder::definition to DefinitionsDocumentBuilder::buildDefinition
Added a description paragraph to SecurityDocumentBuilder::buildSecuritySchemeDefinitionsSection
2016-03-09 13:34:26 +01:00
Robert Winkler
722b2b24b7 Added the name of the definition and the SecuritySchemeDefinition to the SecurityDocumentExtension.Context. 2016-03-09 13:04:53 +01:00
Robert Winkler
d90d68332f Updated version of Apache commons collection
Remove library dependencies which are already included in markup-document-builder
2016-03-09 12:39:04 +01:00
Robert Winkler
0470d984cc Updated version 2016-03-08 20:14:52 +01:00
Robert Winkler
c001452abf Renamed and refactored some methods in the document builder.
Fixed Javadoc.
2016-03-08 12:34:53 +01:00
Robert Winkler
b25378463c Renamed Position enums. 2016-03-08 12:32:25 +01:00
Robert Winkler
63d3a95529 Added global parameter and response to swagger_petstore to test #102 and #103 2016-03-08 11:10:14 +01:00
Robert Winkler
1c1eb106d6 Renamed and refactored some methods in the document builder. 2016-03-08 09:54:30 +01:00
Robert Winkler
916d2515b0 Renamed resource folder which contains the expected test results. 2016-03-08 09:53:08 +01:00
Robert Winkler
caff7db0d4 Merge branch 'master' of https://github.com/Swagger2Markup/swagger2markup into develop
Conflicts:
	src/main/resources/io/github/robwin/swagger2markup/lang/labels_ru.properties
2016-03-07 16:21:50 +01:00
Robert Winkler
85006b2c15 Merge pull request #104 from MeteorBoom/master
Russian propirties update
2016-03-07 16:11:51 +01:00
Maksim Myshkin
727c6c6467 Russian propirties update 2016-03-07 20:05:38 +05:00
Robert Winkler
12fc80c8b0 Fixes #101: Rename extensions. Content should be renamed to Document 2016-03-07 16:03:13 +01:00
Robert Winkler
97ae3df30d Refactored visibility of classes. 2016-03-07 15:58:43 +01:00
Robert Winkler
3189043b7f Refactored package structure into an API (root), a SPI (service provider interface) and internal classes which should not be used by a user directly. 2016-03-07 15:28:46 +01:00
Robert Winkler
9f01adfb25 Removed withLineSeparator from unit tests, because it fails on TravisCI. 2016-03-07 12:52:33 +01:00
Robert Winkler
5155e6510f Renamed MarkupDocument to MarkupDocumentBuilder which builds an MarkupDocument now. 2016-03-07 12:51:32 +01:00
Robert Winkler
37d99eb86f Renamed AbstractExtension::onUpdateGlobalContext to AbstractExtension::init 2016-03-07 12:50:40 +01:00
Robert Winkler
014e9354ce Merge pull request #99 from Swagger2Markup/features/schema-ext
moved definitions Schema implementation to SchemaExtension
2016-03-07 11:26:28 +01:00
Robert Winkler
c8ecab6d78 Fixed broken GeneralConverterTest 2016-03-07 11:20:18 +01:00
Robert Winkler
2e7e10aaae Merge branch 'develop' into features/schema-ext
Conflicts:
	src/test/java/io/github/robwin/swagger2markup/Swagger2MarkupConverterTest.java
2016-03-07 11:16:00 +01:00
Robert Winkler
9f197074ef The line separator which should be used can be configured now. 2016-03-07 11:10:28 +01:00
Robert Winkler
5b054761cf Added expected AsciiDoc and Markdown files. 2016-03-07 11:08:51 +01:00
Hugo de Paix de Coeur
be3ae6bd0d Merge branch 'develop' into features/schema-ext
# Conflicts:
#	src/main/java/io/github/robwin/swagger2markup/config/Swagger2MarkupConfig.java
2016-03-04 17:42:01 +01:00
Hugo de Paix de Coeur
71980aafeb moved definitions Schema implementation to SchemaExtension 2016-03-04 17:38:19 +01:00
Robert Winkler
d1c20ed325 Merge pull request #98 from atomfrede/master
add wescale as using company
2016-03-04 17:35:38 +01:00
Frederik Hahne
16f559cd70 add wescale as using company 2016-03-04 17:24:07 +01:00
Robert Winkler
d0dc6188cd Removed io.spring.gradle:dependency-management-plugin 2016-03-04 14:54:25 +01:00
Robert Winkler
e79f6c49a4 Moved testSwagger2MarkupConfigDefaultPathsWithoutFile from MarkdownConvertTest into GeneralConverterTest. 2016-03-04 13:32:37 +01:00
Robert Winkler
4ec11f8359 Separated AsciiDocConverterTest into three different files. 2016-03-04 13:30:03 +01:00
Robert Winkler
52c1780f79 AS_IS ordering of path operations does not work yet, because of https://github.com/swagger-api/swagger-core/issues/1696.
New default value is NATURAL.
2016-03-04 13:20:56 +01:00
Robert Winkler
c6becb9995 Merge remote-tracking branch 'origin/develop' into develop 2016-03-04 12:15:10 +01:00
Robert Winkler
194efab1f6 Added a DiffUtils class which can be used to assert that the content of the generated files are not different to the content of the expected files. 2016-03-04 12:14:37 +01:00
Hugo de Paix de Coeur
34af7a4899 Disabled inter-document cross-references when using withSeparatedOperations() without withInterDocumentCrossReferences(), for consistency with definitions cross-references. 2016-03-04 11:50:45 +01:00
Hugo de Paix de Coeur
2b6c699828 fixes configuration validators and doc 2016-03-04 11:40:39 +01:00
Robert Winkler
e376b972fe Merge pull request #97 from Swagger2Markup/master
Updated readme
2016-03-04 08:28:32 +01:00
Robert Winkler
445a04b9d6 Updated readme 2016-03-04 08:25:13 +01:00
Robert Winkler
99049d156a Updated readme 2016-03-03 16:33:07 +01:00
Hugo de Paix de Coeur
f8d331fc8b fixes property examples pretty-printing when no examples provided 2016-03-03 15:42:25 +01:00
Hugo de Paix de Coeur
667a883fb0 labels_fr fix for headers_column 2016-03-03 15:26:40 +01:00
Robert Winkler
2bd1719637 Merge remote-tracking branch 'origin/develop' into develop 2016-03-03 15:22:06 +01:00
Robert Winkler
d9d62dec6b Removed testOldSwaggerSpec2AsciiDocConversion unit test. 2016-03-03 15:21:46 +01:00
Hugo de Paix de Coeur
f3fdd45019 Extend to basic properties/parameters types : Auto-generated examples are disabled by default. Swagger examples are always rendered. 2016-03-03 15:11:00 +01:00
Hugo de Paix de Coeur
ded1cd6b06 Cleanup and fixes examples pretty-printing 2016-03-03 15:11:00 +01:00
Robert Winkler
854dcf48b2 Added headers property to all language files. 2016-03-03 14:26:55 +01:00
Robert Winkler
0916fa38e2 Merge remote-tracking branch 'origin/develop' into develop 2016-03-03 14:14:12 +01:00
Robert Winkler
c590f5102c Added an Assertj DiffAssertions class which can be used to compare the generated AsciiDoc/Markdown files with files which contain the expected conten.
The DiffAssert generates a HTML report, if the files differ.
2016-03-03 14:14:02 +01:00
Robert Winkler
9bda5b7941 Removed unused, duplicated method normalizeName. 2016-03-03 14:12:19 +01:00
Robert Winkler
ebba92368a Updated asciidoctor plugins.
Added a diff library to compare the content of files.
2016-03-03 14:10:37 +01:00
Hugo de Paix de Coeur
2d17071c8c Updated copyright headers 2016-03-03 11:58:50 +01:00
Robert Winkler
38d4bff7f4 Merge pull request #96 from Swagger2Markup/features/withGeneratedExamples
Auto-generated examples are disabled by default
2016-03-02 19:27:57 +01:00
Hugo de Paix de Coeur
fc5434cb3d Auto-generated examples are disabled by default. Swagger examples are always rendered. 2016-03-02 19:13:28 +01:00
Hugo de Paix de Coeur
3c0e545661 fixed ComposedModel definitions model bug when used with examples 2016-03-02 19:07:00 +01:00
Hugo de Paix de Coeur
c0f758ba9b Added some missing validation 2016-03-02 18:12:24 +01:00
Robert Winkler
8a913d075d Refactored the examplesSection method in PathsDocument to remove duplicated code. 2016-03-02 11:26:31 +01:00
Robert Winkler
bbaf3a05b3 Added a swagger_petstore.yaml and swagger_security.yaml and removed the outdated swagger.json 2016-03-02 11:25:50 +01:00
Robert Winkler
61c4f8861f Changed Asciidoctor toclevel from 2 to 3. 2016-03-02 11:24:25 +01:00
Hugo de Paix de Coeur
1e7c51a2cb Removed file prefixes from dynamic content extensions 2016-03-01 18:37:26 +01:00
Hugo de Paix de Coeur
21620917f7 Unknown security scheme localization 2016-03-01 18:05:47 +01:00
Hugo de Paix de Coeur
cc65055f3c Use OrderBy for all ordering configurations 2016-03-01 17:58:22 +01:00
Hugo de Paix de Coeur
71fab0ca94 Simplify SpringRestDocsExtension::operationFolderName, and documentation fixes 2016-03-01 16:10:06 +01:00
Hugo de Paix de Coeur
b272e812d0 Remove lower-casing in normalizeName 2016-03-01 15:56:17 +01:00
Hugo de Paix de Coeur
cb9092492f Removes formatting from localization
fixes FR locale
2016-03-01 14:44:23 +01:00
Robert Winkler
0a79020e59 Merge pull request #95 from glaforge/patch-1
Add Restlet as a user of Swagger2Markup
2016-03-01 11:02:45 +01:00
Guillaume Laforge
4e4fa960b6 Add Restlet as a user of Swagger2Markup 2016-03-01 10:12:33 +01:00
Robert Winkler
c28fddb4f6 Merge pull request #93 from Swagger2Markup/features/#91-examples-to-ext
fixes #91 : Move SpringRestDocs examples to extension
2016-03-01 08:57:11 +01:00
Hugo de Paix de Coeur
e36587f61a fix directories to lower case 2016-02-29 17:52:31 +01:00
Hugo de Paix de Coeur
40c53cf27b Merge remote-tracking branch 'origin/master' into features/#91-examples-to-ext
# Conflicts:
#	src/main/java/io/github/robwin/swagger2markup/builder/document/PathsDocument.java
#	src/main/java/io/github/robwin/swagger2markup/config/Swagger2MarkupConfig.java
#	src/test/java/io/github/robwin/swagger2markup/config/Swagger2MarkupConfigTest.java
#	src/test/resources/config/config.properties
2016-02-29 17:04:22 +01:00
Hugo de Paix de Coeur
09c78a1cee fixes #91 : Move SpringRestDocs examples to extension 2016-02-29 16:25:09 +01:00
Robert Winkler
b2d9e5ab73 Moved language property files into the package io.github.robwin.swagger2markup.
Renamed boolean config properties.  They end with *Enabled now.
2016-02-29 12:57:18 +01:00
Hugo de Paix de Coeur
a630c1a161 Merge pull request #90 from Kabhal/master
Added FR locale
2016-02-26 19:49:44 +01:00
Hugo de Paix de Coeur
1771330890 Added FR locale 2016-02-26 19:48:26 +01:00
Kabhal
02fed86851 Merge pull request #89 from Kabhal/master
fixed #72 : Render examples of response and schema objects
2016-02-26 18:52:46 +01:00
Hugo de Paix de Coeur
46ae248056 Merge branch 'erik/master'
# Conflicts:
#	src/main/java/io/github/robwin/swagger2markup/builder/document/DefinitionsDocument.java
#	src/main/java/io/github/robwin/swagger2markup/builder/document/PathsDocument.java
#	src/test/java/io/github/robwin/swagger2markup/Swagger2MarkupConverterTest.java
2016-02-26 18:29:02 +01:00
Robert Winkler
5730a3be09 Merge pull request #88 from Kabhal/master
fixed #46 : Support deprecated operations
2016-02-26 17:39:41 +01:00
Hugo de Paix de Coeur
462df0032e fixed #46 : Support deprecated operations 2016-02-26 16:30:45 +01:00
Robert Winkler
d058a99874 Renamed addfileExtension to addFileExtension 2016-02-26 16:29:24 +01:00
Robert Winkler
2399cc25ca Merge remote-tracking branch 'origin/master' 2016-02-26 13:27:05 +01:00
Robert Winkler
c7fe39bf21 Refactored Swagger2MarkupConverter builder. 2016-02-26 13:26:52 +01:00
Robert Winkler
a5bf4c64bb Updated readme 2016-02-26 12:48:14 +01:00
Robert Winkler
3fd97ea471 Merge pull request #87 from Kabhal/uri
Move remaining String directories to Path
2016-02-26 12:40:03 +01:00
Hugo de Paix de Coeur
3dae4dd155 Move remaining String directories to Path 2016-02-26 12:17:10 +01:00
Robert Winkler
a510740fa3 Introduced new Swagger2MarkupConverter.from factory methods for URL and Path instead of URI to make sure that URLs and Paths have the correct format. 2016-02-26 11:05:54 +01:00
Robert Winkler
91ba9e7fd3 Moved method registerExtension into the Swagger2MarkupExtensionRegistry.Builder to make the Swagger2MarkupExtensionRegistry immutable. 2016-02-25 20:49:41 +01:00
Robert Winkler
f3056d316f Removed method withConfig(Properties config) from Swagger2MarkupConverter.Builder 2016-02-25 20:48:36 +01:00
Robert Winkler
0e9f556994 Merge pull request #86 from Kabhal/uri
Support for URI for all content resources
2016-02-25 19:29:55 +01:00
Hugo de Paix de Coeur
b9727c9275 Switched all paths to URI (except DynamicExtensions because file listing is needed -> Path) 2016-02-25 19:20:59 +01:00
Hugo de Paix de Coeur
d649fb0d87 fixes tests 2016-02-25 14:11:30 +01:00
Hugo de Paix de Coeur
1aa8221931 fixed #83 : Pluggable extension support 2016-02-25 13:49:37 +01:00
Hugo de Paix de Coeur
cbb541f1a3 fixed #80 : External folder path consistency 2016-02-25 13:00:03 +01:00
Hugo de Paix de Coeur
8b215d7425 fixed #82 : Swagger2Markup configuration builder 2016-02-25 13:00:03 +01:00
Hugo de Paix de Coeur
52ef344ba4 fixed #79 : Support for dynamic extensions from files to operations. 2016-02-25 12:59:58 +01:00
Erik Håkansson
44eff18b3e Expanded example .json 2016-02-25 06:39:18 +01:00
Erik Håkansson
a0c8d47369 Added tests and fixed some issues 2016-02-24 15:24:34 +01:00
Erik Håkansson
d19a0020fd Updated to use latest markupdocument 2016-02-24 14:11:52 +01:00
Erik Håkansson
5494ad911e merge from upstream 2016-02-24 13:51:18 +01:00
Erik Håkansson
5ead0975c1 Updates to example handling to cover more scenarios 2016-02-24 13:41:53 +01:00
Robert Winkler
34cd890cd9 Fixed CharSet in Unit test "testSwagger2AsciiDocConversionWithRussianOutputLanguage" 2016-02-22 15:30:47 +01:00
Robert Winkler
329756d664 Merge pull request #78 from Kabhal/master
fixed #77 : Generated anchors should be prefixed with a configurable prefix
2016-02-19 16:57:49 +01:00
Hugo de Paix de Coeur
8ebc4f603f Missing custom anchor for security document 2016-02-19 16:55:17 +01:00
Hugo de Paix de Coeur
07bcdf220d Shorty parameter type 2016-02-19 16:39:13 +01:00
Hugo de Paix de Coeur
2f71a011c3 Use Markup-dependent specifiers on tables (AsciiDoc : header style on name column & vertically centered columns) 2016-02-19 16:23:43 +01:00
Hugo de Paix de Coeur
e6244fc3f8 fixed #77 : Generated anchors should be prefixed with a configurable prefix 2016-02-18 19:03:12 +01:00
Hugo de Paix de Coeur
9eb713cefb Generate title anchors only for unique titles (overview, paths, definitions, <all paths>, <all operations> and <all definitions>) 2016-02-18 17:13:16 +01:00
Robert Winkler
714c0aa8c9 Merge pull request #76 from Kabhal/master
Use new markup-document-builder *AsString replacements
2016-02-18 15:35:06 +01:00
Hugo de Paix de Coeur
91a0aeec9d Use new markup-document-builder *AsString replacements 2016-02-18 14:56:50 +01:00
Robert Winkler
a28c1d4efe Merge pull request #74 from Kabhal/master
fixed #73 : Optionally isolate body display from other parameters
2016-02-17 13:22:18 +01:00
Hugo de Paix de Coeur
a6af12ae06 Added configurable ordering for properties, parameters and responses 2016-02-16 15:47:22 +01:00
Hugo de Paix de Coeur
910b2ff187 cleanups 2016-02-16 14:48:16 +01:00
Hugo de Paix de Coeur
64adbfaab6 enhanced filename normalization 2016-02-15 20:41:54 +01:00
Hugo de Paix de Coeur
d60b8d4b83 Enhanced inline schema uniqueness (no more incremental ids) 2016-02-15 18:43:40 +01:00
Hugo de Paix de Coeur
684fc221b1 fixed #73 : Optionally isolate body display from other parameters 2016-02-15 18:11:26 +01:00
Erik Håkansson
cf96642db5 Reverted custom versioning 2016-02-15 13:19:22 +01:00
Erik Håkansson
ab6628b1ab Added option for auto-generating examples 2016-02-15 13:16:15 +01:00
Robert Winkler
06beab3865 Merge pull request #69 from Kabhal/master
fixed bug with hand-written description folders fallback
2016-02-12 18:20:20 +01:00
Hugo de Paix de Coeur
bd77f4400f fixed bug with hand-written description folders fallback 2016-02-12 18:08:07 +01:00
Robert Winkler
deebb2be9a Merge pull request #68 from Kabhal/master
refactor hand-written descriptions folder
2016-02-12 17:29:05 +01:00
Hugo de Paix de Coeur
22c6cab910 refactor hand-written descriptions folder : search in stable operation.getId() first, then in back-compatible operation.getSummary()
Fix title rendering (was in debug mode)
2016-02-12 17:24:20 +01:00
Robert Winkler
ea771c80d1 Merge pull request #67 from Kabhal/master
refactored path -> operation
2016-02-12 17:22:07 +01:00
Hugo de Paix de Coeur
861b97c4ff Refactor operation sorting and group by tags logic 2016-02-12 16:34:15 +01:00
Hugo de Paix de Coeur
b1ffe7cfc2 Decomposed method and path 2016-02-12 16:34:15 +01:00
Hugo de Paix de Coeur
852ea15dc2 Renamed path -> operation anywhere we work on an operation and not a path 2016-02-12 16:34:15 +01:00
Hugo de Paix de Coeur
45768a5bba Migrate to asciidoctorj:1.5.4 (testCompile) -> better support for inter-document cross-references with paths 2016-02-12 16:34:15 +01:00
Hugo de Paix de Coeur
76b5a83511 fix withInterDocumentCrossReferences to support null prefix 2016-02-12 16:34:15 +01:00
Robert Winkler
c0d1da781f Merge pull request #66 from Kabhal/master
Option to enable/disable inter-document cross-references
2016-02-11 15:41:17 +01:00
Hugo de Paix de Coeur
1a80a7a8eb missing documentation 2016-02-11 15:33:35 +01:00
Hugo de Paix de Coeur
cd66661026 Introduce withInterDocumentCrossReferences(prefix). By default inter-document cross-references are disabled (We assume all generated files will be included in a user .adoc file)
Fixed DefinitionsDocumentResolver*
2016-02-11 14:37:17 +01:00
Hugo de Paix de Coeur
b88e4eea56 cleanup the resolvers 2016-02-11 14:37:17 +01:00
Robert Winkler
f64a0d199d Added a test case which converts a Swagger file into an AsciiDoc String. 2016-02-11 14:05:13 +01:00
Robert Winkler
5f47f49cf4 Issue #65:
When you combine multiple AsciiDoc files in a index.adoc. The anchors to the definitions don't work anymore in the paths section, because they reference a definitions.adoc: <<definitions.adoc#_pet,Pet>>
AsciiDoctor converts this reference to a HTML anchor <a href="definitions.html#_pet">Pet</a>. But AsciiDoctor only generates an index.html and no definitions.html
The DefinitionDocumentResolver must return null, if separatedDefinitionsEnabled is not true. Otherwise we are not backward compatible.
2016-02-11 10:58:19 +01:00
Robert Winkler
7a0c8d81f6 Moved the securitySchemeSection above the examplesSection in the PathsDocument. 2016-02-11 10:02:19 +01:00
Robert Winkler
427efca6f8 Added security.adoc to index.adoc 2016-02-11 09:45:24 +01:00
Robert Winkler
54546185ab Added test for separated paths builder method. 2016-02-11 09:26:43 +01:00
Robert Winkler
493f045764 Merge pull request #63 from rostskadat/master
Adding a simple section for Swagger security definitions
2016-02-10 18:15:54 +01:00
N090536
fd79e98ed7 Merge remote-tracking branch 'origin/master'
Conflicts:
	src/main/java/io/github/robwin/swagger2markup/Swagger2MarkupConverter.java
	src/test/java/io/github/robwin/swagger2markup/Swagger2MarkupConverterTest.java
2016-02-10 16:23:05 +01:00
Robert Winkler
40bf5762bb Merge pull request #64 from Kabhal/idxref
Fixed tests (no way to compare output to definitions.<ext> as the gen…
2016-02-10 14:00:33 +01:00
Hugo de Paix de Coeur
c291991236 Fixed tests (no way to compare output to definitions.<ext> as the generation logic changed) : definitions.<ext> is now just a link list to separated files 2016-02-10 13:40:18 +01:00
Robert Winkler
7cb9b97bfb Updated swagger-compat-spec-parser from 1.0.16 to 1.0.17 2016-02-10 13:39:35 +01:00
Robert Winkler
eddbd9610e Updated RELEASENOTES 2016-02-10 13:32:14 +01:00
Robert Winkler
a66ebec28f Merge pull request #62 from Kabhal/idxref
fixed #61 Refactor separated documents logic to support inter-document xrefs
2016-02-10 13:25:51 +01:00
N090536
cdad18194e Fixing UTF8 string... 2016-02-10 13:11:56 +01:00
N090536
17f69b2bbc Adapted the unit test to account for the new security document 2016-02-10 13:04:04 +01:00
N090536
84176e5e27 Fixing english labels and sync the russian labels 2016-02-10 12:48:34 +01:00
N090536
67a3b924e8 Add the SecurityDocument class 2016-02-10 12:41:30 +01:00
N090536
84c86873fb Added a section for the securityDefinitionsObject.
As per the specification:
http://swagger.io/specification/#securityDefinitionsObject
2016-02-10 12:40:40 +01:00
Hugo de Paix de Coeur
2a486a2939 fixed #61 Refactor separated documents logic to support inter-document cross-references 2016-02-10 12:29:02 +01:00
Robert Winkler
0550128e1d Merge pull request #59 from johanhammar/master
Update Gradle wrapper to 2.10 and dependency-management-plugin to latest version.
2016-02-07 12:21:27 +01:00
Johan Hammar
ff867c9ba4 Update Gradle wrapper to 2.10 2016-02-07 12:04:16 +01:00
Johan Hammar
c5fada0a62 Upgrade dependency-management-plugin to latest version 2016-02-07 11:59:06 +01:00
Robert Winkler
7316ae0ce4 Merge pull request #58 from Kabhal/separatedBody
fixed #53 : support for tags, paths and methods ordering
2016-02-05 20:44:08 +01:00
Hugo de Paix de Coeur
c8919e9844 refactored orderBy system by generalizing ordering to all resources (tags, paths, definitions, path methods).
definitionsOrderBy and OrderBy are deprecated (set definitionsOrdering to Ordering.natural() for back-compatibility)
All orderings set to Ordering.natural() by default.
Support as-is ordering for all resources by setting config options to null.
2016-02-05 19:57:38 +01:00
Hugo de Paix de Coeur
4e340466de Merge remote-tracking branch 'upstream/master' into separatedBody 2016-02-05 18:02:37 +01:00
Hugo de Paix de Coeur
2fceda6f09 fixed #53 : support for tags, paths and methods ordering 2016-02-05 16:38:06 +01:00
Robert Winkler
2aa29fde8a Merge pull request #56 from Kabhal/multipaths
fixed #51 : Support for separated operations files
2016-02-05 00:41:23 +01:00
Hugo de Paix de Coeur
a76b7c545a Localized Response inline type prefix 2016-02-05 00:15:17 +01:00
Hugo de Paix de Coeur
8178bf1380 renamed withSeparatedOperations to withSeparatedPaths along with all related resources 2016-02-05 00:10:45 +01:00
Hugo de Paix de Coeur
63ca190a32 fixed #51 : Support for separated operations files 2016-02-04 18:51:22 +01:00
Hugo de Paix de Coeur
836d9fbae7 Migrate to markup-document-builder 0.1.6-SNAPSHOT 2016-02-04 17:34:10 +01:00
Hugo de Paix de Coeur
9df1c73641 fixed Markdown generation for inline schemas 2016-02-04 13:51:23 +01:00
Hugo de Paix de Coeur
1899efd209 Test cleanups 2016-02-04 13:51:23 +01:00
Hugo de Paix de Coeur
9d90766592 Workaround for https://github.com/swagger-api/swagger-parser/issues/177 2016-02-04 13:51:23 +01:00
Hugo de Paix de Coeur
bd9d3ee4c3 Cleanups 2016-02-04 13:51:23 +01:00
Robert Winkler
20fac6ab26 Fixed travis file 2016-02-04 13:22:25 +01:00
Robert Winkler
5be5a7d8e3 Fixed travis file 2016-02-04 13:11:02 +01:00
Robert Winkler
35f0192ecb Fixed Coveralls badge 2016-02-03 15:59:49 +01:00
Robert Winkler
69949d6257 Added artifactoryPublish task to TravisCI to publish SNAPSHOTS to OSS Artifactory 2016-02-03 15:56:00 +01:00
Robert Winkler
94ad45d2b0 Added Artifactory Gradle Plugin in order to deploy snapshots to oss.jfrog.org 2016-02-03 13:25:05 +01:00
Robert Winkler
c62f6085f7 Changed inlineSchemaDepthLevel from Integer to int
Changed default value of inlineSchemaDepthLevel from 0 to 1
2016-02-03 08:46:52 +01:00
Robert Winkler
2a300a2ef6 Merge pull request #55 from Kabhal/separatedBody
Enhancements
2016-02-02 21:01:08 +01:00
Hugo de Paix de Coeur
a77a0f281d Merge branch 'master' of github.com:Swagger2Markup/swagger2markup into separatedBody 2016-02-02 20:08:14 +01:00
Hugo de Paix de Coeur
d794cd989b Introduced columns width ratio in all tables to maximize description column width.
Refactored table generation.
MarkupDocBuilderUtils code should be replaced with markup-document-builder enhancements.
2016-02-02 20:04:33 +01:00
Hugo de Paix de Coeur
60c687f3f8 Introduced tableRow() to escape table contents 2016-02-02 18:46:07 +01:00
Hugo de Paix de Coeur
8da5d3a770 l10n : No Content
Cleaning
2016-02-02 18:04:52 +01:00
Hugo de Paix de Coeur
ead3e0bc22 Added .withInlineSchemaDepthLevel to converter configuration (default: 0 = disable feature)
Added inline schema support for global definitions.
Relayout inlineSchema feature : no mode distinct Definitions section in Paths, inline types are displayed right after each original type. This is for consistency with global definitions.
2016-02-02 11:45:22 +01:00
Robert Winkler
a0c1f20fc3 Added inline schema example Swagger YAML file 2016-02-02 10:36:29 +01:00
Robert Winkler
8e6586d4e4 Merge pull request #54 from Kabhal/separatedBody
Inline schemas support (issue #52)
2016-02-02 07:30:39 +01:00
Hugo de Paix de Coeur
b2f4229f70 Merge branch 'master' of github.com:Swagger2Markup/swagger2markup into separatedBody 2016-02-01 22:46:21 +01:00
Hugo de Paix de Coeur
2425074855 cleanup 2016-02-01 20:41:01 +01:00
Hugo de Paix de Coeur
7d53a8aedb Managed inline schemas in parameters and responses (depth level = 1)
Inline schemas in definitions are still to be managed.
2016-02-01 20:14:40 +01:00
Hugo de Paix de Coeur
a16617880f Factorized the display of type properties table 2016-02-01 17:38:06 +01:00
Hugo de Paix de Coeur
650431b8ce Support for response inline objects 2016-02-01 16:15:56 +01:00
Hugo de Paix de Coeur
a6654b65a9 Genericized the type system between models, parameters, properties, etc ... for further refactoring
*Utils display logic is removed from *Utils which are now just adapters from Swagger model to *Type.
 *Type now have the display logic.
2016-02-01 16:10:30 +01:00
Hugo de Paix de Coeur
4f15ea9ed7 Corrected warnings 2016-02-01 10:59:38 +01:00
Hugo de Paix de Coeur
aa34532b33 Factorized paths sections titles 2016-02-01 10:58:31 +01:00
Robert Winkler
3fe711a3ba Merge pull request #53 from Kabhal/fixedPathsNames
Base paths and fixed file names must not depend on translations
2016-01-29 14:19:04 +01:00
Hugo de Paix de Coeur
93e2175435 Base paths and fixed file names must not depend on translations 2016-01-29 14:00:20 +01:00
Robert Winkler
5c61006d11 Updated readme 2016-01-26 08:06:48 +01:00
Robert Winkler
6da74af830 Updated readme 2016-01-26 08:04:12 +01:00
Robert Winkler
93ba67c405 Updated swagger-parser from v1.0.13 to v1.0.16 2016-01-11 08:44:40 +01:00
Robert Winkler
04fed3d4d5 Prepare release v0.9.2 2016-01-05 14:35:12 +01:00
Robert Winkler
1ead6614ba Corrected russian labels file, because the files names of spring-restdocs are always english. 2016-01-05 14:31:11 +01:00
Robert Winkler
887e63464d Merge pull request #49 from MeteorBoom/master
Added output files language option
2016-01-04 16:47:33 +01:00
Maksim Myshkin
47e5d5e56e I have merged property files in one. ResourceBundle is now used. 2016-01-04 20:15:50 +05:00
Maksim Myshkin
c505c1e88e Added output files language option 2016-01-03 22:13:57 +05:00
Robert Winkler
6a8c04c031 Updated documentation 2015-11-24 08:27:15 +01:00
Robert Winkler
33f68a7f41 Updated documentation 2015-11-24 08:26:07 +01:00
Robert Winkler
c5af8676e5 Updated documentation 2015-11-24 08:20:22 +01:00
Robert Winkler
618898cb09 Updated documentation 2015-11-24 08:19:37 +01:00
Robert Winkler
36bdcc57d9 Added Swagger2MarkupConverter.fromString test case 2015-11-16 09:41:27 +01:00
Robert Winkler
eb418c07f5 Updated publishing gradle script 2015-11-12 14:37:50 +01:00
Robert Winkler
9a265fbbc3 Updated RELEASENOTES 2015-11-12 13:12:15 +01:00
Robert Winkler
cf32d6cf29 [New Feature] Added support to group the paths by tags or as-is
[New Feature] Added support to order the definitions by natural ordering or as-is
2015-11-12 13:10:33 +01:00
Robert Winkler
9d216e3dc2 [Bug] Fixed unit test issue with composed models 2015-11-09 15:49:35 +01:00
Robert Winkler
9d387b3e80 Merge remote-tracking branch 'origin/master' 2015-11-09 14:52:52 +01:00
Robert Winkler
1e6be2f26d Updated swagger-parser from v1.0.8 to v1.0.13
Support for global responses and parameters
2015-11-09 14:52:43 +01:00
Robert Winkler
e56f824cd2 Updated documentation 2015-10-01 08:40:44 +02:00
Robert Winkler
d38014f4b5 Updated documentation 2015-09-30 13:35:12 +02:00
Robert Winkler
b331062fa6 Updated documentation 2015-09-01 17:28:13 +02:00
Robert Winkler
88df748451 Merge pull request #35 from Relequestual/patch-1
Updated readme to better reflect alternatives listing
2015-09-01 17:19:44 +02:00
Ben Hutton
5384197bd1 Updated readme to better reflect alternatives listing
The list of alternative publishing libraries was missleading in the sense it lead me to believe that I could use this library to generate AsciiDoc or Markdown, which would work in all of the listed documentation hosting services / open source projects templates.
2015-09-01 14:53:22 +01:00
Robert Winkler
2b5d4b7fe9 Merge pull request #34 from johanhammar/urischeme
Do not render URI scheme if none of host, schemes or basePath are set
2015-08-29 01:32:59 +02:00
Johan Hammar
c15d074488 Do not render URI scheme if none of host, schemes or basePath are set 2015-08-28 22:18:49 +02:00
Robert Winkler
b0c3aa71b9 Merge pull request #32 from johanhammar/gradle25
Update the dependency-management-plugin to work with Gradle 2.5
2015-08-26 21:15:17 +02:00
Johan Hammar
32d85ffb55 Update the dependency-management-plugin to work with Gradle 2.5 2015-08-26 20:56:23 +02:00
Robert Winkler
59fcd61738 Updated documentation 2015-08-24 20:55:30 +02:00
Robert Winkler
7ce969882d Updated documentation 2015-08-24 20:54:39 +02:00
Robert Winkler
ee70cdb94f Update README.adoc 2015-08-24 20:52:32 +02:00
Robert Winkler
f21fce7730 * Enhancement #26 and #27: Added a pre-process hook to modify a Swagger Model before it is converted. 2015-08-24 20:44:46 +02:00
Robert Winkler
c426c7b341 Bugfix #29: Tags are rendered twice 2015-08-24 20:44:17 +02:00
Robert Winkler
1231d1e0c2 Merge pull request #27 from zmitrok/master
Added a hook to pre-process Swagger model before generating the marku…
2015-08-21 18:13:18 +02:00
zmitrok
66073aebb8 Added a hook to pre-process Swagger model before generating the markup. This approach heavily relies on the mutability of the Swagger class 2015-08-20 23:57:46 -07:00
Robert Winkler
882d9e5709 Merge pull request #23 from izeye/patch-1
Fix a broken link
2015-07-24 17:08:27 +02:00
izeye
ba9ec45d9e Fix a broken link 2015-07-24 21:07:36 +09:00
Robert Winkler
f2787a41ae Merge branch 'master' of https://github.com/Swagger2Markup/swagger2markup 2015-07-20 08:20:41 +02:00
Robert Winkler
3469523225 Workaround: If the type of a BodyParameter is String and not a Model, the schema is null and lost. Therefore the fallback type of a BodyParameter is String now. 2015-07-20 08:20:06 +02:00
Robert Winkler
1dc9a07cb9 Updated documentation 2015-07-14 08:33:46 +02:00
Robert Winkler
a34807e5c9 Updated Travis-CI Batch 2015-07-09 08:08:57 +02:00
Robert Winkler
85ef33a720 Updated documentation 2015-07-06 08:49:22 +02:00
Robert Winkler
3163c077a1 Updated documentation 2015-06-30 08:39:46 +02:00
Robert Winkler
fbb446875d Updated documentation 2015-06-30 08:38:54 +02:00
Robert Winkler
e8cdcabffe Updated documentation 2015-06-30 08:36:08 +02:00
Robert Winkler
832813d40a Updated documentation 2015-06-30 08:26:05 +02:00
Robert Winkler
e2f28bca7d Updated documentation 2015-06-29 15:29:06 +02:00
Robert Winkler
3ed894688c Updated documentation 2015-06-29 12:33:52 +02:00
Robert Winkler
bb7422d755 New Feature #21: Added support for both reference models and composed models 2015-06-29 09:32:47 +02:00
Robert Winkler
b2f3f4a6c7 Updated documentation 2015-06-28 09:02:09 +02:00
Robert Winkler
f21794a253 Updated documentation 2015-06-27 11:49:19 +02:00
Robert Winkler
ffa96e56a5 Updated documentation 2015-06-27 11:47:49 +02:00
Robert Winkler
38e50dfe77 Merge pull request #20 from redowl/add-composition-support
Adding support for composed model definitions
2015-06-27 11:38:20 +02:00
Russell Snyder
1d3ec2d5a3 Adding support for composed model definitions
Signed-off-by: Russell Snyder <russell@redowlanalytics.com>
2015-06-26 14:40:41 -04:00
Robert Winkler
495751433b Updated documentation 2015-06-24 19:32:23 +02:00
Robert Winkler
de7d73eae9 Updated documentation 2015-06-24 09:54:33 +02:00
Robert Winkler
f825cf9613 Updated documentation 2015-06-24 09:53:47 +02:00
Robert Winkler
6e32056c26 Updated documentation 2015-06-24 09:44:51 +02:00
Robert Winkler
85bc2aa8f9 Updated documentation 2015-06-23 09:44:07 +02:00
Robert Winkler
d56de83368 Updated documentation 2015-06-23 09:41:36 +02:00
Robert Winkler
065e65a31c Updated documentation 2015-06-23 09:38:33 +02:00
Robert Winkler
a68980bc76 Updated documentation 2015-06-23 09:32:47 +02:00
68 changed files with 9446 additions and 3609 deletions

4
.gitignore vendored
View File

@@ -1,4 +0,0 @@
.idea
*.iml
.gradle
build

View File

@@ -1,15 +0,0 @@
language: java
jdk:
- oraclejdk7
before_install:
- chmod +x gradlew
after_success:
- ./gradlew jacocoTestReport coveralls
notifications:
webhooks:
urls:
- https://webhooks.gitter.im/e/9c620e84679284b7d621
on_success: change # options: [always|never|change] default: always
on_failure: always # options: [always|never|change] default: always
on_start: false # default: false
Your unique webhook url for this service:

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

3120
1.3.1/index.html Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

3120
1.3.3/index.html Normal file

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

3206
1.3.4/index.html Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,202 +0,0 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright {yyyy} {name of copyright owner}
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.

View File

@@ -1,405 +0,0 @@
= Swagger2Markup
:author: Robert Winkler
:version: 0.6.3
:hardbreaks:
image:https://travis-ci.org/RobWin/swagger2markup.svg?branch=master["Build Status", link="https://travis-ci.org/RobWin/swagger2markup"] image:https://coveralls.io/repos/RobWin/swagger2markup/badge.svg["Coverage Status", link="https://coveralls.io/r/RobWin/swagger2markup"] image:https://api.bintray.com/packages/robwin/maven/swagger2markup/images/download.svg[link="https://bintray.com/robwin/maven/swagger2markup/_latestVersion"] image:http://img.shields.io/badge/license-ASF2-blue.svg["Apache License 2", link="http://www.apache.org/licenses/LICENSE-2.0.txt"] image:https://img.shields.io/badge/Twitter-rbrtwnklr-blue.svg["Twitter", link="https://twitter.com/rbrtwnklr"] image:https://badges.gitter.im/Join%20Chat.svg[link="https://gitter.im/RobWin/swagger2markup?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"]
== Overview
The primary goal of this project is to *simplify the generation of an up-to-date RESTful API documentation by combining documentation that's been hand-written with auto-generated API documentation* produced by https://github.com/swagger-api[Swagger]. The result is intended to be an *up-to-date, easy-to-read, on- and offline user guide*, comparable to https://developer.github.com/v3/[GitHub's API documentation]. The output of Swagger2Markup can be used as an alternative to https://github.com/swagger-api/swagger-ui[swagger-ui] and can be served as static content.
Swagger2Markup converts a Swagger JSON or YAML file into several *AsciiDoc* or *GitHub Flavored Markdown* documents which can be combined with hand-written documentation. The Swagger source file can be located locally or remotely via HTTP. Swagger2Markup supports the Swagger 1.2 and 2.0 specification. Internally it uses the _official_ https://github.com/swagger-api/swagger-parser[swagger-parser] and my https://github.com/RobWin/markup-document-builder[markup-document-builder].
You can use Swagger2Markup to convert your contract-first Swagger YAML file into a human-readable format and combine it with hand-written documentation. As an alternative, you can choose the code-first approach and use Swagger2Markup together with https://github.com/swagger-api/swagger-core/tree/master/samples/java-jersey2[Swagger JAX-RS], https://github.com/springfox/springfox[springfox] or https://github.com/spring-projects/spring-restdocs[spring-restdocs]. See https://github.com/RobWin/swagger2markup#usage-guide[usage guide] below. If you are are Gradle user, you can also use the https://github.com/RobWin/swagger2markup-gradle-plugin[Swagger2Markup Gradle Plugin].
http://asciidoctor.org/docs/asciidoc-writers-guide/[AsciiDoc] is preferable to Markdown as it has more features. AsciiDoc is a text document format for writing documentation, articles, books, ebooks, slideshows, web pages and blogs. AsciiDoc files can be converted to *HTML*, *PDF* and *EPUB*. AsciiDoc is much better suited for describing public APIs than *JavaDoc* or *Annotations*.
You can generate your HTML5, PDF and EPUB documentation via https://github.com/asciidoctor/asciidoctorj[asciidoctorj] or even better via the https://github.com/asciidoctor/asciidoctor-gradle-plugin[asciidoctor-gradle-plugin] or https://github.com/asciidoctor/asciidoctor-maven-plugin[asciidoctor-maven-plugin]. You can also use https://github.com/jbake-org/jbake[JBake], https://github.com/tomchristie/mkdocs[MkDocs], https://github.com/rtfd/readthedocs.org[ReadTheDocs] or https://github.com/tripit/slate[slate] to publish your AsciiDoc or Markdown documentation.
The project requires at least JDK 7.
== Usage guide
=== Adding Swagger2Markup to your project
The project is published in JCenter and Maven Central.
==== Maven
[source,xml]
----
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>bintray</name>
<url>http://jcenter.bintray.com</url>
</repository>
</repositories>
<dependency>
<groupId>io.github.robwin</groupId>
<artifactId>swagger2markup</artifactId>
<version>0.6.3</version>
</dependency>
----
==== Gradle
[source,groovy]
----
repositories {
jcenter()
}
compile "io.github.robwin:swagger2markup:0.6.3"
----
=== Using Swagger2Markup
Using the Swagger2MarkupConverter is simple. For example, if you are using https://github.com/spring-projects/spring-boot[Spring Boot] and https://github.com/springfox/springfox[springfox], you can generate your Swagger JSON file during the integration or unit test phase, convert the Swagger JSON file into AsciiDoc, convert AsciiDoc into HTML and PDF, copy the documentation into the Jar file and serve it as static content. That way there is no runtime overhead and there are no additional runtime libraries required.
The quickest way to get started is to look at the demo project https://github.com/RobWin/spring-swagger2markup-demo[spring-swagger2markup-demo]. The demo shows how to generate static docs (HTML5 and PDF) with the https://github.com/RobWin/swagger2markup-gradle-plugin[Swagger2Markup Gradle Plugin] and serve them as static content in a Spring Boot App under http://localhost:9080/docs/index.html and http://localhost:9080/docs/index.pdf.
==== Generate Markup during an integration test
Swagger2MarkupConverter can be used to make a request to a Swagger endpoint during an integration test. The Swagger2MarkupConverter writes the generated documents into the folder `src/docs/asciidoc/generated` or `src/docs/markdown/generated`.
[source,java]
----
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(classes = Application.class)
@IntegrationTest
@WebAppConfiguration
public class Swagger2MarkupTest {
@Test
public void convertRemoteSwaggerToAsciiDoc() {
// Remote Swagger source
// Default is AsciiDoc
Swagger2MarkupConverter.from("http://localhost:8080/v2/api-docs").build()
.intoFolder("src/docs/asciidoc/generated");
// Then validate that three AsciiDoc files have been created
String[] files = new File("src/docs/asciidoc/generated").list();
assertThat(files).hasSize(3)
.containsAll(Arrays.asList("definitions.adoc", "overview.adoc", "paths.adoc"));
}
@Test
public void convertRemoteSwaggerToMarkdown() {
// Remote Swagger source
// Markdown
Swagger2MarkupConverter.from("http://localhost:8080/v2/api-docs")
.withMarkupLanguage(MarkupLanguage.MARKDOWN).build()
.intoFolder("src/docs/markdown/generated");
// Then validate that three Markdown files have been created
String[] files = new File("src/docs/markdown/generated").list();
assertThat(files).hasSize(3)
.containsAll(Arrays.asList("definitions.md", "overview.md", "paths.md"));
}
@Test
public void convertLocalSwaggerToAsciiDoc() {
//Local Swagger source
//Default is AsciiDoc
String location = Swagger2MarkupTest.class.getResource("/json/swagger.json").getPath();
Swagger2MarkupConverter.from(location).build()
.intoFolder("src/docs/asciidoc/generated");
}
}
----
==== Generate Markup during an unit test with springfox-staticdocs
Spring's MVC Test framework can also be used to make a request to a https://github.com/springfox/springfox[springfox] Swagger endpoint during an unit test. A custom ResultHandler `Swagger2MarkupResultHandler` is used to automatically convert the Swagger JSON response into an AsciiDoc document. The custom ResultHandler is part of `springfox-staticdocs`. That way you also verify that your Swagger endpoint is working.
[source,java]
----
@WebAppConfiguration
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = Application.class, loader = SpringApplicationContextLoader.class)
public class Swagger2MarkupTest {
@Autowired
private WebApplicationContext context;
private MockMvc mockMvc;
@Before
public void setUp() {
this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build();
}
@Test
public void convertSwaggerToAsciiDoc() throws Exception {
this.mockMvc.perform(get("/v2/api-docs")
.accept(MediaType.APPLICATION_JSON))
.andDo(Swagger2MarkupResultHandler.outputDirectory("src/docs/asciidoc/generated").build())
.andExpect(status().isOk());
}
@Test
public void convertSwaggerToMarkdown() throws Exception {
this.mockMvc.perform(get("/v2/api-docs")
.accept(MediaType.APPLICATION_JSON))
.andDo(Swagger2MarkupResultHandler.outputDirectory("src/docs/markdown/generated")
.withMarkupLanguage(MarkupLanguage.MARKDOWN).build())
.andExpect(status().isOk());
}
}
----
==== Gradle dependencies
[source,groovy]
----
dependencies {
...
compile 'io.springfox:springfox-swagger2:2.0.0'
testCompile 'io.springfox:springfox-staticdocs:2.0.0'
...
}
----
==== Springfox configuration
The following is a complete https://github.com/springfox/springfox[springfox] configuration to use Swagger in a Spring Boot Application.
[source,java]
----
@SpringBootApplication
@EnableSwagger2
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Bean
public Docket restApi() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.paths(ant("/api/**"))
.build();
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Petstore API Title")
.description("Petstore API Description")
.contact("Petstore API Contact Email")
.version("1.0.0")
.build();
}
}
----
==== Combine generated documentation with your hand-written documentation
The following shows how you can combine the generated documentation with your hand-written AsciiDoc documentation. You have to create an `index.adoc` (it must not be necessarily called index). To include the programmatically generated snippets in your documentation, you use Asciidoc's `include` macro. The `generated` variable is configured below.
image::images/generated_docs.PNG[generated_docs]
You can generate your HTML5 and PDF documentation via the https://github.com/asciidoctor/asciidoctor-gradle-plugin[asciidoctor-gradle-plugin] or https://github.com/asciidoctor/asciidoctor-maven-plugin[asciidoctor-maven-plugin]. The following listing shows how to configure the Asciidoctor Gradle plugin. By default it searches for AsciiDoc files in `src/docs/asciidoc` and puts the HTML and PDF output into `build/asciidoc/html5` and `build/asciidoc/pdf`. The `generated` attribute is used to replace the variable in the `index.adoc` file and to provide configurable access to the generated snippets.
[source,groovy]
----
ext {
generatedDocumentation = file('src/docs/asciidoc/generated')
}
test {
outputs.dir generatedDocumentation
}
asciidoctor {
dependsOn test
sources {
include 'index.adoc'
}
backends = ['html5', 'pdf']
attributes = [
doctype: 'book',
toc: 'left',
toclevels: '2',
numbered: '',
sectlinks: '',
sectanchors: '',
generated: generatedDocumentation
]
}
----
You can copy the output into your Jar file and serve the documentation as static content under `http://localhost:9080/docs/index.html` and `http://localhost:9080/docs/index.pdf`.
[source,groovy]
----
jar {
dependsOn asciidoctor
from ("${asciidoctor.outputDir}/html5") {
into 'static/docs'
}
from ("${asciidoctor.outputDir}/pdf") {
into 'static/docs'
}
}
----
==== Include spring-restdocs example snippets
Swagger2Markup can be used together with https://github.com/spring-projects/spring-restdocs[spring-restdocs]. Swagger2Markup can include the generated CURL request, HTTP request and HTTP response example snippets from spring-restdocs into the generated AsciiDoc document. See https://github.com/spring-projects/spring-restdocs[spring-restdocs] how to configure it. Currently spring-restdocs does only support AsciiDoc.
Let's say you have a Swagger-annotated Spring RestController method with an ApiOperation value: `Add a new pet to the store`
[source,java]
----
@RequestMapping(method = POST)
@ApiOperation(value = "Add a new pet to the store")
@ApiResponses(value = {@ApiResponse(code = 405, message = "Invalid input")})
public ResponseEntity<String> addPet(
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @RequestBody Pet pet) {
petData.add(pet);
return Responses.ok("SUCCESS");
}
----
By convention the target folder of the generated request and response example files must be similar to the value of the ApiOperation, but with underscores and lowercase. For example a folder for `@ApiOperation(value = "Add a new pet to the store")` must be called `add_a_new_pet_to_the_store`.
[source,java]
----
@Test
public void findPetById() throws Exception {
this.mockMvc.perform(post("/api/pet/").content(createPet())
.contentType(MediaType.APPLICATION_JSON))
.andDo(RestDocumentation.document("add_a_new_pet_to_the_store"))
.andExpect(status().isOk());
}
----
The system property `org.springframework.restdocs.outputDir` is used to control the output base directory where the folder `add_a_new_pet_to_the_store` and the generated snippets are written to. The spring-restdocs output base directory is configured as follows:
[source,groovy]
----
ext {
generatedDocumentation = file('src/docs/asciidoc/generated')
}
test {
systemProperty 'org.springframework.restdocs.outputDir', generatedDocumentation
outputs.dir generatedDocumentation
}
----
You must specify the base output directory of spring-restdocs with the builder method `withExamples("src/docs/asciidoc/generated")`.
[source,java]
----
@Test
public void convertToAsciiDoc() throws Exception {
this.mockMvc.perform(get("/v2/api-docs")
.accept(MediaType.APPLICATION_JSON))
.andDo(Swagger2MarkupResultHandler.outputDirectory("src/docs/asciidoc")
.withExamples("src/docs/asciidoc/generated").build())
.andExpect(status().isOk());
}
----
By convention the Swagger2MarkupConverter searches for a method annotated with `@ApiOperation(value = "Add a new pet to the store")` in a folder called `src/docs/asciidoc/generated/add_a_new_pet_to_the_store` and includes the `http-request.adoc` and `http-response.adoc` files, if they are available.
The AsciiDoc HTML output would look as follows:
image::images/springrestdocs_examples.PNG[springrestdocs]
==== Include hand-written descriptions into the generated documentation
If you don't want to pollute your source code with Swagger annotations just to add descriptions to Operations, Parameters and Model definitions. Like here:
[source, java]
----
@RequestMapping(method = PUT)
@ApiOperation(value = "Update an existing pet")
@ApiResponses(value = {@ApiResponse(code = 400, message = "Invalid ID supplied"),
@ApiResponse(code = 404, message = "Pet not found"),
@ApiResponse(code = 405, message = "Validation exception")})
public ResponseEntity<String> updatePet(
@ApiParam(value = "Pet object that needs to be added to the store", required = true) @RequestBody Pet pet) {
petData.add(pet);
return Responses.ok("SUCCESS");
}
----
You can create hand-written descriptions and include them with the builder method `withDescriptions()` into your documentation by specifying the base folder of your documentation.
[source, java]
----
Swagger2MarkupConverter.from(file.getAbsolutePath()).withDescriptions("src/docs/asciidoc").build()
.intoFolder("src/docs/asciidoc");
----
By convention you need two folders `paths` and `definitions` inside your description base folder.
The `paths` folder contains sub folders for all operations. The folder must be named similar to the value of the ApiOperation annotation, but with underscores and lowercase.
For example a folder for `@ApiOperation(value = "Update an existing pet")` must be called `update_an_existing_pet`.
The `definitions` folder contains sub folders for all models. The folder must be named similar to the name of the Model, but lowercase.
For example a folder for a model called `User` must be called `user`.
You can have a global description file for each operation or model. And you can have one description file per operation parameter or model property.
For example:
image::images/handwritten_descriptions.PNG[handwritten_descriptions]
The AsciiDoc HTML output would look as follows:
image::images/handwritten_descr_asciidoc.PNG[handwritten_descr_asciidoc]
==== Include JSON and XML Schema files.
Swagger2Markup can also include JSON and XML Schema files into the generated document.
[source,java]
----
Swagger2MarkupConverter.from("http://localhost:8080/api-docs").withSchemas("src/docs/schemas").build()
.intoFolder("src/docs/asciidoc");
----
You can create the schema files during a unit test as follows:
[source,java]
----
RestDocumented restDocumented = RestDocumented.fromProperties();
restDocumented.documentJsonSchema(MailStorageQuota.class, "src/docs/schemas");
restDocumented.documentXmlSchema(MailStorageQuota.class, "src/docs/schemas");
----
I will make RestDocumented public soon. RestDocumented creates a MailStorageQuota.xsd and MailStorageQuota.json file in the folder `src/docs/schemas`. The Swagger2MarkupConverter will include the JSON and XML Schemas, if a Swagger Operation uses the MailStorageQuota class as input or output.
== Screenshots
=== Swagger source
image::images/swagger_json.PNG[swagger_json]
=== Generated AsciiDoc
image::images/asciidoc.PNG[asciidoc]
=== Generated Markdown
image::images/markdown.PNG[markdown]
=== Generated HTML using AsciidoctorJ
image::images/asciidoc_html.PNG[asciidoc_html]
=== Generated PDF using AsciidoctorJ
image::images/asciidoc_pdf.PNG[asciidoc_pdf]
== License
Copyright 2015 Robert Winkler
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.

View File

@@ -1,56 +0,0 @@
= Release Notes
== Version 0.1.0
* Initial version with support for AsciiDoc and Markdown
== Version 0.2.0
* This version is not downward compatible. This version supports includes of example files and JSON/XML Schema files. See documentation.
=== Version 0.2.1
* Signed jar files and published in Maven Central
=== Version 0.2.2
* Fixed wrong dependency version to io.github.robwin:markup-document-builder
=== Version 0.2.3
* Fixed issue #7: @ApiModelProperty metadata are ignored for definitions file
=== Version 0.2.4
* Fixed issue #8: logback.xml on the classpath
* Fixed issue #13: unknown format not supported for properties
== Version 0.3.0
* Support of YAML or JSON String as input.
== Version 0.4.0
* Updated Swagger-Parser from 1.0.0 to 1.0.5
* Updated commons-lang to commons-lang3
* Swagger2MarkupConverter generates three documents now: overview, paths and definitions
* Support for enums in HeaderParameter, QueryParameter, FormParameter and QueryParameter
* Support for global consumes, produces and tags
== Version 0.5.0
* Support for including hand-written descriptions instead of using Swagger Annotations for descriptions
=== Version 0.5.1
* Bugfix: Definition name must be lowercase so that descriptions file can be found
=== Version 0.5.2
* Swagger License is not mandatory anymore
* Updated markup-document-builder from v0.1.3 to v0.1.4
=== Version 0.5.3
* Fixed compiler warning: [options] bootstrap class path not set in conjunction with -source 1.7
== Version 0.6.0
* Updated swagger-parser from v1.0.5 to v1.0.6
* Support for default values in Parameters and Model properties
== Version 0.6.1
* Updated swagger-parser from v1.0.6 to v1.0.8
== Version 0.6.2
* curl-request.adoc from spring-restdocs is also added to the example chapters
== Version 0.6.3
* Added possibility to write object definitions to separate files. Issue #19

View File

@@ -1,121 +0,0 @@
buildscript {
repositories {
jcenter()
mavenCentral()
}
dependencies {
classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
classpath 'org.asciidoctor:asciidoctorj-pdf:1.5.0-alpha.7'
classpath 'io.spring.gradle:dependency-management-plugin:0.5.1.RELEASE'
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.0.1'
classpath 'org.asciidoctor:asciidoctorj:1.5.2'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
}
}
description = 'swagger2markup Build'
version = '0.6.3'
group = 'io.github.robwin'
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'org.asciidoctor.convert'
apply plugin: 'jacoco'
apply plugin: 'com.github.kt3k.coveralls'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.jfrog.bintray'
apply from: 'gradle/publishing.gradle'
tasks.withType(JavaCompile) {
sourceCompatibility = "1.7"
targetCompatibility = "1.7"
options.deprecation = true
options.encoding = 'UTF-8'
options.compilerArgs << "-Xlint:unchecked"
}
repositories {
jcenter()
mavenCentral()
mavenLocal()
}
dependencies {
compile 'io.github.robwin:markup-document-builder'
compile 'io.swagger:swagger-compat-spec-parser'
compile 'commons-collections:commons-collections'
compile 'commons-io:commons-io'
compile 'org.slf4j:slf4j-api'
testCompile 'junit:junit'
testCompile 'org.asciidoctor:asciidoctorj:1.5.2'
testCompile 'ch.qos.logback:logback-classic'
testCompile 'org.assertj:assertj-core'
}
dependencyManagement {
dependencies {
dependency "io.github.robwin:markup-document-builder:0.1.4"
dependency "io.swagger:swagger-compat-spec-parser:1.0.8"
dependency "commons-collections:commons-collections:3.2.1"
dependency "commons-io:commons-io:2.4"
dependency "junit:junit:4.11"
dependency "org.slf4j:slf4j-api:1.7.12"
dependency "ch.qos.logback:logback-classic:1.1.2"
dependency "org.assertj:assertj-core:2.0.0"
}
}
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}
artifacts {
archives sourcesJar
archives javadocJar
}
ext {
generatedDocumentation = file('build/docs/asciidoc/generated')
}
asciidoctor {
dependsOn test
sources {
include 'index.adoc'
}
backends = ['html5', 'pdf']
attributes = [
doctype: 'book',
toc: 'left',
toclevels: '2',
numbered: '',
sectlinks: '',
sectanchors: '',
hardbreaks: '',
generated: generatedDocumentation
]
}
jacocoTestReport {
reports {
xml.enabled = true // coveralls plugin depends on xml format report
html.enabled = true
}
}
tasks.coveralls {
dependsOn 'check'
}
tasks.asciidoctor {
dependsOn 'check'
}
task wrapper(type: Wrapper) {
gradleVersion = '2.4'
}

View File

@@ -1,100 +0,0 @@
import java.text.SimpleDateFormat
Date buildTimeAndDate = new Date()
ext {
buildDate = new SimpleDateFormat('yyyy-MM-dd').format(buildTimeAndDate)
buildTime = new SimpleDateFormat('HH:mm:ss.SSSZ').format(buildTimeAndDate)
}
def projectArtifactId = 'swagger2markup'
jar {
manifest {
attributes(
'Built-By': 'Robert Winkler',
'Created-By': System.properties['java.version'] + " (" + System.properties['java.vendor'] + " " + System.properties['java.vm.version'] + ")",
'Build-Date': project.buildDate,
'Build-Time': project.buildTime,
'Specification-Title': projectArtifactId,
'Specification-Version': project.version,
'Implementation-Title': projectArtifactId,
'Implementation-Version': project.version
)
}
}
if (!project.hasProperty('bintrayUsername')) ext.bintrayUsername = ''
if (!project.hasProperty('bintrayApiKey')) ext.bintrayApiKey = ''
if (!project.hasProperty('gpgPassphrase')) ext.gpgPassphrase = ''
if (!project.hasProperty('ossUser')) ext.ossUser = ''
if (!project.hasProperty('ossPassword')) ext.ossPassword = ''
bintray {
user = project.bintrayUsername
key = project.bintrayApiKey
dryRun = false //Whether to run this as dry-run, without deploying
publish = true //If version should be auto published after an upload
publications = ['mavenJava']
pkg {
repo = 'maven'
name = 'swagger2markup'
websiteUrl = 'https://github.com/RobWin/swagger2markup'
issueTrackerUrl = 'https://github.com/RobWin/swagger2markup/issues'
vcsUrl = 'https://github.com/RobWin/swagger2markup.git'
desc = 'A Swagger to Markup (AsciiDoc and Markdown) converter.'
licenses = ['Apache-2.0']
version {
vcsTag = project.version
gpg {
sign = true //Determines whether to GPG sign the files. The default is false
passphrase = project.gpgPassphrase //Optional. The passphrase for GPG signing'
}
mavenCentralSync {
sync = true //Optional (true by default). Determines whether to sync the version to Maven Central.
user = ossUser //OSS user token
password = ossPassword //OSS user password
}
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
pom.withXml {
def devs = ['RobWin': 'Robert Winkler']
def root = asNode()
root.dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
root.appendNode('name', 'swagger2markup')
root.appendNode('packaging', 'jar')
root.appendNode('url', 'https://github.com/RobWin/swagger2markup')
root.appendNode('description', 'A Swagger to Markup (AsciiDoc and Markdown) converter.')
def license = root.appendNode('licenses').appendNode('license')
license.appendNode('name', 'Apache-2.0')
license.appendNode('url', 'https://github.com/RobWin/swagger2markup/blob/master/LICENSE.txt')
license.appendNode('distribution', 'repo')
root.appendNode('scm').appendNode('url', 'https://github.com/RobWin/swagger2markup.git')
def developers = root.appendNode('developers')
devs.each {
def d = developers.appendNode('developer')
d.appendNode('id', it.key)
d.appendNode('name', it.value)
}
}
artifact sourcesJar
artifact javadocJar
}
}
}

Binary file not shown.

View File

@@ -1,6 +0,0 @@
#Mon Jun 08 08:20:09 CEST 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip

164
gradlew vendored
View File

@@ -1,164 +0,0 @@
#!/usr/bin/env bash
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
echo "$*"
}
die ( ) {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
esac
# For Cygwin, ensure paths are in UNIX format before anything is touched.
if $cygwin ; then
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
fi
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >&-
APP_HOME="`pwd -P`"
cd "$SAVED" >&-
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
function splitJvmOpts() {
JVM_OPTS=("$@")
}
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"

90
gradlew.bat vendored
View File

@@ -1,90 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windowz variants
if not "%OS%" == "Windows_NT" goto win9xME_args
if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
goto execute
:4NT_args
@rem Get arguments from the 4NT Shell from JP Software
set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

View File

@@ -1 +0,0 @@
rootProject.name = 'swagger2markup'

View File

@@ -1,5 +0,0 @@
This is a hand-written description.
AsciiDoc is better suited for descriptions than:
* JavaDoc
* Annotations

View File

@@ -1 +0,0 @@
This is a hand-written description. AsciiDoc is better suited for descriptions than *JavaDoc* and *Annotations*

View File

@@ -1 +0,0 @@
This is a hand-written description. AsciiDoc is better suited for descriptions than *JavaDoc* and *Annotations*

View File

@@ -1,3 +0,0 @@
include::{generated}/overview.adoc[]
include::{generated}/paths.adoc[]
include::{generated}/definitions.adoc[]

View File

@@ -1,6 +0,0 @@
[source,bash]
----
$ curl 'http://localhost:8080/api/pet/' -i -X POST -H 'Content-Type: application/json' -H 'Content-Length: 111' -d '{"id":1,"category":{"id":1,"name":"Hund"},"name":"Wuffy","photoUrls":[],"tags":[],"status":null,"identifier":1}'
----

View File

@@ -1,10 +0,0 @@
[source,http]
----
POST /api/pet/ HTTP/1.1
Content-Type: application/json
Content-Length: 111
{"id":1,"category":{"id":1,"name":"Hund"},"name":"Wuffy","photoUrls":[],"tags":[],"status":null,"identifier":1}
----

View File

@@ -1,10 +0,0 @@
[source,http]
----
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 7
SUCCESS
----

View File

@@ -1,2 +0,0 @@
This is a hand-written description.
AsciiDoc is better suited for descriptions than *JavaDoc* and *Annotations*

View File

@@ -1,5 +0,0 @@
This is a hand-written description.
AsciiDoc is better suited for descriptions than:
* JavaDoc
* Annotations

View File

@@ -1,5 +0,0 @@
This is a hand-written description.
AsciiDoc is better suited for descriptions than:
* JavaDoc
* Annotations

View File

@@ -1 +0,0 @@
This is a hand-written description. AsciiDoc is better suited for descriptions than *JavaDoc* and *Annotations*

View File

@@ -1 +0,0 @@
This is a hand-written description. AsciiDoc is better suited for descriptions than *JavaDoc* and *Annotations*

View File

@@ -1 +0,0 @@
This is a hand-written description. AsciiDoc is better suited for descriptions than *JavaDoc* and *Annotations*

View File

@@ -1,5 +0,0 @@
This is a hand-written description.
It is better suited for adding descriptions than:
* JavaDoc
* Annotations

View File

@@ -1,251 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.github.robwin.markup.builder.MarkupLanguage;
import io.github.robwin.swagger2markup.builder.document.DefinitionsDocument;
import io.github.robwin.swagger2markup.builder.document.OverviewDocument;
import io.github.robwin.swagger2markup.builder.document.PathsDocument;
import io.swagger.models.Swagger;
import io.swagger.parser.SwaggerParser;
import io.swagger.util.Json;
import io.swagger.util.Yaml;
import org.apache.commons.lang3.Validate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
/**
* @author Robert Winkler
*/
public class Swagger2MarkupConverter {
private static final Logger LOG = LoggerFactory.getLogger(Swagger2MarkupConverter.class);
private final Swagger swagger;
private final MarkupLanguage markupLanguage;
private final String examplesFolderPath;
private final String schemasFolderPath;
private final String descriptionsFolderPath;
private final boolean separatedDefinitions;
private static final String OVERVIEW_DOCUMENT = "overview";
private static final String PATHS_DOCUMENT = "paths";
private static final String DEFINITIONS_DOCUMENT = "definitions";
/**
* @param markupLanguage the markup language which is used to generate the files
* @param swagger the Swagger object
* @param examplesFolderPath the folderPath where examples are stored
* @param schemasFolderPath the folderPath where (XML, JSON)-Schema files are stored
* @param descriptionsFolderPath the folderPath where descriptions are stored
* @param separatedDefinitions create separate definition files for each model definition.
*/
Swagger2MarkupConverter(MarkupLanguage markupLanguage, Swagger swagger, String examplesFolderPath, String schemasFolderPath, String descriptionsFolderPath, boolean separatedDefinitions){
this.markupLanguage = markupLanguage;
this.swagger = swagger;
this.examplesFolderPath = examplesFolderPath;
this.schemasFolderPath = schemasFolderPath;
this.descriptionsFolderPath = descriptionsFolderPath;
this.separatedDefinitions = separatedDefinitions;
}
/**
* Creates a Swagger2MarkupConverter.Builder using a given Swagger source.
*
* @param swaggerLocation the Swagger location. Can be a HTTP url or a path to a local file.
* @return a Swagger2MarkupConverter
*/
public static Builder from(String swaggerLocation){
Validate.notEmpty(swaggerLocation, "swaggerLocation must not be empty!");
return new Builder(swaggerLocation);
}
/**
* Creates a Swagger2MarkupConverter.Builder from a given Swagger model.
*
* @param swagger the Swagger source.
* @return a Swagger2MarkupConverter
*/
public static Builder from(Swagger swagger){
Validate.notNull(swagger, "swagger must not be null!");
return new Builder(swagger);
}
/**
* Creates a Swagger2MarkupConverter.Builder from a given Swagger YAML or JSON String.
*
* @param swagger the Swagger YAML or JSON String.
* @return a Swagger2MarkupConverter
* @throws java.io.IOException if String can not be parsed
*/
public static Builder fromString(String swagger) throws IOException {
Validate.notEmpty(swagger, "swagger must not be null!");
ObjectMapper mapper;
if(swagger.trim().startsWith("{")) {
mapper = Json.mapper();
}else {
mapper = Yaml.mapper();
}
JsonNode rootNode = mapper.readTree(swagger);
// must have swagger node set
JsonNode swaggerNode = rootNode.get("swagger");
if(swaggerNode == null)
throw new IllegalArgumentException("Swagger String is in the wrong format");
return new Builder(mapper.convertValue(rootNode, Swagger.class));
}
/**
* Builds the document with the given markup language and stores
* the files in the given folder.
*
* @param targetFolderPath the target folder
* @throws IOException if the files cannot be written
*/
public void intoFolder(String targetFolderPath) throws IOException {
Validate.notEmpty(targetFolderPath, "folderPath must not be null!");
buildDocuments(targetFolderPath);
}
/**
* Builds the document with the given markup language and returns it as a String
*
* @return a the document as a String
* @throws java.io.IOException if files can not be read
*/
public String asString() throws IOException{
return buildDocuments();
}
/**
* Builds all documents and writes them to a directory
* @param directory the directory where the generated file should be stored
* @throws IOException if a file cannot be written
*/
private void buildDocuments(String directory) throws IOException {
new OverviewDocument(swagger, markupLanguage).build().writeToFile(directory, OVERVIEW_DOCUMENT, StandardCharsets.UTF_8);
new PathsDocument(swagger, markupLanguage, examplesFolderPath, descriptionsFolderPath).build().writeToFile(directory, PATHS_DOCUMENT, StandardCharsets.UTF_8);
new DefinitionsDocument(swagger, markupLanguage, schemasFolderPath, descriptionsFolderPath, separatedDefinitions, directory).build().writeToFile(directory, DEFINITIONS_DOCUMENT, StandardCharsets.UTF_8);
}
/**
* Returns all documents as a String
* @return a the document as a String
*/
private String buildDocuments() throws IOException {
return new OverviewDocument(swagger, markupLanguage).build().toString().concat(
new PathsDocument(swagger, markupLanguage, examplesFolderPath, schemasFolderPath).build().toString()
.concat(new DefinitionsDocument(swagger, markupLanguage, schemasFolderPath, schemasFolderPath, false, null).build().toString()));
}
public static class Builder{
private final Swagger swagger;
private String examplesFolderPath;
private String schemasFolderPath;
private String descriptionsFolderPath;
private boolean separatedDefinitions;
private MarkupLanguage markupLanguage = MarkupLanguage.ASCIIDOC;
/**
* Creates a Builder using a given Swagger source.
*
* @param swaggerLocation the Swagger location. Can be a HTTP url or a path to a local file.
*/
Builder(String swaggerLocation){
swagger = new SwaggerParser().read(swaggerLocation);
if(swagger == null){
throw new IllegalArgumentException("Failed to read the Swagger file. ");
}
}
/**
* Creates a Builder using a given Swagger model.
*
* @param swagger the Swagger source.
*/
Builder(Swagger swagger){
this.swagger = swagger;
}
public Swagger2MarkupConverter build(){
return new Swagger2MarkupConverter(markupLanguage, swagger, examplesFolderPath, schemasFolderPath, descriptionsFolderPath, separatedDefinitions);
}
/**
* Specifies the markup language which should be used to generate the files
*
* @param markupLanguage the markup language which is used to generate the files
* @return the Swagger2MarkupConverter.Builder
*/
public Builder withMarkupLanguage(MarkupLanguage markupLanguage){
this.markupLanguage = markupLanguage;
return this;
}
/**
* Include hand-written descriptions into the Paths and Definitions document
*
* @param descriptionsFolderPath the path to the folder where the description documents reside
* @return the Swagger2MarkupConverter.Builder
*/
public Builder withDescriptions(String descriptionsFolderPath){
this.descriptionsFolderPath = descriptionsFolderPath;
return this;
}
/**
* In addition to the definitions file, also create separate definition files for each model definition.
* @return the Swagger2MarkupConverter.Builder
*/
public Builder withSeparatedDefinitions() {
this.separatedDefinitions = true;
return this;
}
/**
* Include examples into the Paths document
*
* @param examplesFolderPath the path to the folder where the example documents reside
* @return the Swagger2MarkupConverter.Builder
*/
public Builder withExamples(String examplesFolderPath){
this.examplesFolderPath = examplesFolderPath;
return this;
}
/**
* Include (JSON, XML) schemas into the Definitions document
*
* @param schemasFolderPath the path to the folder where the schema documents reside
* @return the Swagger2MarkupConverter.Builder
*/
public Builder withSchemas(String schemasFolderPath){
this.schemasFolderPath = schemasFolderPath;
return this;
}
}
}

View File

@@ -1,283 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup.builder.document;
import io.github.robwin.markup.builder.MarkupDocBuilder;
import io.github.robwin.markup.builder.MarkupDocBuilders;
import io.swagger.models.Model;
import io.swagger.models.Swagger;
import io.swagger.models.properties.Property;
import io.github.robwin.markup.builder.MarkupLanguage;
import io.github.robwin.swagger2markup.utils.PropertyUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
/**
* @author Robert Winkler
*/
public class DefinitionsDocument extends MarkupDocument {
private static final String DEFINITIONS = "Definitions";
private static final List<String> IGNORED_DEFINITIONS = Collections.singletonList("Void");
private static final String JSON_SCHEMA = "JSON Schema";
private static final String XML_SCHEMA = "XML Schema";
private static final String JSON_SCHEMA_EXTENSION = ".json";
private static final String XML_SCHEMA_EXTENSION = ".xsd";
private static final String JSON = "json";
private static final String XML = "xml";
private static final String DESCRIPTION_FILE_NAME = "description";
private boolean schemasEnabled;
private String schemasFolderPath;
private boolean handWrittenDescriptionsEnabled;
private String descriptionsFolderPath;
private boolean separatedDefinitionsEnabled;
private String outputDirectory;
public DefinitionsDocument(Swagger swagger, MarkupLanguage markupLanguage, String schemasFolderPath, String descriptionsFolderPath, boolean separatedDefinitionsEnabled, String outputDirectory){
super(swagger, markupLanguage);
if(StringUtils.isNotBlank(schemasFolderPath)){
this.schemasEnabled = true;
this.schemasFolderPath = schemasFolderPath;
}
if(StringUtils.isNotBlank(descriptionsFolderPath)){
this.handWrittenDescriptionsEnabled = true;
this.descriptionsFolderPath = descriptionsFolderPath + "/" + DEFINITIONS.toLowerCase();
}
if(schemasEnabled){
if (logger.isDebugEnabled()) {
logger.debug("Include schemas is enabled.");
}
}else{
if (logger.isDebugEnabled()) {
logger.debug("Include schemas is disabled.");
}
}
if(handWrittenDescriptionsEnabled){
if (logger.isDebugEnabled()) {
logger.debug("Include hand-written descriptions is enabled.");
}
}else{
if (logger.isDebugEnabled()) {
logger.debug("Include hand-written descriptions is disabled.");
}
}
this.separatedDefinitionsEnabled = separatedDefinitionsEnabled;
if(this.separatedDefinitionsEnabled){
if (logger.isDebugEnabled()) {
logger.debug("Create separated definition files is enabled.");
}
Validate.notEmpty(outputDirectory, "Output directory is required for separated definition files!");
}else{
if (logger.isDebugEnabled()) {
logger.debug("Create separated definition files is disabled.");
}
}
this.outputDirectory = outputDirectory;
}
@Override
public MarkupDocument build() throws IOException {
definitions(swagger.getDefinitions(), this.markupDocBuilder);
return this;
}
/**
* Builds the Swagger definitions.
*
* @param definitions the Swagger definitions
* @param docBuilder the doc builder to use for output
*/
private void definitions(Map<String, Model> definitions, MarkupDocBuilder docBuilder) throws IOException {
if(MapUtils.isNotEmpty(definitions)){
docBuilder.sectionTitleLevel1(DEFINITIONS);
for(Map.Entry<String, Model> definitionsEntry : definitions.entrySet()){
String definitionName = definitionsEntry.getKey();
if(StringUtils.isNotBlank(definitionName)) {
if (checkThatDefinitionIsNotInIgnoreList(definitionName)) {
definition(definitionName, definitionsEntry.getValue(), docBuilder);
definitionSchema(definitionName, docBuilder);
if (separatedDefinitionsEnabled) {
MarkupDocBuilder defDocBuilder = MarkupDocBuilders.documentBuilder(markupLanguage);
definition(definitionName, definitionsEntry.getValue(), defDocBuilder);
definitionSchema(definitionName, defDocBuilder);
defDocBuilder.writeToFile(outputDirectory, definitionName.toLowerCase(), StandardCharsets.UTF_8);
if (logger.isInfoEnabled()) {
logger.info("Separate definition file produced: {}", definitionName);
}
}
if (logger.isInfoEnabled()) {
logger.info("Definition processed: {}", definitionName);
}
}else{
if (logger.isDebugEnabled()) {
logger.debug("Definition was ignored: {}", definitionName);
}
}
}
}
}
}
/**
* Checks that the definition is not in the list of ignored definitions.
*
* @param definitionName the name of the definition
* @return true if the definition can be processed
*/
private boolean checkThatDefinitionIsNotInIgnoreList(String definitionName) {
return !IGNORED_DEFINITIONS.contains(definitionName);
}
/**
* Builds a concrete definition
*
* @param definitionName the name of the definition
* @param model the Swagger Model of the definition
* @param docBuilder the docbuilder do use for output
*/
private void definition(String definitionName, Model model, MarkupDocBuilder docBuilder) throws IOException {
docBuilder.sectionTitleLevel2(definitionName);
descriptionSection(definitionName, model, docBuilder);
propertiesSection(definitionName, model, docBuilder);
}
private void propertiesSection(String definitionName, Model model, MarkupDocBuilder docBuilder) throws IOException {
Map<String, Property> properties = model.getProperties();
List<String> headerAndContent = new ArrayList<>();
List<String> header = Arrays.asList(NAME_COLUMN, DESCRIPTION_COLUMN, REQUIRED_COLUMN, SCHEMA_COLUMN, DEFAULT_COLUMN);
headerAndContent.add(StringUtils.join(header, DELIMITER));
if(MapUtils.isNotEmpty(properties)){
for (Map.Entry<String, Property> propertyEntry : properties.entrySet()) {
Property property = propertyEntry.getValue();
String propertyName = propertyEntry.getKey();
List<String> content = Arrays.asList(
propertyName,
propertyDescription(definitionName, propertyName, property),
Boolean.toString(property.getRequired()),
PropertyUtils.getType(property, markupLanguage),
PropertyUtils.getDefaultValue(property));
headerAndContent.add(StringUtils.join(content, DELIMITER));
}
docBuilder.tableWithHeaderRow(headerAndContent);
}
}
private void descriptionSection(String definitionName, Model model, MarkupDocBuilder docBuilder) throws IOException {
if(handWrittenDescriptionsEnabled){
String description = handWrittenPathDescription(definitionName.toLowerCase(), DESCRIPTION_FILE_NAME);
if(StringUtils.isNotBlank(description)){
docBuilder.paragraph(description);
}else{
if (logger.isInfoEnabled()) {
logger.info("Hand-written description cannot be read. Trying to use description from Swagger source.");
}
modelDescription(model, docBuilder);
}
}
else{
modelDescription(model, docBuilder);
}
}
private void modelDescription(Model model, MarkupDocBuilder docBuilder) {
String description = model.getDescription();
if (StringUtils.isNotBlank(description)) {
docBuilder.paragraph(description);
}
}
private String propertyDescription(String definitionName, String propertyName, Property property) throws IOException {
String description;
if(handWrittenDescriptionsEnabled){
description = handWrittenPathDescription(definitionName.toLowerCase() + "/" + propertyName.toLowerCase(), DESCRIPTION_FILE_NAME);
if(StringUtils.isBlank(description)) {
if (logger.isInfoEnabled()) {
logger.info("Hand-written description file cannot be read. Trying to use description from Swagger source.");
}
description = StringUtils.defaultString(property.getDescription());
}
}
else{
description = StringUtils.defaultString(property.getDescription());
}
return description;
}
/**
* Reads a hand-written description
*
* @param descriptionFolder the name of the folder where the description file resides
* @param descriptionFileName the name of the description file
* @return the content of the file
* @throws IOException
*/
private String handWrittenPathDescription(String descriptionFolder, String descriptionFileName) throws IOException {
for (String fileNameExtension : markupLanguage.getFileNameExtensions()) {
java.nio.file.Path path = Paths.get(descriptionsFolderPath, descriptionFolder, descriptionFileName + fileNameExtension);
if (Files.isReadable(path)) {
if (logger.isInfoEnabled()) {
logger.info("Description file processed: {}", path);
}
return FileUtils.readFileToString(path.toFile(), StandardCharsets.UTF_8).trim();
} else {
if (logger.isDebugEnabled()) {
logger.debug("Description file is not readable: {}", path);
}
}
}
if (logger.isWarnEnabled()) {
logger.info("No description file found with correct file name extension in folder: {}", Paths.get(descriptionsFolderPath, descriptionFolder));
}
return null;
}
private void definitionSchema(String definitionName, MarkupDocBuilder docBuilder) throws IOException {
if(schemasEnabled) {
if (StringUtils.isNotBlank(definitionName)) {
schema(JSON_SCHEMA, schemasFolderPath, definitionName + JSON_SCHEMA_EXTENSION, JSON, docBuilder);
schema(XML_SCHEMA, schemasFolderPath, definitionName + XML_SCHEMA_EXTENSION, XML, docBuilder);
}
}
}
private void schema(String title, String schemasFolderPath, String schemaName, String language, MarkupDocBuilder docBuilder) throws IOException {
java.nio.file.Path path = Paths.get(schemasFolderPath, schemaName);
if (Files.isReadable(path)) {
docBuilder.sectionTitleLevel3(title);
docBuilder.source(FileUtils.readFileToString(path.toFile(), StandardCharsets.UTF_8).trim(), language);
if (logger.isInfoEnabled()) {
logger.info("Schema file processed: {}", path);
}
} else {
if (logger.isDebugEnabled()) {
logger.debug("Schema file is not readable: {}", path);
}
}
}
}

View File

@@ -1,83 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup.builder.document;
import io.swagger.models.Swagger;
import io.github.robwin.markup.builder.MarkupDocBuilder;
import io.github.robwin.markup.builder.MarkupDocBuilders;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.nio.charset.Charset;
/**
* @author Robert Winkler
*/
public abstract class MarkupDocument {
protected static final String DELIMITER = "|";
protected static final String DEFAULT_COLUMN = "Default";
protected static final String REQUIRED_COLUMN = "Required";
protected static final String SCHEMA_COLUMN = "Schema";
protected static final String NAME_COLUMN = "Name";
protected static final String DESCRIPTION_COLUMN = "Description";
protected static final String DESCRIPTION = DESCRIPTION_COLUMN;
protected static final String PRODUCES = "Produces";
protected static final String CONSUMES = "Consumes";
protected static final String TAGS = "Tags";
protected Logger logger = LoggerFactory.getLogger(getClass());
protected Swagger swagger;
protected MarkupLanguage markupLanguage;
protected MarkupDocBuilder markupDocBuilder;
MarkupDocument(Swagger swagger, MarkupLanguage markupLanguage){
this.swagger = swagger;
this.markupLanguage = markupLanguage;
this.markupDocBuilder = MarkupDocBuilders.documentBuilder(markupLanguage);
}
/**
* Builds the MarkupDocument.
*
* @return the built MarkupDocument
* @throws IOException if the files to include are not readable
*/
public abstract MarkupDocument build() throws IOException ;
/**
* Returns a string representation of the document.
*/
public String toString(){
return markupDocBuilder.toString();
}
/**
* Writes the content of the builder to a file and clears the builder.
*
* @param directory the directory where the generated file should be stored
* @param fileName the name of the file
* @param charset the the charset to use for encoding
* @throws IOException if the file cannot be written
*/
public void writeToFile(String directory, String fileName, Charset charset) throws IOException{
markupDocBuilder.writeToFile(directory, fileName, charset);
}
}

View File

@@ -1,153 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup.builder.document;
import io.swagger.models.*;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class OverviewDocument extends MarkupDocument {
private static final String OVERVIEW = "Overview";
private static final String CURRENT_VERSION = "Version information";
private static final String VERSION = "Version: ";
private static final String CONTACT_INFORMATION = "Contact information";
private static final String CONTACT_NAME = "Contact: ";
private static final String CONTACT_EMAIL = "Contact Email: ";
private static final String LICENSE_INFORMATION = "License information";
private static final String LICENSE = "License: ";
private static final String LICENSE_URL = "License URL: ";
private static final String TERMS_OF_SERVICE = "Terms of service: ";
private static final String URI_SCHEME = "URI scheme";
private static final String HOST = "Host: ";
private static final String BASE_PATH = "BasePath: ";
private static final String SCHEMES = "Schemes: ";
public OverviewDocument(Swagger swagger, MarkupLanguage markupLanguage){
super(swagger, markupLanguage);
}
/**
* Builds the MarkupDocument.
*
* @return the built MarkupDocument
* @throws java.io.IOException if the files to include are not readable
*/
@Override
public MarkupDocument build() throws IOException {
overview();
return this;
}
/**
* Builds the document header of the swagger model
*/
private void overview() {
Info info = swagger.getInfo();
this.markupDocBuilder.documentTitle(info.getTitle());
this.markupDocBuilder.sectionTitleLevel1(OVERVIEW);
if(StringUtils.isNotBlank(info.getDescription())){
this.markupDocBuilder.textLine(info.getDescription());
this.markupDocBuilder.newLine();
}
if(StringUtils.isNotBlank(info.getVersion())){
this.markupDocBuilder.sectionTitleLevel2(CURRENT_VERSION);
this.markupDocBuilder.textLine(VERSION + info.getVersion());
this.markupDocBuilder.newLine();
}
Contact contact = info.getContact();
if(contact != null){
this.markupDocBuilder.sectionTitleLevel2(CONTACT_INFORMATION);
if(StringUtils.isNotBlank(contact.getName())){
this.markupDocBuilder.textLine(CONTACT_NAME + contact.getName());
}
if(StringUtils.isNotBlank(contact.getEmail())){
this.markupDocBuilder.textLine(CONTACT_EMAIL + contact.getEmail());
}
this.markupDocBuilder.newLine();
}
License license = info.getLicense();
if(license != null && (StringUtils.isNotBlank(license.getName()) || StringUtils.isNotBlank(license.getUrl()))) {
this.markupDocBuilder.sectionTitleLevel2(LICENSE_INFORMATION);
if (StringUtils.isNotBlank(license.getName())) {
this.markupDocBuilder.textLine(LICENSE + license.getName());
}
if (StringUtils.isNotBlank(license.getUrl())) {
this.markupDocBuilder.textLine(LICENSE_URL + license.getUrl());
}
this.markupDocBuilder.newLine();
}
if(StringUtils.isNotBlank(info.getTermsOfService())){
this.markupDocBuilder.textLine(TERMS_OF_SERVICE + info.getTermsOfService());
this.markupDocBuilder.newLine();
}
this.markupDocBuilder.sectionTitleLevel2(URI_SCHEME);
if(StringUtils.isNotBlank(swagger.getHost())){
this.markupDocBuilder.textLine(HOST + swagger.getHost());
}
if(StringUtils.isNotBlank(swagger.getBasePath())){
this.markupDocBuilder.textLine(BASE_PATH + swagger.getBasePath());
}
if(CollectionUtils.isNotEmpty(swagger.getSchemes())){
List<String> schemes = new ArrayList<>();
for(Scheme scheme : swagger.getSchemes()){
schemes.add(scheme.toString());
}
this.markupDocBuilder.textLine(SCHEMES + StringUtils.join(schemes, ", "));
}
this.markupDocBuilder.newLine();
if(CollectionUtils.isNotEmpty(swagger.getTags())){
this.markupDocBuilder.sectionTitleLevel2(TAGS);
List<String> tags = new ArrayList<>();
for(Tag tag : swagger.getTags()){
String name = tag.getName();
String description = tag.getDescription();
if(StringUtils.isNoneBlank(description)){
tags.add(name + ": " + description);
}
tags.add(name);
}
this.markupDocBuilder.unorderedList(tags);
this.markupDocBuilder.newLine();
}
if(CollectionUtils.isNotEmpty(swagger.getConsumes())){
this.markupDocBuilder.sectionTitleLevel2(CONSUMES);
this.markupDocBuilder.unorderedList(swagger.getConsumes());
this.markupDocBuilder.newLine();
}
if(CollectionUtils.isNotEmpty(swagger.getProduces())){
this.markupDocBuilder.sectionTitleLevel2(PRODUCES);
this.markupDocBuilder.unorderedList(swagger.getProduces());
this.markupDocBuilder.newLine();
}
}
}

View File

@@ -1,381 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup.builder.document;
import io.swagger.models.Operation;
import io.swagger.models.Path;
import io.swagger.models.Response;
import io.swagger.models.Swagger;
import io.swagger.models.parameters.Parameter;
import io.swagger.models.properties.Property;
import io.github.robwin.markup.builder.MarkupLanguage;
import io.github.robwin.swagger2markup.utils.ParameterUtils;
import io.github.robwin.swagger2markup.utils.PropertyUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.WordUtils;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @author Robert Winkler
*/
public class PathsDocument extends MarkupDocument {
private static final String PATHS = "Paths";
private static final String PARAMETERS = "Parameters";
private static final String RESPONSES = "Responses";
private static final String EXAMPLE_CURL = "Example CURL request";
private static final String EXAMPLE_REQUEST = "Example HTTP request";
private static final String EXAMPLE_RESPONSE = "Example HTTP response";
private static final String TYPE_COLUMN = "Type";
private static final String HTTP_CODE_COLUMN = "HTTP Code";
private static final String REQUEST_EXAMPLE_FILE_NAME = "http-request";
private static final String RESPONSE_EXAMPLE_FILE_NAME = "http-response";
private static final String CURL_EXAMPLE_FILE_NAME = "curl-request";
private static final String DESCRIPTION_FILE_NAME = "description";
private static final String PARAMETER = "Parameter";
private boolean examplesEnabled;
private String examplesFolderPath;
private boolean handWrittenDescriptionsEnabled;
private String descriptionsFolderPath;
public PathsDocument(Swagger swagger, MarkupLanguage markupLanguage, String examplesFolderPath, String descriptionsFolderPath){
super(swagger, markupLanguage);
if(StringUtils.isNotBlank(examplesFolderPath)){
this.examplesEnabled = true;
this.examplesFolderPath = examplesFolderPath;
}
if(StringUtils.isNotBlank(descriptionsFolderPath)){
this.handWrittenDescriptionsEnabled = true;
this.descriptionsFolderPath = descriptionsFolderPath + "/" + PATHS.toLowerCase();
}
if(examplesEnabled){
if (logger.isDebugEnabled()) {
logger.debug("Include examples is enabled.");
}
}else{
if (logger.isDebugEnabled()) {
logger.debug("Include examples is disabled.");
}
}
if(handWrittenDescriptionsEnabled){
if (logger.isDebugEnabled()) {
logger.debug("Include hand-written descriptions is enabled.");
}
}else{
if (logger.isDebugEnabled()) {
logger.debug("Include hand-written descriptions is disabled.");
}
}
}
@Override
public MarkupDocument build() throws IOException {
paths();
return this;
}
/**
* Builds all paths of the Swagger model
*/
private void paths() throws IOException {
Map<String, Path> paths = swagger.getPaths();
if(MapUtils.isNotEmpty(paths)) {
this.markupDocBuilder.sectionTitleLevel1(PATHS);
for (Map.Entry<String, Path> entry : paths.entrySet()) {
Path path = entry.getValue();
if(path != null) {
path("GET", entry.getKey(), path.getGet());
path("PUT", entry.getKey(), path.getPut());
path("DELETE", entry.getKey(), path.getDelete());
path("POST", entry.getKey(), path.getPost());
path("PATCH", entry.getKey(), path.getPatch());
}
}
}
}
/**
* Builds a path
*
* @param httpMethod the HTTP method of the path
* @param resourcePath the URL of the path
* @param operation the Swagger Operation
*/
private void path(String httpMethod, String resourcePath, Operation operation) throws IOException {
if(operation != null){
pathTitle(httpMethod, resourcePath, operation);
descriptionSection(operation);
parametersSection(operation);
responsesSection(operation);
consumesSection(operation);
producesSection(operation);
tagsSection(operation);
examplesSection(operation);
}
}
private void pathTitle(String httpMethod, String resourcePath, Operation operation) {
String summary = operation.getSummary();
String title;
if(StringUtils.isNotBlank(summary)) {
title = summary;
this.markupDocBuilder.sectionTitleLevel2(title);
this.markupDocBuilder.listing(httpMethod + " " + resourcePath);
}else{
title = httpMethod + " " + resourcePath;
this.markupDocBuilder.sectionTitleLevel2(title);
}
if (logger.isInfoEnabled()) {
logger.info("Path processed: {}", title);
}
}
private void descriptionSection(Operation operation) throws IOException {
if(handWrittenDescriptionsEnabled){
String summary = operation.getSummary();
if(StringUtils.isNotBlank(summary)) {
String operationFolder = summary.replace(".", "").replace(" ", "_").toLowerCase();
String description = handWrittenPathDescription(operationFolder, DESCRIPTION_FILE_NAME);
if(StringUtils.isNotBlank(description)){
this.markupDocBuilder.sectionTitleLevel3(DESCRIPTION);
this.markupDocBuilder.paragraph(description);
}else{
if (logger.isInfoEnabled()) {
logger.info("Hand-written description cannot be read. Trying to use description from Swagger source.");
}
pathDescription(operation);
}
}else{
if (logger.isInfoEnabled()) {
logger.info("Hand-written description cannot be read, because summary of operation is empty. Trying to use description from Swagger source.");
}
pathDescription(operation);
}
}else {
pathDescription(operation);
}
}
private void pathDescription(Operation operation) {
String description = operation.getDescription();
if (StringUtils.isNotBlank(description)) {
this.markupDocBuilder.sectionTitleLevel3(DESCRIPTION);
this.markupDocBuilder.paragraph(description);
}
}
private void parametersSection(Operation operation) throws IOException {
List<Parameter> parameters = operation.getParameters();
if(CollectionUtils.isNotEmpty(parameters)){
List<String> headerAndContent = new ArrayList<>();
// Table header row
List<String> header = Arrays.asList(TYPE_COLUMN, NAME_COLUMN, DESCRIPTION_COLUMN, REQUIRED_COLUMN, SCHEMA_COLUMN, DEFAULT_COLUMN);
headerAndContent.add(StringUtils.join(header, DELIMITER));
for(Parameter parameter : parameters){
String type = ParameterUtils.getType(parameter, markupLanguage);
String parameterType = WordUtils.capitalize(parameter.getIn() + PARAMETER);
// Table content row
List<String> content = Arrays.asList(
parameterType,
parameter.getName(),
parameterDescription(operation, parameter),
Boolean.toString(parameter.getRequired()), type,
ParameterUtils.getDefaultValue(parameter));
headerAndContent.add(StringUtils.join(content, DELIMITER));
}
this.markupDocBuilder.sectionTitleLevel3(PARAMETERS);
this.markupDocBuilder.tableWithHeaderRow(headerAndContent);
}
}
private String parameterDescription(Operation operation, Parameter parameter) throws IOException {
String description;
if(handWrittenDescriptionsEnabled){
String summary = operation.getSummary();
String operationFolder = summary.replace(".", "").replace(" ", "_").toLowerCase();
String parameterName = parameter.getName();
if(StringUtils.isNotBlank(operationFolder) && StringUtils.isNotBlank(parameterName)) {
description = handWrittenPathDescription(operationFolder + "/" + parameterName, DESCRIPTION_FILE_NAME);
if(StringUtils.isBlank(description)) {
if (logger.isInfoEnabled()) {
logger.info("Hand-written description file cannot be read. Trying to use description from Swagger source.");
}
description = StringUtils.defaultString(parameter.getDescription());
}
}else{
if (logger.isInfoEnabled()) {
logger.info("Hand-written description file cannot be read, because summary of operation or name of parameter is empty. Trying to use description from Swagger source.");
}
description = StringUtils.defaultString(parameter.getDescription());
}
}else {
description = StringUtils.defaultString(parameter.getDescription());
}
return description;
}
private void consumesSection(Operation operation) {
List<String> consumes = operation.getConsumes();
if(CollectionUtils.isNotEmpty(consumes)){
this.markupDocBuilder.sectionTitleLevel3(CONSUMES);
this.markupDocBuilder.unorderedList(consumes);
}
}
private void producesSection(Operation operation) {
List<String> produces = operation.getProduces();
if(CollectionUtils.isNotEmpty(produces)){
this.markupDocBuilder.sectionTitleLevel3(PRODUCES);
this.markupDocBuilder.unorderedList(produces);
}
}
private void tagsSection(Operation operation) {
List<String> tags = operation.getTags();
if(CollectionUtils.isNotEmpty(tags)){
this.markupDocBuilder.sectionTitleLevel3(TAGS);
this.markupDocBuilder.unorderedList(tags);
}
}
/**
* Builds the example section of a Swagger Operation
*
* @param operation the Swagger Operation
* @throws IOException if the example file is not readable
*/
private void examplesSection(Operation operation) throws IOException {
if(examplesEnabled){
String summary = operation.getSummary();
if(StringUtils.isNotBlank(summary)) {
String exampleFolder = summary.replace(".", "").replace(" ", "_").toLowerCase();
String curlExample = example(exampleFolder, CURL_EXAMPLE_FILE_NAME);
if(StringUtils.isNotBlank(curlExample)){
this.markupDocBuilder.sectionTitleLevel3(EXAMPLE_CURL);
this.markupDocBuilder.paragraph(curlExample);
}
String requestExample = example(exampleFolder, REQUEST_EXAMPLE_FILE_NAME);
if(StringUtils.isNotBlank(requestExample)){
this.markupDocBuilder.sectionTitleLevel3(EXAMPLE_REQUEST);
this.markupDocBuilder.paragraph(requestExample);
}
String responseExample = example(exampleFolder, RESPONSE_EXAMPLE_FILE_NAME);
if(StringUtils.isNotBlank(responseExample)){
this.markupDocBuilder.sectionTitleLevel3(EXAMPLE_RESPONSE);
this.markupDocBuilder.paragraph(responseExample);
}
}else{
if (logger.isWarnEnabled()) {
logger.warn("Example file cannot be read, because summary of operation is empty.");
}
}
}
}
/**
* Reads an example
*
* @param exampleFolder the name of the folder where the example file resides
* @param exampleFileName the name of the example file
* @return the content of the file
* @throws IOException
*/
private String example(String exampleFolder, String exampleFileName) throws IOException {
for (String fileNameExtension : markupLanguage.getFileNameExtensions()) {
java.nio.file.Path path = Paths.get(examplesFolderPath, exampleFolder, exampleFileName + fileNameExtension);
if (Files.isReadable(path)) {
if (logger.isInfoEnabled()) {
logger.info("Example file processed: {}", path);
}
return FileUtils.readFileToString(path.toFile(), StandardCharsets.UTF_8).trim();
} else {
if (logger.isDebugEnabled()) {
logger.debug("Example file is not readable: {}", path);
}
}
}
if (logger.isWarnEnabled()) {
logger.info("No example file found with correct file name extension in folder: {}", Paths.get(examplesFolderPath, exampleFolder));
}
return null;
}
/**
* Reads a hand-written description
*
* @param descriptionFolder the name of the folder where the description file resides
* @param descriptionFileName the name of the description file
* @return the content of the file
* @throws IOException
*/
private String handWrittenPathDescription(String descriptionFolder, String descriptionFileName) throws IOException {
for (String fileNameExtension : markupLanguage.getFileNameExtensions()) {
java.nio.file.Path path = Paths.get(descriptionsFolderPath, descriptionFolder, descriptionFileName + fileNameExtension);
if (Files.isReadable(path)) {
if (logger.isInfoEnabled()) {
logger.info("Description file processed: {}", path);
}
return FileUtils.readFileToString(path.toFile(), StandardCharsets.UTF_8).trim();
} else {
if (logger.isDebugEnabled()) {
logger.debug("Description file is not readable: {}", path);
}
}
}
if (logger.isWarnEnabled()) {
logger.info("No description file found with correct file name extension in folder: {}", Paths.get(descriptionsFolderPath, descriptionFolder));
}
return null;
}
private void responsesSection(Operation operation) {
Map<String, Response> responses = operation.getResponses();
if(MapUtils.isNotEmpty(responses)){
List<String> csvContent = new ArrayList<>();
csvContent.add(HTTP_CODE_COLUMN + DELIMITER + DESCRIPTION_COLUMN + DELIMITER + SCHEMA_COLUMN);
for(Map.Entry<String, Response> entry : responses.entrySet()){
Response response = entry.getValue();
if(response.getSchema() != null){
Property property = response.getSchema();
String type = PropertyUtils.getType(property, markupLanguage);
csvContent.add(entry.getKey() + DELIMITER + response.getDescription() + DELIMITER + type);
}else{
csvContent.add(entry.getKey() + DELIMITER + response.getDescription() + DELIMITER + "No Content");
}
}
this.markupDocBuilder.sectionTitleLevel3(RESPONSES);
this.markupDocBuilder.tableWithHeaderRow(csvContent);
}
}
}

View File

@@ -1,45 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup.utils;
import io.swagger.models.ArrayModel;
import io.swagger.models.Model;
import io.swagger.models.ModelImpl;
import io.swagger.models.RefModel;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.lang3.Validate;
public final class ModelUtils {
public static String getType(Model model, MarkupLanguage markupLanguage) {
Validate.notNull(model, "model must not be null!");
if (model instanceof ModelImpl) {
return ((ModelImpl) model).getType();
} else if (model instanceof RefModel) {
switch (markupLanguage){
case ASCIIDOC: return "<<" + ((RefModel) model).getSimpleRef() + ">>";
default: return ((RefModel) model).getSimpleRef();
}
} else if (model instanceof ArrayModel) {
ArrayModel arrayModel = ((ArrayModel) model);
return PropertyUtils.getType(arrayModel.getItems(), markupLanguage) + " " + arrayModel.getType();
}
return "NOT FOUND";
}
}

View File

@@ -1,87 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup.utils;
import io.swagger.models.Model;
import io.swagger.models.parameters.AbstractSerializableParameter;
import io.swagger.models.parameters.BodyParameter;
import io.swagger.models.parameters.Parameter;
import io.swagger.models.parameters.RefParameter;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import java.util.List;
public final class ParameterUtils {
public static String getType(Parameter parameter, MarkupLanguage markupLanguage){
Validate.notNull(parameter, "property must not be null!");
String type = "NOT FOUND";
if(parameter instanceof BodyParameter){
BodyParameter bodyParameter = (BodyParameter)parameter;
Model model = bodyParameter.getSchema();
type = ModelUtils.getType(model, markupLanguage);
}
else if(parameter instanceof AbstractSerializableParameter){
AbstractSerializableParameter serializableParameter = (AbstractSerializableParameter)parameter;
List enums = serializableParameter.getEnum();
if(CollectionUtils.isNotEmpty(enums)){
type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
}else{
type = getTypeWithFormat(serializableParameter.getType(), serializableParameter.getFormat());
}
if(type.equals("array")){
String collectionFormat = serializableParameter.getCollectionFormat();
type = collectionFormat + " " + PropertyUtils.getType(serializableParameter.getItems(), markupLanguage) + " " + type;
}
}
else if(parameter instanceof RefParameter){
RefParameter refParameter = (RefParameter)parameter;
switch (markupLanguage){
case ASCIIDOC: return "<<" + refParameter.getSimpleRef() + ">>";
default: return refParameter.getSimpleRef();
}
}
return StringUtils.defaultString(type);
}
private static String getTypeWithFormat(String typeWithoutFormat, String format) {
String type;
if(StringUtils.isNotBlank(format)){
type = StringUtils.defaultString(typeWithoutFormat) + " (" + format + ")";
}else{
type = StringUtils.defaultString(typeWithoutFormat);
}
return type;
}
public static String getDefaultValue(Parameter parameter){
Validate.notNull(parameter, "property must not be null!");
String defaultValue = "";
if(parameter instanceof AbstractSerializableParameter){
AbstractSerializableParameter serializableParameter = (AbstractSerializableParameter)parameter;
defaultValue = serializableParameter.getDefaultValue();
}
return StringUtils.defaultString(defaultValue);
}
}

View File

@@ -1,93 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup.utils;
import io.swagger.models.properties.*;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.Validate;
import java.util.List;
import java.util.Objects;
public final class PropertyUtils {
public static String getType(Property property, MarkupLanguage markupLanguage){
Validate.notNull(property, "property must not be null!");
String type;
if(property instanceof RefProperty){
RefProperty refProperty = (RefProperty)property;
switch (markupLanguage){
case ASCIIDOC: return "<<" + refProperty.getSimpleRef() + ">>";
default: return refProperty.getSimpleRef();
}
}else if(property instanceof ArrayProperty){
ArrayProperty arrayProperty = (ArrayProperty)property;
Property items = arrayProperty.getItems();
type = getType(items, markupLanguage) + " " + arrayProperty.getType();
}else if(property instanceof StringProperty){
StringProperty stringProperty = (StringProperty)property;
List<String> enums = stringProperty.getEnum();
if(CollectionUtils.isNotEmpty(enums)){
type = "enum" + " (" + StringUtils.join(enums, ", ") + ")";
}else{
type = property.getType();
}
}
else{
if(StringUtils.isNotBlank(property.getFormat())){
type = StringUtils.defaultString(property.getType()) + " (" + property.getFormat() + ")";
}else{
type = property.getType();
}
}
return StringUtils.defaultString(type);
}
public static String getDefaultValue(Property property){
Validate.notNull(property, "property must not be null!");
String defaultValue = "";
if(property instanceof BooleanProperty){
BooleanProperty booleanProperty = (BooleanProperty)property;
defaultValue = Objects.toString(booleanProperty.getDefault(), "");
}else if(property instanceof StringProperty){
StringProperty stringProperty = (StringProperty)property;
defaultValue = Objects.toString(stringProperty.getDefault(), "");
}else if(property instanceof DoubleProperty){
DoubleProperty doubleProperty = (DoubleProperty)property;
defaultValue = Objects.toString(doubleProperty.getDefault(), "");
}else if(property instanceof FloatProperty){
FloatProperty floatProperty = (FloatProperty)property;
defaultValue = Objects.toString(floatProperty.getDefault(), "");
}else if(property instanceof IntegerProperty){
IntegerProperty integerProperty = (IntegerProperty)property;
defaultValue = Objects.toString(integerProperty.getDefault(), "");
}
else if(property instanceof LongProperty){
LongProperty longProperty = (LongProperty)property;
defaultValue = Objects.toString(longProperty.getDefault(), "");
}
else if(property instanceof UUIDProperty){
UUIDProperty uuidProperty = (UUIDProperty)property;
defaultValue = Objects.toString(uuidProperty.getDefault(), "");
}
return defaultValue;
}
}

View File

@@ -1,163 +0,0 @@
/*
*
* Copyright 2015 Robert Winkler
*
* 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 io.github.robwin.swagger2markup;
import io.github.robwin.markup.builder.MarkupLanguage;
import org.apache.commons.io.FileUtils;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import static java.util.Arrays.asList;
import static org.assertj.core.api.BDDAssertions.assertThat;
/**
* @author Robert Winkler
*/
public class Swagger2MarkupConverterTest {
@Test
public void testSwagger2AsciiDocConversion() throws IOException {
//Given
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
File outputDirectory = new File("build/docs/asciidoc/generated");
FileUtils.deleteQuietly(outputDirectory);
//When
Swagger2MarkupConverter.from(file.getAbsolutePath()).build()
.intoFolder(outputDirectory.getAbsolutePath());
//Then
String[] directories = outputDirectory.list();
assertThat(directories).hasSize(3).containsAll(asList("definitions.adoc", "overview.adoc", "paths.adoc"));
}
@Test
public void testSwagger2AsciiDocConversionWithDescriptionsAndExamples() throws IOException {
//Given
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
File outputDirectory = new File("build/docs/asciidoc/generated");
FileUtils.deleteQuietly(outputDirectory);
//When
Swagger2MarkupConverter.from(file.getAbsolutePath()).withDescriptions("src/docs/asciidoc")
.withExamples("src/docs/asciidoc/paths").build()
.intoFolder(outputDirectory.getAbsolutePath());
//Then
String[] directories = outputDirectory.list();
assertThat(directories).hasSize(3).containsAll(asList("definitions.adoc", "overview.adoc", "paths.adoc"));
}
@Test
public void testSwagger2MarkdownConversion() throws IOException {
//Given
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
File outputDirectory = new File("build/docs/markdown/generated");
FileUtils.deleteQuietly(outputDirectory);
//When
Swagger2MarkupConverter.from(file.getAbsolutePath()).
withMarkupLanguage(MarkupLanguage.MARKDOWN).build()
.intoFolder(outputDirectory.getAbsolutePath());
//Then
String[] directories = outputDirectory.list();
assertThat(directories).hasSize(3).containsAll(asList("definitions.md", "overview.md", "paths.md"));
}
@Test
public void testSwagger2MarkdownConversionWithDescriptions() throws IOException {
//Given
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
File outputDirectory = new File("build/docs/markdown/generated");
FileUtils.deleteQuietly(outputDirectory);
//When
Swagger2MarkupConverter.from(file.getAbsolutePath()).withDescriptions("src/docs/markdown").
withMarkupLanguage(MarkupLanguage.MARKDOWN).build()
.intoFolder(outputDirectory.getAbsolutePath());
//Then
String[] directories = outputDirectory.list();
assertThat(directories).hasSize(3).containsAll(asList("definitions.md", "overview.md", "paths.md"));
}
@Test
public void testSwagger2AsciiDocConversionWithSeparatedDefinitions() throws IOException {
//Given
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
File outputDirectory = new File("build/docs/asciidoc/generated");
FileUtils.deleteQuietly(outputDirectory);
//When
Swagger2MarkupConverter.from(file.getAbsolutePath()).withSeparatedDefinitions().build()
.intoFolder(outputDirectory.getAbsolutePath());
//Then
String[] directories = outputDirectory.list();
assertThat(directories).hasSize(8).containsAll(
asList("definitions.adoc", "overview.adoc", "paths.adoc",
"user.adoc", "category.adoc", "pet.adoc", "tag.adoc", "order.adoc"));
assertThat(new String(Files.readAllBytes(Paths.get(outputDirectory + File.separator + "definitions.adoc"))))
.contains(new String(Files.readAllBytes(Paths.get(outputDirectory + File.separator + "user.adoc"))));
}
@Test
public void testSwagger2MarkdownConversionWithSeparatedDefinitions() throws IOException {
//Given
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
File outputDirectory = new File("build/docs/asciidoc/generated");
FileUtils.deleteQuietly(outputDirectory);
//When
Swagger2MarkupConverter.from(file.getAbsolutePath()).withSeparatedDefinitions().
withMarkupLanguage(MarkupLanguage.MARKDOWN).build()
.intoFolder(outputDirectory.getAbsolutePath());
//Then
String[] directories = outputDirectory.list();
assertThat(directories).hasSize(8).containsAll(
asList("definitions.md", "overview.md", "paths.md",
"user.md", "category.md", "pet.md", "tag.md", "order.md"));
assertThat(new String(Files.readAllBytes(Paths.get(outputDirectory + File.separator + "definitions.md"))))
.contains(new String(Files.readAllBytes(Paths.get(outputDirectory + File.separator + "user.md"))));
}
/*
@Test
public void testSwagger2HtmlConversion() throws IOException {
File file = new File(Swagger2MarkupConverterTest.class.getResource("/json/swagger.json").getFile());
String asciiDoc = Swagger2MarkupConverter.from(file.getAbsolutePath()).build().asString();
String path = "build/docs/generated/asciidocAsString";
Files.createDirectories(Paths.get(path));
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path, "swagger.adoc"), StandardCharsets.UTF_8)){
writer.write(asciiDoc); }
String asciiDocAsHtml = Asciidoctor.Factory.create().convert(asciiDoc,
OptionsBuilder.options().backend("html5").headerFooter(true).safe(SafeMode.UNSAFE).docType("book").attributes(AttributesBuilder.attributes()
.tableOfContents(true).tableOfContents(Placement.LEFT).sectionNumbers(true).hardbreaks(true).setAnchors(true).attribute("sectlinks")));
try (BufferedWriter writer = Files.newBufferedWriter(Paths.get(path, "swagger.html"), StandardCharsets.UTF_8)){
writer.write(asciiDocAsHtml);
}
}
*/
}

View File

@@ -1,850 +0,0 @@
{
"swagger": "2.0",
"info": {
"description": "This is a sample server Petstore server.\n\n[Learn about Swagger](http://swagger.wordnik.com) or join the IRC channel `#swagger` on irc.freenode.net.\n\nFor this sample, you can use the api key `special-key` to test the authorization filters\n",
"version": "1.0.0",
"title": "Swagger Petstore API",
"termsOfService": "http://helloreverb.com/terms/",
"contact": {
"name": "apiteam@wordnik.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
}
},
"host": "petstore.swagger.wordnik.com",
"basePath": "/v2",
"schemes": [
"http"
],
"paths": {
"/pets": {
"post": {
"tags": [
"pet"
],
"summary": "Add a new pet to the store",
"description": "",
"operationId": "addPet",
"consumes": [
"application/json",
"application/xml"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Pet object that needs to be added to the store",
"required": false,
"schema": {
"$ref": "#/definitions/Pet"
}
}
],
"responses": {
"405": {
"description": "Invalid input"
}
},
"security": [
{
"petstore_auth": [
"write_pets",
"read_pets"
]
}
]
},
"put": {
"tags": [
"pet"
],
"summary": "Update an existing pet",
"description": "",
"operationId": "updatePet",
"consumes": [
"application/json",
"application/xml"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Pet object that needs to be added to the store",
"required": false,
"schema": {
"$ref": "#/definitions/Pet"
}
}
],
"responses": {
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Pet not found"
},
"405": {
"description": "Validation exception"
}
},
"security": [
{
"petstore_auth": [
"write_pets",
"read_pets"
]
}
]
}
},
"/pets/findByStatus": {
"get": {
"tags": [
"pet"
],
"summary": "Finds Pets by status",
"description": "Multiple status values can be provided with comma seperated strings",
"operationId": "findPetsByStatus",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "query",
"name": "status",
"description": "Status values that need to be considered for filter",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"400": {
"description": "Invalid status value"
}
},
"security": [
{
"petstore_auth": [
"write_pets",
"read_pets"
]
}
]
}
},
"/pets/findByTags": {
"get": {
"tags": [
"pet"
],
"summary": "Finds Pets by tags",
"description": "Muliple tags can be provided with comma seperated strings. Use tag1, tag2, tag3 for testing.",
"operationId": "findPetsByTags",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "query",
"name": "tags",
"description": "Tags to filter by",
"required": false,
"type": "array",
"items": {
"type": "string"
},
"collectionFormat": "multi"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/Pet"
}
}
},
"400": {
"description": "Invalid tag value"
}
},
"security": [
{
"petstore_auth": [
"write_pets",
"read_pets"
]
}
]
}
},
"/pets/{petId}": {
"get": {
"tags": [
"pet"
],
"summary": "Find pet by ID",
"description": "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate API error conditions",
"operationId": "getPetById",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "path",
"name": "petId",
"description": "ID of pet that needs to be fetched",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Pet"
}
},
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Pet not found"
}
},
"security": [
{
"api_key": []
},
{
"petstore_auth": [
"write_pets",
"read_pets"
]
}
]
},
"post": {
"tags": [
"pet"
],
"summary": "Updates a pet in the store with form data",
"description": "",
"operationId": "updatePetWithForm",
"consumes": [
"application/x-www-form-urlencoded"
],
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "path",
"name": "petId",
"description": "ID of pet that needs to be updated",
"required": true,
"type": "string"
},
{
"in": "formData",
"name": "name",
"description": "Updated name of the pet",
"required": true,
"type": "string"
},
{
"in": "formData",
"name": "status",
"description": "Updated status of the pet",
"required": true,
"type": "string"
}
],
"responses": {
"405": {
"description": "Invalid input"
}
},
"security": [
{
"petstore_auth": [
"write_pets",
"read_pets"
]
}
]
},
"delete": {
"tags": [
"pet"
],
"summary": "Deletes a pet",
"description": "",
"operationId": "deletePet",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "header",
"name": "api_key",
"description": "",
"required": true,
"type": "string"
},
{
"in": "path",
"name": "petId",
"description": "Pet id to delete",
"required": true,
"type": "integer",
"format": "int64"
}
],
"responses": {
"400": {
"description": "Invalid pet value"
}
},
"security": [
{
"petstore_auth": [
"write_pets",
"read_pets"
]
}
]
}
},
"/stores/order": {
"post": {
"tags": [
"store"
],
"summary": "Place an order for a pet",
"description": "",
"operationId": "placeOrder",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "order placed for purchasing the pet",
"required": false,
"schema": {
"$ref": "#/definitions/Order"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Order"
}
},
"400": {
"description": "Invalid Order"
}
}
}
},
"/stores/order/{orderId}": {
"get": {
"tags": [
"store"
],
"summary": "Find purchase order by ID",
"description": "For valid response try integer IDs with value <= 5 or > 10. Other values will generated exceptions",
"operationId": "getOrderById",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "path",
"name": "orderId",
"description": "ID of pet that needs to be fetched",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/Order"
}
},
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Order not found"
}
}
},
"delete": {
"tags": [
"store"
],
"summary": "Delete purchase order by ID",
"description": "For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors",
"operationId": "deleteOrder",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "path",
"name": "orderId",
"description": "ID of the order that needs to be deleted",
"required": true,
"type": "string"
}
],
"responses": {
"400": {
"description": "Invalid ID supplied"
},
"404": {
"description": "Order not found"
}
}
}
},
"/users": {
"post": {
"tags": [
"user"
],
"summary": "Create user",
"description": "This can only be done by the logged in user.",
"operationId": "createUser",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "Created user object",
"required": false,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/users/createWithArray": {
"post": {
"tags": [
"user"
],
"summary": "Creates list of users with given input array",
"description": "",
"operationId": "createUsersWithArrayInput",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "List of user object",
"required": false,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/users/createWithList": {
"post": {
"tags": [
"user"
],
"summary": "Creates list of users with given input array",
"description": "",
"operationId": "createUsersWithListInput",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "body",
"name": "body",
"description": "List of user object",
"required": false,
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/User"
}
}
}
],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/users/login": {
"get": {
"tags": [
"user"
],
"summary": "Logs user into the system",
"description": "",
"operationId": "loginUser",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "query",
"name": "username",
"description": "The user name for login",
"required": false,
"type": "string",
"default": "testUser"
},
{
"in": "query",
"name": "password",
"description": "The password for login in clear text",
"required": false,
"type": "string",
"default": "testPassword"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"type": "string"
}
},
"400": {
"description": "Invalid username/password supplied"
}
}
}
},
"/users/logout": {
"get": {
"tags": [
"user"
],
"summary": "Logs out current logged in user session",
"description": "",
"operationId": "logoutUser",
"produces": [
"application/json",
"application/xml"
],
"responses": {
"default": {
"description": "successful operation"
}
}
}
},
"/users/{username}": {
"get": {
"tags": [
"user"
],
"summary": "Get user by user name",
"description": "",
"operationId": "getUserByName",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "path",
"name": "username",
"description": "The name that needs to be fetched. Use user1 for testing.",
"required": true,
"type": "string",
"default": "testUser"
}
],
"responses": {
"200": {
"description": "successful operation",
"schema": {
"$ref": "#/definitions/User"
}
},
"400": {
"description": "Invalid username supplied"
},
"404": {
"description": "User not found"
}
}
},
"put": {
"tags": [
"user"
],
"summary": "Updated user",
"description": "This can only be done by the logged in user.",
"operationId": "updateUser",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "path",
"name": "username",
"description": "name that need to be deleted",
"required": true,
"type": "string"
},
{
"in": "body",
"name": "body",
"description": "Updated user object",
"required": false,
"schema": {
"$ref": "#/definitions/User"
}
}
],
"responses": {
"400": {
"description": "Invalid user supplied"
},
"404": {
"description": "User not found"
}
}
},
"delete": {
"tags": [
"user"
],
"summary": "Delete user",
"description": "This can only be done by the logged in user.",
"operationId": "deleteUser",
"produces": [
"application/json",
"application/xml"
],
"parameters": [
{
"in": "path",
"name": "username",
"description": "The name that needs to be deleted",
"required": true,
"type": "string"
}
],
"responses": {
"400": {
"description": "Invalid username supplied"
},
"404": {
"description": "User not found"
}
}
}
}
},
"securityDefinitions": {
"api_key": {
"type": "apiKey",
"name": "api_key",
"in": "header"
},
"petstore_auth": {
"type": "oauth2",
"authorizationUrl": "http://petstore.swagger.wordnik.com/api/oauth/dialog",
"flow": "implicit",
"scopes": {
"write_pets": "modify pets in your account",
"read_pets": "read your pets"
}
}
},
"definitions": {
"User": {
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"username": {
"type": "string"
},
"firstName": {
"type": "string"
},
"lastName": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"phone": {
"type": "string"
},
"userStatus": {
"type": "integer",
"format": "int32",
"description": "User Status"
}
}
},
"Category": {
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
},
"Pet": {
"description" : "Test description",
"required": [
"name",
"photoUrls"
],
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"category": {
"$ref": "#/definitions/Category"
},
"name": {
"type": "string",
"example": "doggie"
},
"photoUrls": {
"type": "array",
"items": {
"type": "string"
}
},
"tags": {
"type": "array",
"items": {
"$ref": "#/definitions/Tag"
}
},
"status": {
"type": "string",
"description": "pet status in the store"
}
}
},
"Tag": {
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"name": {
"type": "string"
}
}
},
"Order": {
"properties": {
"id": {
"type": "integer",
"format": "int64"
},
"petId": {
"type": "integer",
"format": "int64"
},
"quantity": {
"type": "integer",
"format": "int32"
},
"shipDate": {
"type": "string",
"format": "date-time"
},
"status": {
"type": "string",
"description": "Order Status"
},
"complete": {
"type": "boolean"
}
}
}
}
}