Skip to content

Commit

Permalink
Fix openAPI generated spec of openapi-online
Browse files Browse the repository at this point in the history
  • Loading branch information
cbornet committed May 16, 2018
1 parent 1a389df commit 54394fc
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
4 changes: 2 additions & 2 deletions modules/openapi-generator-online/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
FROM openjdk:8-jre-alpine

WORKDIR /generator

COPY target/openapi-generator-online-3.0.0-SNAPSHOT.jar /generator/openapi-generator-online.jar
COPY target/*.jar /generator/openapi-generator-online.jar

ENV GENERATOR_HOST=http://localhost

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.util.List;
Expand All @@ -51,9 +52,9 @@ default ResponseEntity<List<String>> clientOptions() {
}


@ApiOperation(value = "Downloads a pre-generated file", nickname = "downloadFile", notes = "A valid `fileId` is generated by the `/clients/{language}` or `/servers/{language}` POST operations. The fileId code can be used just once, after which a new `fileId` will need to be requested.", response = String.class, tags={ "clients","servers", })
@ApiOperation(value = "Downloads a pre-generated file", nickname = "downloadFile", notes = "A valid `fileId` is generated by the `/clients/{language}` or `/servers/{language}` POST operations. The fileId code can be used just once, after which a new `fileId` will need to be requested.", response = MultipartFile.class, tags={ "clients","servers", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = String.class) })
@ApiResponse(code = 200, message = "successful operation", response = MultipartFile.class) })
@RequestMapping(value = "/gen/download/{fileId}",
produces = { "application/octet-stream" },
method = RequestMethod.GET)
Expand Down Expand Up @@ -82,9 +83,9 @@ default ResponseEntity<ResponseCode> generateServerForLanguage(@ApiParam(value =
}


@ApiOperation(value = "Returns options for a client library", nickname = "getClientOptions", notes = "", response = CliOption.class, responseContainer = "Map", tags={ "clients", })
@ApiOperation(value = "Returns options for a client library", nickname = "getClientOptions", notes = "", tags={ "clients", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = CliOption.class, responseContainer = "Map") })
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/gen/clients/{language}",
produces = { "application/json" },
method = RequestMethod.GET)
Expand All @@ -93,9 +94,9 @@ default ResponseEntity<Map<String, CliOption>> getClientOptions(@ApiParam(value
}


@ApiOperation(value = "Returns options for a server framework", nickname = "getServerOptions", notes = "", response = CliOption.class, responseContainer = "Map", tags={ "servers", })
@ApiOperation(value = "Returns options for a server framework", nickname = "getServerOptions", notes = "", tags={ "servers", })
@ApiResponses(value = {
@ApiResponse(code = 200, message = "successful operation", response = CliOption.class, responseContainer = "Map") })
@ApiResponse(code = 200, message = "successful operation") })
@RequestMapping(value = "/gen/servers/{framework}",
produces = { "application/json" },
method = RequestMethod.GET)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@

package org.openapitools.codegen.online.configuration;

import com.fasterxml.jackson.databind.JsonNode;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import org.springframework.core.io.Resource;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
Expand All @@ -28,6 +29,8 @@
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import java.io.InputStream;


@Configuration
@EnableSwagger2
Expand All @@ -51,8 +54,12 @@ public Docket customImplementation(){
.select()
.apis(RequestHandlerSelectors.basePackage("org.openapitools.codegen.online.api"))
.build()
.forCodeGeneration(true)
.directModelSubstitute(java.time.LocalDate.class, java.sql.Date.class)
.directModelSubstitute(java.time.OffsetDateTime.class, java.util.Date.class)
.directModelSubstitute(JsonNode.class, java.lang.Object.class)
.ignoredParameterTypes(Resource.class)
.ignoredParameterTypes(InputStream.class)
.apiInfo(apiInfo());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public void setAuthorizationValue(AuthorizationValue authorizationValue) {
this.authorizationValue = authorizationValue;
}

@ApiModelProperty(dataType = "Object")
public JsonNode getSpec() {
return spec;
}
Expand Down

0 comments on commit 54394fc

Please sign in to comment.