\nemail<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nfirstName<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nid<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \nlastName<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \npassword<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nphone<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nuserStatus<\/strong> \noptional<\/em><\/p><\/td>\nUser Status<\/p><\/td>\n | integer(int32)<\/p><\/td>\n<\/tr>\n | \nusername<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","representation":"storage"}},"ancestors":[{"id":1,"type":"page"}],"space":{"key":"DOC"}}
--------------------------------------------------------------------------------
/swagger-confluence-core/src/test/resources/swagger-confluence-update-json-body-user-example.json:
--------------------------------------------------------------------------------
1 | {"id":"1277959","type":"page","title":"3.5. User","body":{"storage":{"value":"\n User<\/strong><\/h3>\n\n\n\n\n\n<\/colgroup>\n\n\n| Name<\/th>\n | Description<\/th>\n | Schema<\/th>\n<\/tr>\n<\/thead>\n | \n\nemail<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nfirstName<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nid<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \nlastName<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \npassword<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nphone<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nuserStatus<\/strong> \noptional<\/em><\/p><\/td>\nUser Status<\/p><\/td>\n | integer(int32)<\/p><\/td>\n<\/tr>\n | \nusername<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","representation":"storage"}},"ancestors":[{"id":1474805,"type":"page"}],"version":{"number":2},"space":{"key":"DOC"}}
--------------------------------------------------------------------------------
/swagger-confluence-gradle-plugin/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | repositories {
3 | mavenLocal()
4 | maven {
5 | url "https://plugins.gradle.org/m2/"
6 | }
7 | jcenter()
8 | mavenCentral()
9 | }
10 | dependencies {
11 | classpath 'org.apache.maven:maven-model:3.3.9'
12 | classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.6'
13 | classpath "com.gradle.publish:plugin-publish-plugin:0.9.3"
14 | }
15 | }
16 |
17 | apply plugin: 'com.jfrog.bintray'
18 | apply plugin: "com.gradle.plugin-publish"
19 |
20 | bintray {
21 | user = "$System.env.BINTRAY_USER"
22 | key = "$System.env.BINTRAY_PASS"
23 | publications = ['myPublication']
24 | pkg {
25 | version {
26 | name = project.version
27 | }
28 | repo = "$System.env.BINTRAY_REPO"
29 | name = 'swagger-confluence-gradle-plugin'
30 | userOrg = "$System.env.BINTRAY_USER"
31 | licenses = ['Apache-2.0']
32 | vcsUrl = 'https://cloud.slkdev.net/gitlab/starlightknight/swagger-confluence'
33 | websiteUrl = 'https://cloud.slkdev.net/swagger-confluence'
34 | issueTrackerUrl = 'https://cloud.slkdev.net/gitlab/starlightknight/swagger-confluence/issues'
35 | labels = ['swagger','confluence']
36 | }
37 | }
38 |
39 | evaluationDependsOn(':swagger-confluence-core')
40 |
41 | dependencies {
42 | compile (project(':swagger-confluence-core'))
43 | compile gradleApi()
44 | }
45 |
46 | publishing {
47 | def mavenReleaseUrl = "$System.env.MAVEN_PUBLISH_PLUGIN_RELEASE_URL"
48 | def mavenSnapshotUrl = "$System.env.MAVEN_PUBLISH_PLUGIN_SNAPSHOT_URL"
49 | def mavenUser = "$System.env.MAVEN_PUBLISH_USER"
50 | def mavenPass = "$System.env.MAVEN_PUBLISH_PASS"
51 |
52 | repositories {
53 | maven {
54 | if (mavenReleaseUrl != "null" || mavenSnapshotUrl != "null") {
55 | if (mavenSnapshotUrl != "null" && project.version.endsWith('-SNAPSHOT')) {
56 | url mavenSnapshotUrl
57 | }
58 | else {
59 | url mavenReleaseUrl
60 | }
61 | credentials {
62 | username mavenUser
63 | password mavenPass
64 | }
65 | }
66 | else {
67 | url "${System.properties.'user.home'}/.m2/repository"
68 | }
69 | }
70 | }
71 | }
72 |
73 | publishing {
74 | publications {
75 | myPublication(MavenPublication) {
76 | from components.java
77 |
78 | artifact sourceJar {
79 | classifier "sources"
80 | }
81 | }
82 | }
83 | }
84 |
85 | pluginBundle {
86 | website = 'https://cloud.slkdev.net/swagger-confluence/'
87 | vcsUrl = 'https://cloud.slkdev.net/gitlab/starlightknight/swagger-confluence'
88 | description = 'A plugin for parsing a Swagger schema and publishing API documentation to an Atlassian Confluence server'
89 | tags = ['swagger', 'confluence']
90 |
91 | plugins {
92 | swaggerConfluencePlugin {
93 | id = 'net.slkdev.swagger-confluence'
94 | displayName = 'Swagger Confluence'
95 | }
96 | }
97 |
98 | mavenCoordinates {
99 | groupId = "net.slkdev.swagger.confluence"
100 | artifactId = "swagger-confluence-gradle-plugin"
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/swagger-confluence-cli/src/test/java/net/slkdev/swagger/confluence/cli/SwaggerConfluenceTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Aaron Knight
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.slkdev.swagger.confluence.cli;
17 |
18 | import net.slkdev.swagger.confluence.config.SwaggerConfluenceConfig;
19 | import net.slkdev.swagger.confluence.constants.PaginationMode;
20 | import net.slkdev.swagger.confluence.service.SwaggerToConfluenceService;
21 | import org.junit.Before;
22 | import org.junit.Test;
23 | import org.junit.runner.RunWith;
24 | import org.mockito.ArgumentCaptor;
25 | import org.mockito.Mock;
26 | import org.mockito.runners.MockitoJUnitRunner;
27 |
28 | import static org.junit.Assert.assertEquals;
29 | import static org.mockito.Mockito.verify;
30 |
31 | @RunWith(MockitoJUnitRunner.class)
32 | public class SwaggerConfluenceTest {
33 |
34 | @Mock
35 | private SwaggerToConfluenceService swaggerToConfluenceService;
36 |
37 | private SwaggerConfluence swaggerConfluence;
38 |
39 | @Before
40 | public void setUp(){
41 | swaggerConfluence = new SwaggerConfluence(swaggerToConfluenceService);
42 | }
43 |
44 | @Test
45 | public void testRunCLI(){
46 | final String[] args = new String[]{
47 | "-b", "c3RhcmxpZ2h0a25pZ2h0OnRyb2wsb2NrNw==",
48 | "-g", "false", "-p", "[CLI]", "-i", "false",
49 | "-k", "DOC", "-s", "swagger-petstore-example.yaml",
50 | "-t", "Swagger Pet Store", "-m", "single"
51 | };
52 |
53 | final ArgumentCaptor swaggerConfluenceConfigArgumentCaptor =
54 | ArgumentCaptor.forClass(SwaggerConfluenceConfig.class);
55 |
56 | swaggerConfluence.runCLI(args);
57 |
58 | verify(swaggerToConfluenceService).convertSwaggerToConfluence(
59 | swaggerConfluenceConfigArgumentCaptor.capture());
60 |
61 | final SwaggerConfluenceConfig swaggerConfluenceConfig =
62 | swaggerConfluenceConfigArgumentCaptor.getValue();
63 |
64 | assertEquals("Authentication Parsed Incorrectly!", args[1],
65 | swaggerConfluenceConfig.getAuthentication());
66 | assertEquals("Generate Numeric Prefixes Parsed Incorrectly!", Boolean.valueOf(args[3]),
67 | swaggerConfluenceConfig.isGenerateNumericPrefixes());
68 | assertEquals("Prefix Parsed Incorrectly!", args[5]+" ",
69 | swaggerConfluenceConfig.getPrefix());
70 | assertEquals("Include ToC for Single Parsed Incorrectly!", Boolean.valueOf(args[7]),
71 | swaggerConfluenceConfig.isIncludeTableOfContentsOnSinglePage());
72 | assertEquals("Space Key Parsed Incorrectly!", args[9],
73 | swaggerConfluenceConfig.getSpaceKey());
74 | assertEquals("Schema Location Parsed Incorrectly!", args[11],
75 | swaggerConfluenceConfig.getSwaggerSchema());
76 | assertEquals("Title Parsed Incorrectly!", args[13],
77 | swaggerConfluenceConfig.getTitle());
78 | assertEquals("Pagination Mode Parsed Incorrectly!", PaginationMode.SINGLE_PAGE,
79 | swaggerConfluenceConfig.getPaginationMode());
80 | }
81 |
82 | }
83 |
--------------------------------------------------------------------------------
/swagger-confluence-core/src/test/java/net/slkdev/swagger/confluence/service/impl/SwaggerToConfluenceImplTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Aaron Knight
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.slkdev.swagger.confluence.service.impl;
17 |
18 | import net.slkdev.swagger.confluence.config.SwaggerConfluenceConfig;
19 | import net.slkdev.swagger.confluence.constants.PaginationMode;
20 | import net.slkdev.swagger.confluence.service.AsciiDocToXHtmlService;
21 | import net.slkdev.swagger.confluence.service.SwaggerToAsciiDocService;
22 | import net.slkdev.swagger.confluence.service.SwaggerToConfluenceService;
23 | import net.slkdev.swagger.confluence.service.XHtmlToConfluenceService;
24 | import org.junit.Before;
25 | import org.junit.Test;
26 | import org.junit.runner.RunWith;
27 | import org.mockito.Mock;
28 | import org.mockito.runners.MockitoJUnitRunner;
29 |
30 | @RunWith(MockitoJUnitRunner.class)
31 | public class SwaggerToConfluenceImplTest {
32 |
33 | @Mock
34 | private AsciiDocToXHtmlService asciiDocToXHtmlService;
35 |
36 | @Mock
37 | private SwaggerToAsciiDocService swaggerToAsciiDocService;
38 |
39 | @Mock
40 | private XHtmlToConfluenceService xHtmlToConfluenceService;
41 |
42 | private SwaggerConfluenceConfig swaggerConfluenceConfig;
43 | private SwaggerToConfluenceService swaggerToConfluenceService;
44 |
45 | @Before
46 | public void setUp(){
47 | swaggerToConfluenceService = new SwaggerToConfluenceServiceImpl(
48 | swaggerToAsciiDocService, asciiDocToXHtmlService, xHtmlToConfluenceService);
49 | swaggerConfluenceConfig = new SwaggerConfluenceConfig();
50 | swaggerConfluenceConfig.setAncestorId(1);
51 | swaggerConfluenceConfig.setIncludeTableOfContentsOnSinglePage(true);
52 | swaggerConfluenceConfig.setSpaceKey("TEST");
53 | swaggerConfluenceConfig.setSwaggerSchema("test.yaml");
54 | swaggerConfluenceConfig.setPrefix("[TEST]");
55 | swaggerConfluenceConfig.setAuthentication("abcdef");
56 | swaggerConfluenceConfig.setConfluenceRestApiUrl("http://localhost/rest/api");
57 | swaggerConfluenceConfig.setGenerateNumericPrefixes(true);
58 | swaggerConfluenceConfig.setPaginationMode(PaginationMode.SINGLE_PAGE);
59 | swaggerConfluenceConfig.setTitle("Test");
60 | }
61 |
62 | @Test(expected=NullPointerException.class)
63 | public void testSwaggerSchemaCannotBeNull(){
64 | swaggerConfluenceConfig.setSwaggerSchema(null);
65 | swaggerToConfluenceService.convertSwaggerToConfluence(swaggerConfluenceConfig);
66 | }
67 |
68 | @Test(expected=NullPointerException.class)
69 | public void testConfluenceRestAPIUrlCannotBeNull(){
70 | swaggerConfluenceConfig.setConfluenceRestApiUrl(null);
71 | swaggerToConfluenceService.convertSwaggerToConfluence(swaggerConfluenceConfig);
72 | }
73 |
74 | @Test(expected=NullPointerException.class)
75 | public void testAuthenticationCannotBeNull(){
76 | swaggerConfluenceConfig.setAuthentication(null);
77 | swaggerToConfluenceService.convertSwaggerToConfluence(swaggerConfluenceConfig);
78 | }
79 |
80 | @Test(expected=NullPointerException.class)
81 | public void testSpaceKeyCannotBeNull(){
82 | swaggerConfluenceConfig.setSpaceKey(null);
83 | swaggerToConfluenceService.convertSwaggerToConfluence(swaggerConfluenceConfig);
84 | }
85 | }
86 |
--------------------------------------------------------------------------------
/swagger-confluence-core/src/main/java/net/slkdev/swagger/confluence/service/impl/SwaggerToConfluenceServiceImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Aaron Knight
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.slkdev.swagger.confluence.service.impl;
17 |
18 | import net.slkdev.swagger.confluence.config.SwaggerConfluenceConfig;
19 | import net.slkdev.swagger.confluence.constants.PaginationMode;
20 | import net.slkdev.swagger.confluence.service.AsciiDocToXHtmlService;
21 | import net.slkdev.swagger.confluence.service.SwaggerToAsciiDocService;
22 | import net.slkdev.swagger.confluence.service.SwaggerToConfluenceService;
23 | import net.slkdev.swagger.confluence.service.XHtmlToConfluenceService;
24 | import org.slf4j.Logger;
25 | import org.slf4j.LoggerFactory;
26 |
27 | import static org.apache.commons.lang3.Validate.notNull;
28 |
29 | public class SwaggerToConfluenceServiceImpl implements SwaggerToConfluenceService {
30 |
31 | private static final Logger LOG = LoggerFactory.getLogger(SwaggerToConfluenceServiceImpl.class);
32 |
33 | private final SwaggerToAsciiDocService swaggerToAsciiDocService;
34 | private final AsciiDocToXHtmlService asciiDocToXHtmlService;
35 | private final XHtmlToConfluenceService xHtmlToConfluenceService;
36 |
37 | public SwaggerToConfluenceServiceImpl(final SwaggerToAsciiDocService swaggerToAsciiDocService,
38 | final AsciiDocToXHtmlService asciiDocToXHtmlService,
39 | final XHtmlToConfluenceService xHtmlToConfluenceService) {
40 | this.swaggerToAsciiDocService = swaggerToAsciiDocService;
41 | this.asciiDocToXHtmlService = asciiDocToXHtmlService;
42 | this.xHtmlToConfluenceService = xHtmlToConfluenceService;
43 | }
44 |
45 | @Override
46 | public void convertSwaggerToConfluence(final SwaggerConfluenceConfig swaggerConfluenceConfig) {
47 | final String swaggerSchema = swaggerConfluenceConfig.getSwaggerSchema();
48 | final String confluenceRestApiUrl = swaggerConfluenceConfig.getConfluenceRestApiUrl();
49 | final String spaceKey = swaggerConfluenceConfig.getSpaceKey();
50 | final String prefix = swaggerConfluenceConfig.getPrefix();
51 | final PaginationMode paginationMode = swaggerConfluenceConfig.getPaginationMode();
52 |
53 | notNull(swaggerSchema, "Swagger Schema Cannot Be Null!");
54 | notNull(confluenceRestApiUrl, "Confluence REST API URL Cannot Be Null!");
55 | notNull(swaggerConfluenceConfig.getAuthentication(), "Confluence Authentication Cannot Be Null!");
56 | notNull(spaceKey, "Confluence Space Key Cannot Be Null!");
57 |
58 | LOG.info("Publishing Swagger API Documentation to Confluence...");
59 | LOG.info("Swagger Schema: {}", swaggerSchema);
60 | LOG.info("Confluence REST API URL: {}", confluenceRestApiUrl);
61 | LOG.info("Confluence Space Key: {}", spaceKey);
62 | LOG.info("Confluence PaginationMode: {}", paginationMode);
63 |
64 | if (prefix == null) {
65 | LOG.info("Confluence Title Prefix: No Prefix Supplied");
66 | } else {
67 | LOG.info("Confluence Title Prefix: {}", prefix);
68 | }
69 |
70 | LOG.info("Confluence Generate Numeric Prefixes: {}",
71 | swaggerConfluenceConfig.isGenerateNumericPrefixes());
72 |
73 | final String asciiDoc = swaggerToAsciiDocService.convertSwaggerToAsciiDoc(swaggerSchema);
74 | final String xhtml = asciiDocToXHtmlService.convertAsciiDocToXHtml(asciiDoc);
75 | xHtmlToConfluenceService.postXHtmlToConfluence(swaggerConfluenceConfig, xhtml);
76 | }
77 |
78 | }
79 |
--------------------------------------------------------------------------------
/swagger-confluence-core/src/main/java/net/slkdev/swagger/confluence/service/impl/SwaggerToAsciiDocServiceImpl.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Aaron Knight
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.slkdev.swagger.confluence.service.impl;
17 |
18 | import io.github.swagger2markup.*;
19 | import io.github.swagger2markup.builder.Swagger2MarkupConfigBuilder;
20 | import io.github.swagger2markup.markup.builder.MarkupLanguage;
21 | import net.slkdev.swagger.confluence.exception.SwaggerConfluenceConfigurationException;
22 | import net.slkdev.swagger.confluence.exception.SwaggerConfluenceInternalSystemException;
23 | import net.slkdev.swagger.confluence.service.SwaggerToAsciiDocService;
24 | import org.apache.commons.io.FileUtils;
25 | import org.slf4j.Logger;
26 | import org.slf4j.LoggerFactory;
27 |
28 | import java.io.File;
29 | import java.io.FileNotFoundException;
30 | import java.io.IOException;
31 | import java.net.URISyntaxException;
32 | import java.net.URL;
33 | import java.nio.charset.StandardCharsets;
34 |
35 | public class SwaggerToAsciiDocServiceImpl implements SwaggerToAsciiDocService {
36 |
37 | private static final Logger LOG = LoggerFactory.getLogger(SwaggerToAsciiDocServiceImpl.class);
38 |
39 | @Override
40 | public String convertSwaggerToAsciiDoc(final String swaggerSchemaPath) {
41 | final File swaggerSchemaFile;
42 |
43 | LOG.info("Converting Swagger Schema to Ascii Doc...");
44 |
45 | try {
46 | swaggerSchemaFile = getSchemaFile(swaggerSchemaPath);
47 | } catch (final FileNotFoundException | URISyntaxException e) {
48 | throw new SwaggerConfluenceConfigurationException("Error Locating Swagger Schema", e);
49 | }
50 |
51 |
52 | final String swaggerAsciiDoc;
53 |
54 | try {
55 | final Swagger2MarkupConfig config = new Swagger2MarkupConfigBuilder()
56 | .withMarkupLanguage(MarkupLanguage.ASCIIDOC)
57 | .withOutputLanguage(Language.EN)
58 | .withPathsGroupedBy(GroupBy.AS_IS)
59 | .withOperationOrdering(OrderBy.AS_IS)
60 | .build();
61 |
62 | final String swaggerSchema = FileUtils.readFileToString(swaggerSchemaFile, StandardCharsets.UTF_8);
63 |
64 | swaggerAsciiDoc = Swagger2MarkupConverter.from(swaggerSchema)
65 | .withConfig(config)
66 | .build()
67 | .toString();
68 |
69 | } catch (IOException e) {
70 | throw new SwaggerConfluenceInternalSystemException(
71 | "Error Converting Swagger Schema to AsciiDoc", e);
72 | }
73 |
74 | LOG.info("AsciiDoc Conversion Complete!");
75 |
76 | return swaggerAsciiDoc;
77 | }
78 |
79 | private static File getSchemaFile(final String swaggerSchemaPath) throws FileNotFoundException, URISyntaxException {
80 | // First we'll try to find the file directly
81 | File swaggerFile = new File(swaggerSchemaPath);
82 |
83 | // If we can't find it, we'll check the classpath
84 | if (!swaggerFile.exists()) {
85 | final URL swaggerSchemaURL = SwaggerToAsciiDocServiceImpl.class.getResource(swaggerSchemaPath);
86 |
87 | if (swaggerSchemaURL == null) {
88 | swaggerFile = null;
89 | } else {
90 | swaggerFile = new File(swaggerSchemaURL.toURI());
91 | }
92 | }
93 |
94 | if (swaggerFile == null || !swaggerFile.exists() || !swaggerFile.canRead()) {
95 | throw new FileNotFoundException(
96 | String.format("Unable to Locate Swagger Schema at Path <%s>",
97 | swaggerSchemaPath));
98 | }
99 |
100 | return swaggerFile;
101 | }
102 |
103 | }
104 |
--------------------------------------------------------------------------------
/swagger-confluence-core/src/main/java/net/slkdev/swagger/confluence/config/SwaggerConfluenceConfig.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Aaron Knight
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.slkdev.swagger.confluence.config;
17 |
18 | import net.slkdev.swagger.confluence.constants.PaginationMode;
19 | import net.slkdev.swagger.confluence.exception.SwaggerConfluenceConfigurationException;
20 | import org.apache.commons.lang3.StringUtils;
21 |
22 | public class SwaggerConfluenceConfig {
23 |
24 | private Integer ancestorId;
25 | private String authentication;
26 | private String confluenceRestApiUrl;
27 | private boolean generateNumericPrefixes;
28 | private boolean includeTableOfContentsOnSinglePage;
29 | private PaginationMode paginationMode;
30 | private String prefix;
31 | private String spaceKey;
32 | private String swaggerSchema;
33 | private String title;
34 |
35 | public SwaggerConfluenceConfig() {
36 | generateNumericPrefixes = true;
37 | includeTableOfContentsOnSinglePage = true;
38 | paginationMode = PaginationMode.SINGLE_PAGE;
39 | }
40 |
41 | public Integer getAncestorId() {
42 | return ancestorId;
43 | }
44 |
45 | public void setAncestorId(final Integer ancestorId) {
46 | this.ancestorId = ancestorId;
47 | }
48 |
49 | public String getAuthentication() {
50 | return authentication;
51 | }
52 |
53 | public void setAuthentication(final String authentication) {
54 | this.authentication = authentication;
55 | }
56 |
57 | public String getConfluenceRestApiUrl() {
58 | return confluenceRestApiUrl;
59 | }
60 |
61 | public void setConfluenceRestApiUrl(final String confluenceRestApiUrl) {
62 | this.confluenceRestApiUrl = confluenceRestApiUrl;
63 | }
64 |
65 | public boolean isGenerateNumericPrefixes() {
66 | return generateNumericPrefixes;
67 | }
68 |
69 | public void setGenerateNumericPrefixes(final boolean generateNumericPrefixes) {
70 | this.generateNumericPrefixes = generateNumericPrefixes;
71 | }
72 |
73 | public boolean isIncludeTableOfContentsOnSinglePage() {
74 | return includeTableOfContentsOnSinglePage;
75 | }
76 |
77 | public void setIncludeTableOfContentsOnSinglePage(final boolean includeTableOfContentsOnSinglePage) {
78 | this.includeTableOfContentsOnSinglePage = includeTableOfContentsOnSinglePage;
79 | }
80 |
81 | public PaginationMode getPaginationMode() {
82 | return paginationMode;
83 | }
84 |
85 | public void setPaginationMode(final PaginationMode paginationMode) {
86 | this.paginationMode = paginationMode;
87 | }
88 |
89 | public void setPaginationMode(final String paginationMode) {
90 | switch (paginationMode) {
91 | case "single":
92 | this.paginationMode = PaginationMode.SINGLE_PAGE;
93 | break;
94 | case "category":
95 | this.paginationMode = PaginationMode.CATEGORY_PAGES;
96 | break;
97 | case "individual":
98 | this.paginationMode = PaginationMode.INDIVIDUAL_PAGES;
99 | break;
100 | default:
101 | throw new SwaggerConfluenceConfigurationException(
102 | String.format("Invalid Pagination Mode <%s>", paginationMode)
103 | );
104 | }
105 | }
106 |
107 | public String getPrefix() {
108 | return prefix;
109 | }
110 |
111 | public void setPrefix(final String prefix) {
112 | if (prefix.endsWith(" ")) {
113 | this.prefix = prefix;
114 | } else if (StringUtils.isNotEmpty(prefix)){
115 | this.prefix = prefix + ' ';
116 | } else {
117 | this.prefix = prefix;
118 | }
119 | }
120 |
121 | public String getSpaceKey() {
122 | return spaceKey;
123 | }
124 |
125 | public void setSpaceKey(final String spaceKey) {
126 | this.spaceKey = spaceKey;
127 | }
128 |
129 | public String getSwaggerSchema() {
130 | return swaggerSchema;
131 | }
132 |
133 | public void setSwaggerSchema(final String swaggerSchema) {
134 | this.swaggerSchema = swaggerSchema;
135 | }
136 |
137 | public String getTitle() {
138 | return title;
139 | }
140 |
141 | public void setTitle(final String title) {
142 | this.title = title;
143 | }
144 |
145 | }
146 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Swagger Confluence
2 |
3 | [  ](https://cloud.slkdev.net/gitlab/starlightknight/swagger-confluence/builds)
4 | [ ](https://cloud.slkdev.net/sonar/overview?id=30)
5 | [  ](https://bintray.com/starlightknight/maven/swagger-confluence-cli-all/_latestVersion)
6 |
7 | ## Overview
8 |
9 | The primary goal of this project is to simplify publishing Swagger API documentation to an Atlassian Confluence server. Ideally, this plugin would be activated on the build of a schema jar, which would contain your contract-first Swagger JSON or YAML file
10 |
11 |
12 |
13 | While this was possible via stringing together other projects, it was not easy to drop in and use.
14 |
15 |
16 |
17 | This project uses the following flow to publish to Confluence:
18 |
19 |
20 |
21 | Your Swagger Schema -> Swagger2Markup -> AsciiDoctorJ -> XHTML -> Confluence REST API
22 |
23 |
24 |
25 | This project requires the use of Java 7 or later.
26 |
27 | ## Components
28 |
29 | The project is current broken into three components
30 |
31 | - **swagger-confluence-core:** a core shared library to handle converting and publishing the swagger schema to confluence. This shared library should be reusable by other projects
32 | - **swagger-confluence-gradle-plugin:** a gradle plugin to provide seamless conversion and publishing
33 | - **swagger-confluence-cli:** a command line executor for publishing to swagger docs to confluence
34 |
35 | ## Documentation & Usage Guide
36 |
37 | You can view the documentation and usage guide [here](https://cloud.slkdev.net/swagger-confluence)
38 |
39 | ## Live Demo
40 |
41 | You can view a live demo of Swagger Confluence [here on my Confluence Server](https://cloud.slkdev.net/confluence/display/DEMO/Swagger+Confluence+Demos)
42 |
43 | ## Contributing
44 |
45 | ### Community contributions
46 |
47 | Pull requests are welcome. The primary source repository for this project is hosted on my [GitLab CE Instance](https://cloud.slkdev.net/gitlab/starlightknight/swagger-confluence).
48 |
49 |
50 | It is preferred that if you wish to contribute, you submit there as this is where I have CI, SonarQube, etc set up. GitLab CE officially provides OmniAuth integration to make this easy, or you can of course sign up manually as well.
51 |
52 |
53 | GitLab CE is open source software. If you are unfamiliar with it, you can read more about it [here](https://about.gitlab.com/) on their official web site.
54 |
55 |
56 | If you are not comfortable with this, you may submit via the GitHub mirror, and I will merge it back manually.
57 |
58 | ### Questions, Bugs, or Enhacement Requests
59 |
60 |
61 |
62 | If you have any questions about the project, please feel free to open an [issue](https://cloud.slkdev.net/gitlab/starlightknight/swagger-confluence/issues)
63 |
64 |
65 |
66 | If you believe you have found a bug in the project, please take a moment to search the existing issues before posting a new one. If there is no existing issue regarding the problem, please open a new issue that describes the problem in detail. If possible, please also include a unit test that reproduces the problem.
67 |
68 |
69 |
70 | If you would like an enhancement to be made to the Swagger Confluence, pull requests are welcome. Before beginning work on an enhancement, you may want to search the existing issues and pull requests to see if a similar enhancement is already being worked on. You may also want to open a new issue to discuss the enhancement.
71 |
72 |
73 |
74 | ## Static Code Analysis + Coverage
75 |
76 | See [SonarQube](https://cloud.slkdev.net/sonar/overview?id=30) for this project
77 |
78 | ## Special Thanks
79 |
80 |
81 | A special thanks for the following projects, who make this project possible:
82 |
83 |
84 | * [Swagger2Markup](https://github.com/Swagger2Markup/swagger2markup)
85 | * [AsciiDoctorJ](https://github.com/asciidoctor/asciidoctorj)
86 | * [JSoup](http://jsoup.org/)
87 | * [Confluence REST API](https://developer.atlassian.com/confdev/confluence-rest-api)
88 |
89 |
90 |
91 |
92 | Additional shout-outs to the following two projects - whom I tried using manually in
93 | conjunction with the above projects and their respective gradle plugins before starting this project:
94 |
95 | * [asciidoctor-confluence](https://github.com/gscheibel/asciidoctor-confluence)
96 | * [asciidoc2confluence](https://github.com/rdmueller/asciidoc2confluence)
97 |
98 | The XHTML->Confluence REST API portion of this library was originally inspired by the
99 | asciidoc2confluence groovy script
100 |
101 | ## License
102 |
103 | Copyright 2016 Aaron Knight
104 |
105 |
106 |
107 | 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
108 |
109 |
110 |
111 | http://www.apache.org/licenses/LICENSE-2.0
112 |
113 |
114 |
115 | 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.
116 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/swagger-confluence-core/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/swagger-confluence-gradle-plugin/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
10 | DEFAULT_JVM_OPTS=""
11 |
12 | APP_NAME="Gradle"
13 | APP_BASE_NAME=`basename "$0"`
14 |
15 | # Use the maximum available, or set MAX_FD != -1 to use that value.
16 | MAX_FD="maximum"
17 |
18 | warn ( ) {
19 | echo "$*"
20 | }
21 |
22 | die ( ) {
23 | echo
24 | echo "$*"
25 | echo
26 | exit 1
27 | }
28 |
29 | # OS specific support (must be 'true' or 'false').
30 | cygwin=false
31 | msys=false
32 | darwin=false
33 | case "`uname`" in
34 | CYGWIN* )
35 | cygwin=true
36 | ;;
37 | Darwin* )
38 | darwin=true
39 | ;;
40 | MINGW* )
41 | msys=true
42 | ;;
43 | esac
44 |
45 | # Attempt to set APP_HOME
46 | # Resolve links: $0 may be a link
47 | PRG="$0"
48 | # Need this for relative symlinks.
49 | while [ -h "$PRG" ] ; do
50 | ls=`ls -ld "$PRG"`
51 | link=`expr "$ls" : '.*-> \(.*\)$'`
52 | if expr "$link" : '/.*' > /dev/null; then
53 | PRG="$link"
54 | else
55 | PRG=`dirname "$PRG"`"/$link"
56 | fi
57 | done
58 | SAVED="`pwd`"
59 | cd "`dirname \"$PRG\"`/" >/dev/null
60 | APP_HOME="`pwd -P`"
61 | cd "$SAVED" >/dev/null
62 |
63 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
64 |
65 | # Determine the Java command to use to start the JVM.
66 | if [ -n "$JAVA_HOME" ] ; then
67 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
68 | # IBM's JDK on AIX uses strange locations for the executables
69 | JAVACMD="$JAVA_HOME/jre/sh/java"
70 | else
71 | JAVACMD="$JAVA_HOME/bin/java"
72 | fi
73 | if [ ! -x "$JAVACMD" ] ; then
74 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
75 |
76 | Please set the JAVA_HOME variable in your environment to match the
77 | location of your Java installation."
78 | fi
79 | else
80 | JAVACMD="java"
81 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
82 |
83 | Please set the JAVA_HOME variable in your environment to match the
84 | location of your Java installation."
85 | fi
86 |
87 | # Increase the maximum file descriptors if we can.
88 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
89 | MAX_FD_LIMIT=`ulimit -H -n`
90 | if [ $? -eq 0 ] ; then
91 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
92 | MAX_FD="$MAX_FD_LIMIT"
93 | fi
94 | ulimit -n $MAX_FD
95 | if [ $? -ne 0 ] ; then
96 | warn "Could not set maximum file descriptor limit: $MAX_FD"
97 | fi
98 | else
99 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
100 | fi
101 | fi
102 |
103 | # For Darwin, add options to specify how the application appears in the dock
104 | if $darwin; then
105 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
106 | fi
107 |
108 | # For Cygwin, switch paths to Windows format before running java
109 | if $cygwin ; then
110 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
111 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
112 | JAVACMD=`cygpath --unix "$JAVACMD"`
113 |
114 | # We build the pattern for arguments to be converted via cygpath
115 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
116 | SEP=""
117 | for dir in $ROOTDIRSRAW ; do
118 | ROOTDIRS="$ROOTDIRS$SEP$dir"
119 | SEP="|"
120 | done
121 | OURCYGPATTERN="(^($ROOTDIRS))"
122 | # Add a user-defined pattern to the cygpath arguments
123 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
124 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
125 | fi
126 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
127 | i=0
128 | for arg in "$@" ; do
129 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
130 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
131 |
132 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
133 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
134 | else
135 | eval `echo args$i`="\"$arg\""
136 | fi
137 | i=$((i+1))
138 | done
139 | case $i in
140 | (0) set -- ;;
141 | (1) set -- "$args0" ;;
142 | (2) set -- "$args0" "$args1" ;;
143 | (3) set -- "$args0" "$args1" "$args2" ;;
144 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
145 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
146 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
147 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
148 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
149 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
150 | esac
151 | fi
152 |
153 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
154 | function splitJvmOpts() {
155 | JVM_OPTS=("$@")
156 | }
157 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
158 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
159 |
160 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
161 |
--------------------------------------------------------------------------------
/swagger-confluence-cli/src/main/java/net/slkdev/swagger/confluence/cli/SwaggerConfluence.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Aaron Knight
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.slkdev.swagger.confluence.cli;
17 |
18 | import net.slkdev.swagger.confluence.config.SwaggerConfluenceConfig;
19 | import net.slkdev.swagger.confluence.context.SwaggerConfluenceContextConfig;
20 | import net.slkdev.swagger.confluence.exception.SwaggerConfluenceConfigurationException;
21 | import net.slkdev.swagger.confluence.service.SwaggerToConfluenceService;
22 | import org.apache.commons.cli.*;
23 | import org.springframework.context.annotation.AnnotationConfigApplicationContext;
24 |
25 | import static org.apache.commons.lang3.Validate.notNull;
26 |
27 | public class SwaggerConfluence {
28 |
29 | private SwaggerToConfluenceService swaggerToConfluenceService;
30 |
31 | public SwaggerConfluence(final SwaggerToConfluenceService swaggerToConfluenceService){
32 | notNull(swaggerToConfluenceService, "SwaggerToConfluenceService Cannot Be Null!");
33 | this.swaggerToConfluenceService = swaggerToConfluenceService;
34 | }
35 |
36 | public static void main(final String[] args){
37 | final SwaggerToConfluenceService swaggerToConfluenceService = bootSwaggerConfluence();
38 | final SwaggerConfluence swaggerConfluence = new SwaggerConfluence(swaggerToConfluenceService);
39 | swaggerConfluence.runCLI(args);
40 | }
41 |
42 | private static SwaggerToConfluenceService bootSwaggerConfluence(){
43 | final AnnotationConfigApplicationContext annotationConfigApplicationContext =
44 | new AnnotationConfigApplicationContext(SwaggerConfluenceContextConfig.class);
45 | final SwaggerToConfluenceService swaggerToConfluenceService =
46 | annotationConfigApplicationContext.getBean(SwaggerToConfluenceService.class);
47 | annotationConfigApplicationContext.close();
48 |
49 | return swaggerToConfluenceService;
50 | }
51 |
52 | public void runCLI(final String[] args){
53 | final Options options = buildOptions();
54 | final CommandLine commandLine = parseCommandLineOptions(options, args);
55 |
56 | if(commandLine.hasOption("h") || args.length == 0){
57 | final HelpFormatter formatter = new HelpFormatter();
58 | formatter.printHelp("swagger-confluence-cli", options);
59 | }
60 | else {
61 | final SwaggerConfluenceConfig swaggerConfluenceConfig =
62 | buildSwaggerConfluenceConfig(commandLine);
63 | swaggerToConfluenceService.convertSwaggerToConfluence(swaggerConfluenceConfig);
64 | }
65 | }
66 |
67 | private static Options buildOptions(){
68 | final Options options = new Options();
69 |
70 | options.addOption("a", "ancestor-id", true, "ancestor id to use for the published api doc");
71 | options.addOption("b", "authentication", true, "base64 encoded user:pass pair for authentication");
72 | options.addOption("g", "generate-numeric-prefixes", true, "boolean flag to indicate whether to " +
73 | "generate numeric prefixes for titles");
74 | options.addOption("h", "help", false, "Print help message with usage information");
75 | options.addOption("i", "include-toc-on-single", true, "Include table of contents on single page mode");
76 | options.addOption("k", "space-key", true, "Space Key to publish api doc to");
77 | options.addOption("m", "pagination-mode", true, "Pagination mode to use: [single, category, individual]");
78 | options.addOption("s", "swagger-schema", true, "Swagger Schema name. Absolute, relative, or classpath location");
79 | options.addOption("p", "prefix", true, "Prefix to use for article titles to ensure uniqueness");
80 | options.addOption("t", "title", true, "Base title to use for the root article of the API doc");
81 | options.addOption("u", "confluence-rest-api-url", true, "URL to the confluence REST API");
82 |
83 | return options;
84 | }
85 |
86 | private static CommandLine parseCommandLineOptions(final Options options, final String[] args){
87 | final CommandLineParser commandLineParser = new DefaultParser();
88 |
89 | try {
90 | return commandLineParser.parse(options, args);
91 |
92 | } catch (ParseException e) {
93 | throw new SwaggerConfluenceConfigurationException(
94 | "Error Parsing Command Line Arguments!", e);
95 | }
96 | }
97 |
98 | private static SwaggerConfluenceConfig buildSwaggerConfluenceConfig(final CommandLine commandLine){
99 | final SwaggerConfluenceConfig swaggerConfluenceConfig = new SwaggerConfluenceConfig();
100 | final String ancestorIdString = commandLine.getOptionValue("a");
101 | final Integer ancestorId;
102 |
103 | if(ancestorIdString == null){
104 | ancestorId = null;
105 | }
106 | else {
107 | ancestorId = Integer.valueOf(ancestorIdString);
108 | }
109 |
110 | swaggerConfluenceConfig.setAncestorId(ancestorId);
111 | swaggerConfluenceConfig.setAuthentication(commandLine.getOptionValue("b"));
112 | swaggerConfluenceConfig.setConfluenceRestApiUrl(commandLine.getOptionValue("u"));
113 | swaggerConfluenceConfig.setGenerateNumericPrefixes(
114 | Boolean.valueOf(commandLine.getOptionValue("g", "true"))
115 | );
116 | swaggerConfluenceConfig.setIncludeTableOfContentsOnSinglePage(
117 | Boolean.valueOf(commandLine.getOptionValue("i", "true"))
118 | );
119 | swaggerConfluenceConfig.setPaginationMode(commandLine.getOptionValue("m","single"));
120 |
121 | final String prefix = commandLine.getOptionValue("p");
122 |
123 | if(prefix != null){
124 | swaggerConfluenceConfig.setPrefix(prefix);
125 | }
126 |
127 | swaggerConfluenceConfig.setSpaceKey(commandLine.getOptionValue("k"));
128 | swaggerConfluenceConfig.setSwaggerSchema(commandLine.getOptionValue("s"));
129 | swaggerConfluenceConfig.setTitle(commandLine.getOptionValue("t"));
130 |
131 | return swaggerConfluenceConfig;
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/swagger-confluence-core/src/test/java/net/slkdev/swagger/confluence/config/SwaggerConfluenceConfigTest.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2016 Aaron Knight
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package net.slkdev.swagger.confluence.config;
17 |
18 | import net.slkdev.swagger.confluence.constants.PaginationMode;
19 | import net.slkdev.swagger.confluence.exception.SwaggerConfluenceConfigurationException;
20 | import org.junit.Before;
21 | import org.junit.Test;
22 |
23 | import static org.junit.Assert.*;
24 |
25 | public class SwaggerConfluenceConfigTest {
26 |
27 | private SwaggerConfluenceConfig swaggerConfluenceConfig;
28 |
29 | @Before
30 | public void setUp(){
31 | swaggerConfluenceConfig = new SwaggerConfluenceConfig();
32 | }
33 |
34 | @Test
35 | public void testNoDefaultAncestorIdExists(){
36 | assertNull("No Default Should Be Set", swaggerConfluenceConfig.getAncestorId());
37 | }
38 |
39 | @Test
40 | public void testGetAndSetAncestorId(){
41 | swaggerConfluenceConfig.setAncestorId(1);;
42 | assertEquals("Expected AncestorId 1", Integer.valueOf(1),
43 | swaggerConfluenceConfig.getAncestorId());
44 | }
45 |
46 | @Test
47 | public void testNoDefaultAuthenticationExists(){
48 | assertNull("No Default Should Be Set", swaggerConfluenceConfig.getAuthentication());
49 | }
50 |
51 | @Test
52 | public void testGetAndSetAuthentication(){
53 | swaggerConfluenceConfig.setAuthentication("abc");
54 | assertEquals("Expected Authentication \"abc\"", "abc",
55 | swaggerConfluenceConfig.getAuthentication());
56 | }
57 |
58 | @Test
59 | public void testNoDefaultConfluenceRestApiUrlExists(){
60 | assertNull("No Default Should Be Set", swaggerConfluenceConfig.getConfluenceRestApiUrl());
61 | }
62 |
63 | @Test
64 | public void testGetAndSetConfluenceRestApiUrl(){
65 | swaggerConfluenceConfig.setConfluenceRestApiUrl("http://localhost");
66 | assertEquals("Expected Confluence Rest Api \"http://localhost\"", "http://localhost",
67 | swaggerConfluenceConfig.getConfluenceRestApiUrl());
68 | }
69 |
70 | @Test
71 | public void testDefaultGenerateNumericPrefixes(){
72 | assertTrue("Default Should \"true\"", swaggerConfluenceConfig.isGenerateNumericPrefixes());
73 | }
74 |
75 | @Test
76 | public void testGetAndSetGenerateNumericPrefixes(){
77 | swaggerConfluenceConfig.setGenerateNumericPrefixes(false);
78 | assertFalse("Expected Generate Numeric Prefixes -> False",
79 | swaggerConfluenceConfig.isGenerateNumericPrefixes());
80 | }
81 |
82 | @Test
83 | public void testDefaultIncludeTableOfContentsOnSinglePage(){
84 | assertTrue("Default Should \"true\"", swaggerConfluenceConfig.isIncludeTableOfContentsOnSinglePage());
85 | }
86 |
87 | @Test
88 | public void testGetAndSetIncludeTableOfContentsOnSinglePage(){
89 | swaggerConfluenceConfig.setIncludeTableOfContentsOnSinglePage(false);
90 | assertFalse("Expected Include Table Of Contents On Single Page -> False",
91 | swaggerConfluenceConfig.isIncludeTableOfContentsOnSinglePage());
92 | }
93 |
94 | @Test
95 | public void testDefaultPaginationModeIsSingle(){
96 | assertEquals("Default Should \"SINGLE_PAGE\"", PaginationMode.SINGLE_PAGE,
97 | swaggerConfluenceConfig.getPaginationMode());
98 | }
99 |
100 | @Test
101 | public void testEnumPaginationModeWithSingle(){
102 | swaggerConfluenceConfig.setPaginationMode(PaginationMode.SINGLE_PAGE);
103 | assertEquals("Expected Pagination Mode \"SINGLE_PAGE\"", PaginationMode.SINGLE_PAGE,
104 | swaggerConfluenceConfig.getPaginationMode());
105 | }
106 |
107 | @Test
108 | public void testEnumPaginationModeWithCategory(){
109 | swaggerConfluenceConfig.setPaginationMode(PaginationMode.CATEGORY_PAGES);
110 | assertEquals("Expected Pagination Mode \"CATEGORY_PAGES\"",
111 | PaginationMode.CATEGORY_PAGES, swaggerConfluenceConfig.getPaginationMode());
112 | }
113 |
114 | @Test
115 | public void testEnumPaginationModeWithIndividual(){
116 | swaggerConfluenceConfig.setPaginationMode(PaginationMode.INDIVIDUAL_PAGES);
117 | assertEquals("Expected Pagination Mode \"INDIVIDUAL_PAGES\"",
118 | PaginationMode.INDIVIDUAL_PAGES, swaggerConfluenceConfig.getPaginationMode());
119 | }
120 |
121 | @Test
122 | public void testStringPaginationModeWithSingle(){
123 | swaggerConfluenceConfig.setPaginationMode("single");
124 | assertEquals("Expected Pagination Mode \"SINGLE_PAGE\"", PaginationMode.SINGLE_PAGE,
125 | swaggerConfluenceConfig.getPaginationMode());
126 | }
127 |
128 | @Test
129 | public void testStringPaginationModeWithCategory(){
130 | swaggerConfluenceConfig.setPaginationMode("category");
131 | assertEquals("Expected Pagination Mode \"CATEGORY_PAGES\"",
132 | PaginationMode.CATEGORY_PAGES, swaggerConfluenceConfig.getPaginationMode());
133 | }
134 |
135 | @Test
136 | public void testStringPaginationModeWithIndividual(){
137 | swaggerConfluenceConfig.setPaginationMode("individual");
138 | assertEquals("Expected Pagination Mode \"INDIVIDUAL_PAGES\"",
139 | PaginationMode.INDIVIDUAL_PAGES, swaggerConfluenceConfig.getPaginationMode());
140 | }
141 |
142 | @Test(expected = SwaggerConfluenceConfigurationException.class)
143 | public void testStringPaginationWithInvalidValueThrowsException(){
144 | swaggerConfluenceConfig.setPaginationMode("invalid");
145 | }
146 |
147 | @Test
148 | public void testNoDefaultPrefixExists(){
149 | assertNull("No Default Should Be Set", swaggerConfluenceConfig.getPrefix());
150 | }
151 |
152 | @Test
153 | public void testPrefixWithNoTrailingSpaceAutomaticallyAddsOne(){
154 | swaggerConfluenceConfig.setPrefix("[P]");
155 | assertEquals("Expected Prefix \"[P] \"",
156 | "[P] ", swaggerConfluenceConfig.getPrefix());
157 | }
158 |
159 | @Test
160 | public void testPrefixWithTrailingSpaceDoesntAddAnotherOne(){
161 | swaggerConfluenceConfig.setPrefix("[P] ");
162 | assertEquals("Expected Prefix \"[P] \"",
163 | "[P] ", swaggerConfluenceConfig.getPrefix());
164 | }
165 |
166 | @Test
167 | public void testNoDefaultSpaceKeyExists(){
168 | assertNull("No Default Should Be Set", swaggerConfluenceConfig.getSpaceKey());
169 | }
170 |
171 | @Test
172 | public void testGetSetSpaceKey(){
173 | swaggerConfluenceConfig.setSpaceKey("DOC");
174 | assertEquals("Expected Space Key \"DOC\"",
175 | "DOC", swaggerConfluenceConfig.getSpaceKey());
176 | }
177 |
178 | @Test
179 | public void testNoDefaultSwaggerSchemaExists(){
180 | assertNull("No Default Should Be Set", swaggerConfluenceConfig.getSwaggerSchema());
181 | }
182 |
183 | @Test
184 | public void testGetSetSwaggerSchema(){
185 | swaggerConfluenceConfig.setSwaggerSchema("schema.yaml");
186 | assertEquals("Expected Swagger Schema \"schema.yaml\"",
187 | "schema.yaml", swaggerConfluenceConfig.getSwaggerSchema());
188 | }
189 |
190 | @Test
191 | public void testNoDefaultTitleExists(){
192 | assertNull("No Default Should Be Set", swaggerConfluenceConfig.getSwaggerSchema());
193 | }
194 |
195 | @Test
196 | public void testGetSetTitle(){
197 | swaggerConfluenceConfig.setTitle("Test Schema");
198 | assertEquals("Expected Title \"Test Schema\"",
199 | "Test Schema", swaggerConfluenceConfig.getTitle());
200 | }
201 |
202 | }
203 |
--------------------------------------------------------------------------------
/swagger-confluence-core/src/test/resources/swagger-confluence-create-json-body-definitions-example.json:
--------------------------------------------------------------------------------
1 | {"type":"page","title":"3. Definitions","body":{"storage":{"value":"\nDefinitions<\/strong><\/h2>\n\n \n Category<\/strong><\/h3>\n\n\n\n\n\n<\/colgroup>\n\n\n| Name<\/th>\n | Description<\/th>\n | Schema<\/th>\n<\/tr>\n<\/thead>\n | \n\nid<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \nname<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n
\n Order<\/strong><\/h3>\n\n\n\n\n\n<\/colgroup>\n\n\n| Name<\/th>\n | Description<\/th>\n | Schema<\/th>\n<\/tr>\n<\/thead>\n | \n\ncomplete<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | boolean<\/p><\/td>\n<\/tr>\n | \nid<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \npetId<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \nquantity<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int32)<\/p><\/td>\n<\/tr>\n | \nshipDate<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string(date-time)<\/p><\/td>\n<\/tr>\n | \nstatus<\/strong> \noptional<\/em><\/p><\/td>\nOrder Status<\/p><\/td>\n | string<\/p><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n
\n Pet<\/strong><\/h3>\n\n\n\n\n\n<\/colgroup>\n\n\n| Name<\/th>\n | Description<\/th>\n | Schema<\/th>\n<\/tr>\n<\/thead>\n | \n\ncategory<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | \n\nCategory\n<\/ac:link-body>\n<\/ac:link><\/p><\/td>\n<\/tr>\n\nid<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \nname<\/strong> \nrequired<\/em><\/p><\/td>\nExample<\/strong> : \"doggie\"<\/code><\/p><\/td>\nstring<\/p><\/td>\n<\/tr>\n | \nphotoUrls<\/strong> \nrequired<\/em><\/p><\/td>\n<\/td>\n | < string > array<\/p><\/td>\n<\/tr>\n | \nstatus<\/strong> \noptional<\/em><\/p><\/td>\npet status in the store<\/p><\/td>\n | string<\/p><\/td>\n<\/tr>\n | \ntags<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | < \n\nTag\n<\/ac:link-body>\n<\/ac:link> > array<\/p><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n
\n Tag<\/strong><\/h3>\n\n\n\n\n\n<\/colgroup>\n\n\n| Name<\/th>\n | Description<\/th>\n | Schema<\/th>\n<\/tr>\n<\/thead>\n | \n\nid<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \nname<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n
\n User<\/strong><\/h3>\n\n\n\n\n\n<\/colgroup>\n\n\n| Name<\/th>\n | Description<\/th>\n | Schema<\/th>\n<\/tr>\n<\/thead>\n | \n\nemail<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nfirstName<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nid<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | integer(int64)<\/p><\/td>\n<\/tr>\n | \nlastName<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \npassword<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nphone<\/strong> \noptional<\/em><\/p><\/td>\n<\/td>\n | string<\/p><\/td>\n<\/tr>\n | \nuserStatus<\/strong> \noptional<\/em><\/p><\/td>\n | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |