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

Spring doc #244

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 33 additions & 21 deletions model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,28 +55,28 @@
<build>
<plugins>
<plugin>
<groupId>io.swagger.codegen.v3</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>3.0.20</version>

<groupId>org.openapitools</groupId>
<artifactId>openapi-generator-maven-plugin</artifactId>
<!-- RELEASE_VERSION -->
<version>6.3.0</version>
<executions>
<execution>
<id>generate-swagger-javacode</id>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/swagger.yml</inputSpec>
<language>spring</language>
<generatorName>spring</generatorName>
<withXml>true</withXml>
<configOptions>
<sourceFolder>src/gen/java/main</sourceFolder>
<dateLibrary>joda</dateLibrary>
<modelPackage>gov.nasa.pds.model</modelPackage>
<apiPackage>gov.nasa.pds.api.base</apiPackage>
<generateSupportingFiles>false</generateSupportingFiles>
<interfaceOnly>false</interfaceOnly>
<sourceFolder>src/main/java</sourceFolder>
<dateLibrary>joda</dateLibrary>
<documentationProvider>springdoc</documentationProvider>
<licenseName>apache-2</licenseName>
<modelPackage>gov.nasa.pds.model</modelPackage>
<apiPackage>gov.nasa.pds.api.base</apiPackage>
<generateSupportingFiles>false</generateSupportingFiles>
<interfaceOnly>false</interfaceOnly>
</configOptions>

</configuration>
Expand All @@ -103,14 +103,7 @@
</plugins>
</build>

<dependencies>
<!-- dependencies are needed for the client being generated -->
<!--SpringFox dependencies -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>${springfox-version}</version>
</dependency>
<dependencies>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
Expand Down Expand Up @@ -206,6 +199,12 @@
<version>2.12.5</version>
</dependency>

<dependency>
<groupId>org.openapitools</groupId>
<artifactId>jackson-databind-nullable</artifactId>
<version>0.2.4</version>
</dependency>

<!-- https://mvnrepository.com/artifact/joda-time/joda-time -->
<dependency>
<groupId>joda-time</groupId>
Expand All @@ -222,6 +221,19 @@
<version>1.4.4</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-annotations -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-annotations</artifactId>
<version>2.2.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-models -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-models</artifactId>
<version>2.2.8</version>
</dependency>

</dependencies>

Expand Down
3 changes: 3 additions & 0 deletions model/swagger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1457,6 +1457,7 @@ components:
key_value_pairs:
type: array
items:
title: wyriwyg_product_key_value_pair
type: object
properties:
key:
Expand All @@ -1475,6 +1476,7 @@ components:
items:
$ref: '#/components/schemas/wyriwygProduct'
propertyArrayValues:
title: property_array_values
type: array
items:
type: string
Expand Down Expand Up @@ -1623,6 +1625,7 @@ components:
ops:Data_Files:
type: array
items:
title: pds4_metadata_ops_data_file
type: object
properties:
ops:file_name:
Expand Down
41 changes: 28 additions & 13 deletions service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,34 @@

<dependencies>

<!--SpringFox dependencies -->
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons</artifactId>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-ui</artifactId>
<version>1.6.14</version>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/io.swagger.core.v3/swagger-core -->
<dependency>
<groupId>io.swagger.core.v3</groupId>
<artifactId>swagger-core</artifactId>
<version>2.2.8</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework/spring-web -->
<dependency>
Expand All @@ -129,16 +151,9 @@
<artifactId>spring-context</artifactId>
</dependency>

<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-web -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>


<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>


<dependency>
<groupId>org.springframework</groupId>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;

import springfox.documentation.swagger2.annotations.EnableSwagger2;

@SpringBootApplication
@EnableSwagger2
@ComponentScan(basePackages = { "gov.nasa.pds.api.registry.configuration ", "gov.nasa.pds.api.registry.controller", "gov.nasa.pds.api.registry.model", "gov.nasa.pds.api.registry.search"})
@ComponentScan(basePackages = {"gov.nasa.pds.api.registry.configuration ",
"gov.nasa.pds.api.registry.controller", "gov.nasa.pds.api.registry.model",
"gov.nasa.pds.api.registry.search"})
public class SpringBootMain implements CommandLineRunner {


@Override
public void run(String... arg0) throws Exception {
if (arg0.length > 0 && arg0[0].equals("exitcode")) {
throw new ExitException();
}
}

public static void main(String[] args) throws Exception {
new SpringApplication(SpringBootMain.class).run(args);
@Override
public void run(String... arg0) throws Exception {
if (arg0.length > 0 && arg0[0].equals("exitcode")) {
throw new ExitException();
}
}

class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L;
public static void main(String[] args) throws Exception {
new SpringApplication(SpringBootMain.class).run(args);
}

@Override
public int getExitCode() {
return 10;
}
class ExitException extends RuntimeException implements ExitCodeGenerator {
private static final long serialVersionUID = 1L;

@Override
public int getExitCode() {
return 10;
}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,24 @@
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import io.swagger.annotations.Api;
import io.swagger.v3.oas.annotations.tags.Tag;

/**
* Home redirection to swagger api documentation
* Home redirection to swagger api documentation
*/
@Api(hidden=true, tags = {"this page",}, value="API Documentation")
@Tag(name = "Registry Search API Documentation")
@Controller
public class ApiDocumentation {

@Value("${server.contextPath}")
private String contextPath;

@RequestMapping(method = RequestMethod.GET, produces = { "text/html" }, value = "/")
public String index() {

String contextPath = this.contextPath.endsWith("/")?this.contextPath:this.contextPath+"/";
@Value("${server.contextPath}")
private String contextPath;

@RequestMapping(method = RequestMethod.GET, produces = {"text/html"}, value = "/")
public String index() {

String contextPath = this.contextPath.endsWith("/") ? this.contextPath : this.contextPath + "/";

System.out.println(contextPath+"swagger-ui/index.html");
return "redirect:"+contextPath+"swagger-ui/index.html";
}
System.out.println(contextPath + "swagger-ui/index.html");
return "redirect:" + contextPath + "swagger-ui/index.html";
}
}

This file was deleted.

Loading