From 7c5dfbfa017aea2903ac13cce144818cd5b97167 Mon Sep 17 00:00:00 2001 From: William Cheng Date: Wed, 16 May 2018 02:11:40 +0800 Subject: [PATCH] Minor improvements to OpenAPI Generator Online (#54) * add copyright note, dockerfile * update online generator doc --- docs/online-openapi-generator.md | 20 +++++++------- modules/openapi-generator-online/Dockerfile | 12 +++++++++ modules/openapi-generator-online/sample.json | 2 +- .../codegen/online/OpenAPI2SpringBoot.java | 17 ++++++++++++ .../codegen/online/RFC3339DateFormat.java | 17 ++++++++++++ .../codegen/online/api/ApiOriginFilter.java | 17 ++++++++++++ .../codegen/online/api/ApiUtil.java | 17 ++++++++++++ .../codegen/online/api/GenApi.java | 21 +++++++++++++-- .../codegen/online/api/GenApiController.java | 17 ++++++++++++ .../codegen/online/api/GenApiDelegate.java | 21 +++++++++++++-- .../online/configuration/HomeController.java | 19 ++++++++++++- .../OpenAPIDocumentationConfig.java | 23 +++++++++++++--- .../codegen/online/model/ApiResponse.java | 27 ++++++++++--------- .../codegen/online/model/Generated.java | 27 ++++++++++--------- .../codegen/online/model/GeneratorInput.java | 19 ++++++++++++- .../codegen/online/model/ResponseCode.java | 19 ++++++++++++- .../codegen/online/service/GenApiService.java | 17 ++++++++++++ .../codegen/online/service/Generator.java | 19 ++++++++++++- .../codegen/online/service/ZipUtil.java | 27 ++++++++++--------- .../src/main/resources/application.properties | 2 +- 20 files changed, 301 insertions(+), 59 deletions(-) create mode 100644 modules/openapi-generator-online/Dockerfile diff --git a/docs/online-openapi-generator.md b/docs/online-openapi-generator.md index b1ffc5c2607..ade1a025157 100644 --- a/docs/online-openapi-generator.md +++ b/docs/online-openapi-generator.md @@ -5,26 +5,26 @@ One can also generate API client or server using the online openapi-generator. Here are the steps to run it locally: ``` mvn clean install -cd openapi-generator-online -mvn jetty:run +cd modules/openapi-generator-online +mvn spring-boot:run ``` For example, to generate Ruby API client, simply send the following HTTP request using curl: ```sh -curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml"}' https://localhost:8080/api/gen/clients/ruby +curl -X POST -H "content-type:application/json" -d '{"openAPIUrl":"https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml"}' http://localhost:8080/api/gen/clients/ruby ``` Then you will receieve a JSON response with the URL to download the zipped code. -To customize the SDK, you can `POST` to `https://localhost:8080/gen/clients/{language}` with the following HTTP body: +To customize the SDK, you can `POST` to `http://localhost:8080/gen/clients/{language}` with the following HTTP body: ```json { "options": {}, - "swaggerUrl": "https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml" + "openAPIUrl": "https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml" } ``` -in which the `options` for a language can be obtained by submitting a `GET` request to `https://locahost:8080/api/gen/clients/{language}`: +in which the `options` for a language can be obtained by submitting a `GET` request to `http://locahost:8080/api/gen/clients/{language}`: -For example, `curl https://localhost:8080/api/gen/clients/python` returns +For example, `curl http://localhost:8080/api/gen/clients/python` returns ```json "packageName":{ "opt":"packageName", @@ -53,15 +53,15 @@ To set package name to `pet_store`, the HTTP body of the request is as follows: "options": { "packageName": "pet_store" }, - "swaggerUrl": "https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml" + "openAPIUrl": "https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml" } ``` and here is the curl command: ```sh -curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"swaggerUrl": "https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml"}' https://localhost:8080/api/gen/clients/python +curl -H "Content-type: application/json" -X POST -d '{"options": {"packageName": "pet_store"},"openAPIUrl": "https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml"}' http://localhost:8080/api/gen/clients/python ``` -Instead of using `swaggerUrl` with an URL to the OpenAPI spec, one can include the spec in the JSON payload with `spec`, e.g. +Instead of using `openAPIUrl` with an URL to the OpenAPI spec, one can include the spec in the JSON payload with `spec`, e.g. ```json { "options": {}, diff --git a/modules/openapi-generator-online/Dockerfile b/modules/openapi-generator-online/Dockerfile new file mode 100644 index 00000000000..6fdf26b0243 --- /dev/null +++ b/modules/openapi-generator-online/Dockerfile @@ -0,0 +1,12 @@ +FROM openjdk:8-jre-alpine + +WORKDIR /generator + +COPY target/openapi-generator-online-1.0.0.jar /generator/openapi-generator-online-1.0.0.jar + +ENV GENERATOR_HOST=http://localhost + +EXPOSE 8080 + +CMD ["java", "-jar", "/generator/openapi-generator-online-1.0.0.jar"] + diff --git a/modules/openapi-generator-online/sample.json b/modules/openapi-generator-online/sample.json index 463b7006ec2..22194e36a96 100644 --- a/modules/openapi-generator-online/sample.json +++ b/modules/openapi-generator-online/sample.json @@ -4,7 +4,7 @@ "swagger": "2.0", "title": "Petstore Sample API", "info": { - "description": "A sample API that uses a petstore as an example to demonstrate features in the swagger-2.0 specification", + "description": "A sample API that uses a petstore as an example to demonstrate features in the OpenAPI-2.0 specification", "title": "Petstore Sample API", "contact": { "name": "Wordnik API Team" diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/OpenAPI2SpringBoot.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/OpenAPI2SpringBoot.java index 09b7610877e..c23a56fa172 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/OpenAPI2SpringBoot.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/OpenAPI2SpringBoot.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online; import org.springframework.boot.CommandLineRunner; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/RFC3339DateFormat.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/RFC3339DateFormat.java index a29a8771fc5..68c3b0db38c 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/RFC3339DateFormat.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/RFC3339DateFormat.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online; import com.fasterxml.jackson.databind.util.ISO8601DateFormat; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiOriginFilter.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiOriginFilter.java index 7f81cf93278..dd6ff5dcfe5 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiOriginFilter.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiOriginFilter.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.api; import java.io.IOException; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiUtil.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiUtil.java index a75835ccd07..b58943652b7 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiUtil.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/ApiUtil.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.api; import org.springframework.web.context.request.NativeWebRequest; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApi.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApi.java index d6271c23c80..8e39e7a3e16 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApi.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApi.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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. + */ + /** * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.0.0-SNAPSHOT). * https://openapi-generator.tech @@ -50,7 +67,7 @@ public interface GenApi { @ApiResponse(code = 200, message = "successful operation", response = ResponseCode.class) }) @RequestMapping(value = "/gen/clients/{language}", method = RequestMethod.POST) - default ResponseEntity generateClient(@ApiParam(value = "The target language for the client library",required=true, allowableValues = "ada, akka-scala, android, apex, bash, clojure, cpprest, csharp, csharp-dotnet2, cwiki, dart, dynamic-html, eiffel, elixir, elm, erlang-client, flash, go, groovy, haskell-http-client, html, html2, java, javascript, javascript-closure-angular, jaxrs-cxf-client, jmeter, kotlin, lua, objc, perl, php, powershell, python, qt5cpp, r, ruby, rust, scala, scalaz, swagger, swagger-yaml, swift, swift3, swift4, tizen, typescript-angular, typescript-angularjs, typescript-aurelia, typescript-fetch, typescript-jquery, typescript-node") @PathVariable("language") String language,@ApiParam(value = "Configuration for building the client library" ,required=true ) @Valid @RequestBody GeneratorInput generatorInput) { + default ResponseEntity generateClient(@ApiParam(value = "The target language for the client library",required=true, allowableValues = "ada, akka-scala, android, apex, bash, clojure, cpprest, csharp, csharp-dotnet2, cwiki, dart, dynamic-html, eiffel, elixir, elm, erlang-client, flash, go, groovy, haskell-http-client, html, html2, java, javascript, javascript-closure-angular, jaxrs-cxf-client, jmeter, kotlin, lua, objc, perl, php, powershell, python, qt5cpp, r, ruby, rust, scala, scalaz, openapi, openapi-yaml, swift, swift3, swift4, tizen, typescript-angular, typescript-angularjs, typescript-aurelia, typescript-fetch, typescript-jquery, typescript-node") @PathVariable("language") String language,@ApiParam(value = "Configuration for building the client library" ,required=true ) @Valid @RequestBody GeneratorInput generatorInput) { return getDelegate().generateClient(language, generatorInput); } @@ -71,7 +88,7 @@ public interface GenApi { @RequestMapping(value = "/gen/clients/{language}", produces = { "application/json" }, method = RequestMethod.GET) - default ResponseEntity> getClientOptions(@ApiParam(value = "The target language for the client library",required=true, allowableValues = "ada, akka-scala, android, apex, bash, clojure, cpprest, csharp, csharp-dotnet2, cwiki, dart, dynamic-html, eiffel, elixir, elm, erlang-client, flash, go, groovy, haskell-http-client, html, html2, java, javascript, javascript-closure-angular, jaxrs-cxf-client, jmeter, kotlin, lua, objc, perl, php, powershell, python, qt5cpp, r, ruby, rust, scala, scalaz, swagger, swagger-yaml, swift, swift3, swift4, tizen, typescript-angular, typescript-angularjs, typescript-aurelia, typescript-fetch, typescript-jquery, typescript-node") @PathVariable("language") String language) { + default ResponseEntity> getClientOptions(@ApiParam(value = "The target language for the client library",required=true, allowableValues = "ada, akka-scala, android, apex, bash, clojure, cpprest, csharp, csharp-dotnet2, cwiki, dart, dynamic-html, eiffel, elixir, elm, erlang-client, flash, go, groovy, haskell-http-client, html, html2, java, javascript, javascript-closure-angular, jaxrs-cxf-client, jmeter, kotlin, lua, objc, perl, php, powershell, python, qt5cpp, r, ruby, rust, scala, scalaz, openapi, openapi-yaml, swift, swift3, swift4, tizen, typescript-angular, typescript-angularjs, typescript-aurelia, typescript-fetch, typescript-jquery, typescript-node") @PathVariable("language") String language) { return getDelegate().getClientOptions(language); } diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiController.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiController.java index 57fa927a6b2..601a23d3c1e 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiController.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiController.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.api; import org.springframework.beans.factory.annotation.Autowired; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiDelegate.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiDelegate.java index b64fbb0e078..0461eff1519 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiDelegate.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/api/GenApiDelegate.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.api; import org.openapitools.codegen.CliOption; @@ -56,7 +73,7 @@ public interface GenApiDelegate { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "{ \"code\" : \"d40029be-eda6-4d62-b1ef-d05e2e91a72a\", \"link\" : \"http://generator.swagger.io:80/api/gen/download/d40029be-eda6-4d62-b1ef-d05e2e91a72a\"}"); + ApiUtil.setExampleResponse(request, "*/*", "{ \"code\" : \"d40029be-eda6-4d62-b1ef-d05e2e91a72a\", \"link\" : \"http://localhost:80/api/gen/download/d40029be-eda6-4d62-b1ef-d05e2e91a72a\"}"); break; } } @@ -73,7 +90,7 @@ public interface GenApiDelegate { getRequest().ifPresent(request -> { for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) { if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) { - ApiUtil.setExampleResponse(request, "*/*", "{ \"code\" : \"d40029be-eda6-4d62-b1ef-d05e2e91a72a\", \"link\" : \"http://generator.swagger.io:80/api/gen/download/d40029be-eda6-4d62-b1ef-d05e2e91a72a\"}"); + ApiUtil.setExampleResponse(request, "*/*", "{ \"code\" : \"d40029be-eda6-4d62-b1ef-d05e2e91a72a\", \"link\" : \"http://localhost:80/api/gen/download/d40029be-eda6-4d62-b1ef-d05e2e91a72a\"}"); break; } } diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/HomeController.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/HomeController.java index e6474a7d720..5f7a6e2d430 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/HomeController.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/HomeController.java @@ -1,10 +1,27 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.configuration; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** - * Home redirection to swagger api documentation + * Home redirection to api documentation */ @Controller public class HomeController { diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/OpenAPIDocumentationConfig.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/OpenAPIDocumentationConfig.java index 5347dc257be..fd4226ae3b5 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/OpenAPIDocumentationConfig.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/configuration/OpenAPIDocumentationConfig.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.configuration; import org.springframework.context.annotation.Bean; @@ -18,12 +35,12 @@ public class OpenAPIDocumentationConfig { ApiInfo apiInfo() { return new ApiInfoBuilder() - .title("Swagger Generator") - .description("This is an online swagger codegen server. You can find out more at https://github.com/swagger-api/swagger-codegen or on [irc.freenode.net, #swagger](http://swagger.io/irc/).") + .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("2.3.1") + .version("3.0.0") .contact(new Contact("","", "")) .build(); } diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ApiResponse.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ApiResponse.java index b086eda99e7..1db77598bde 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ApiResponse.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ApiResponse.java @@ -1,15 +1,18 @@ -/** - * Copyright 2016 SmartBear Software - *

- * 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. +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.model; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/Generated.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/Generated.java index c806db5efcc..e78f201bb78 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/Generated.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/Generated.java @@ -1,15 +1,18 @@ -/** - * Copyright 2016 SmartBear Software - *

- * 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. +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.model; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/GeneratorInput.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/GeneratorInput.java index da24cf1cfb7..3e7d075b4d4 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/GeneratorInput.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/GeneratorInput.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.model; import com.fasterxml.jackson.databind.JsonNode; @@ -39,7 +56,7 @@ public class GeneratorInput { this.options = options; } - @ApiModelProperty(example = "http://petstore.swagger.io/v2/swagger.json") + @ApiModelProperty(example = "https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml") public String getOpenAPIUrl() { return openAPIUrl; } diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ResponseCode.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ResponseCode.java index f21d8623357..196569305d5 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ResponseCode.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/model/ResponseCode.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.model; import io.swagger.annotations.ApiModelProperty; @@ -25,7 +42,7 @@ public class ResponseCode { @ApiModelProperty( value = "URL for fetching the generated client", - example = "http://generator.swagger.io:80/api/gen/download/d40029be-eda6-4d62-b1ef-d05e2e91a72a") + example = "http://localhost:8080/api/gen/download/d40029be-eda6-4d62-b1ef-d05e2e91a72a") public String getLink() { return link; } diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/GenApiService.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/GenApiService.java index 926c3390cdb..63a3d729536 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/GenApiService.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/GenApiService.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.service; import org.apache.commons.io.FileUtils; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java index 471134fdfd9..69ea454525f 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/Generator.java @@ -1,3 +1,20 @@ +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.service; import com.fasterxml.jackson.databind.JsonNode; @@ -6,7 +23,7 @@ import io.swagger.v3.oas.models.OpenAPI; import io.swagger.v3.parser.core.models.ParseOptions; import org.openapitools.codegen.*; import io.swagger.v3.parser.core.models.AuthorizationValue; -import io.swagger.util.Json; +import io.swagger.v3.core.util.Json; import org.openapitools.codegen.online.model.GeneratorInput; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/ZipUtil.java b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/ZipUtil.java index 19da305148f..0fb9bc8504b 100644 --- a/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/ZipUtil.java +++ b/modules/openapi-generator-online/src/main/java/org/openapitools/codegen/online/service/ZipUtil.java @@ -1,15 +1,18 @@ -/** - * Copyright 2016 SmartBear Software - *

- * 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. +/* + * Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech) + * Copyright 2018 SmartBear Software + * + * 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 org.openapitools.codegen.online.service; diff --git a/modules/openapi-generator-online/src/main/resources/application.properties b/modules/openapi-generator-online/src/main/resources/application.properties index 7d8ff54d75d..1088b03c094 100644 --- a/modules/openapi-generator-online/src/main/resources/application.properties +++ b/modules/openapi-generator-online/src/main/resources/application.properties @@ -2,4 +2,4 @@ springfox.documentation.swagger.v2.path=/api-docs server.servlet.context-path=/api server.port=8080 spring.jackson.date-format=org.openapitools.codegen.online.RFC3339DateFormat -spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false \ No newline at end of file +spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false