Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[online generator] integrate with rapidoc (interactive explorer) #3229

Merged
merged 3 commits into from Jun 30, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 8 additions & 5 deletions modules/openapi-generator-online/pom.xml
Expand Up @@ -33,6 +33,14 @@
<build>
<finalName>openapi-generator-online</finalName>
<sourceDirectory>src/main/java</sourceDirectory>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
<excludes>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -69,11 +77,6 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${springfox-version}</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
Expand Down
Expand Up @@ -27,6 +27,8 @@
public class HomeController {
@RequestMapping(value = "/")
public String index() {
return "redirect:swagger-ui.html";
return "redirect:index.html";
}


}
Expand Up @@ -29,21 +29,35 @@
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;


@Configuration
@EnableSwagger2
public class OpenAPIDocumentationConfig {

ApiInfo apiInfo() {
final Properties properties = new Properties();
try (InputStream stream = this.getClass().getResourceAsStream("/version.properties")) {
if (stream != null) {
properties.load(stream);
}
} catch (IOException ex) {
// ignore
}

String version = properties.getProperty("version", "unknown");


return new ApiInfoBuilder()
.title("OpenAPI Generator Online")
.description("This is an online openapi generator server. You can find out more at https://github.com/OpenAPITools/openapi-generator.")
.license("Apache 2.0")
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
.termsOfServiceUrl("")
.version("3.0.0")
.version(version)
.contact(new Contact("","", ""))
.build();
}
Expand Down
Expand Up @@ -2,3 +2,4 @@ springfox.documentation.swagger.v2.path=/api-docs
server.port=8080
spring.jackson.date-format=org.openapitools.codegen.online.RFC3339DateFormat
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
spring.resources.static-locations=classpath:/META-INF/resources/,classpath:/resources/,classpath:/static/,classpath:/public/
@@ -0,0 +1,17 @@
<!doctype html> <!-- Important: must specify -->
<html>
<head>
<meta charset="utf-8"> <!-- Important: rapi-doc uses utf8 charecters -->
<script src="rapidoc-min.js"></script>
</head>
<body>
<rapi-doc spec-url="api-docs"
theme="dark">
<img
slot="logo"
src="logo.png"
style="margin:0 -0.3em 0 0.8em;"
/>
</rapi-doc>
</body>
</html>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

Large diffs are not rendered by default.

@@ -0,0 +1 @@
version = ${project.version}