mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 20:50:55 +00:00
Minor improvements to OpenAPI Generator Online (#54)
* add copyright note, dockerfile * update online generator doc
This commit is contained in:
parent
8dd46a3fb9
commit
7c5dfbfa01
@ -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:
|
Here are the steps to run it locally:
|
||||||
```
|
```
|
||||||
mvn clean install
|
mvn clean install
|
||||||
cd openapi-generator-online
|
cd modules/openapi-generator-online
|
||||||
mvn jetty:run
|
mvn spring-boot:run
|
||||||
```
|
```
|
||||||
|
|
||||||
For example, to generate Ruby API client, simply send the following HTTP request using curl:
|
For example, to generate Ruby API client, simply send the following HTTP request using curl:
|
||||||
```sh
|
```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.
|
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
|
```json
|
||||||
{
|
{
|
||||||
"options": {},
|
"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
|
```json
|
||||||
"packageName":{
|
"packageName":{
|
||||||
"opt":"packageName",
|
"opt":"packageName",
|
||||||
@ -53,15 +53,15 @@ To set package name to `pet_store`, the HTTP body of the request is as follows:
|
|||||||
"options": {
|
"options": {
|
||||||
"packageName": "pet_store"
|
"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:
|
and here is the curl command:
|
||||||
```sh
|
```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
|
```json
|
||||||
{
|
{
|
||||||
"options": {},
|
"options": {},
|
||||||
|
12
modules/openapi-generator-online/Dockerfile
Normal file
12
modules/openapi-generator-online/Dockerfile
Normal file
@ -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"]
|
||||||
|
|
@ -4,7 +4,7 @@
|
|||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"title": "Petstore Sample API",
|
"title": "Petstore Sample API",
|
||||||
"info": {
|
"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",
|
"title": "Petstore Sample API",
|
||||||
"contact": {
|
"contact": {
|
||||||
"name": "Wordnik API Team"
|
"name": "Wordnik API Team"
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online;
|
||||||
|
|
||||||
import org.springframework.boot.CommandLineRunner;
|
import org.springframework.boot.CommandLineRunner;
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
|
import com.fasterxml.jackson.databind.util.ISO8601DateFormat;
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.api;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.api;
|
||||||
|
|
||||||
import org.springframework.web.context.request.NativeWebRequest;
|
import org.springframework.web.context.request.NativeWebRequest;
|
||||||
|
@ -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).
|
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech) (3.0.0-SNAPSHOT).
|
||||||
* https://openapi-generator.tech
|
* https://openapi-generator.tech
|
||||||
@ -50,7 +67,7 @@ public interface GenApi {
|
|||||||
@ApiResponse(code = 200, message = "successful operation", response = ResponseCode.class) })
|
@ApiResponse(code = 200, message = "successful operation", response = ResponseCode.class) })
|
||||||
@RequestMapping(value = "/gen/clients/{language}",
|
@RequestMapping(value = "/gen/clients/{language}",
|
||||||
method = RequestMethod.POST)
|
method = RequestMethod.POST)
|
||||||
default ResponseEntity<ResponseCode> 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<ResponseCode> 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);
|
return getDelegate().generateClient(language, generatorInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,7 +88,7 @@ public interface GenApi {
|
|||||||
@RequestMapping(value = "/gen/clients/{language}",
|
@RequestMapping(value = "/gen/clients/{language}",
|
||||||
produces = { "application/json" },
|
produces = { "application/json" },
|
||||||
method = RequestMethod.GET)
|
method = RequestMethod.GET)
|
||||||
default ResponseEntity<Map<String, CliOption>> 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<Map<String, CliOption>> 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);
|
return getDelegate().getClientOptions(language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.api;
|
||||||
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.api;
|
||||||
|
|
||||||
import org.openapitools.codegen.CliOption;
|
import org.openapitools.codegen.CliOption;
|
||||||
@ -56,7 +73,7 @@ public interface GenApiDelegate {
|
|||||||
getRequest().ifPresent(request -> {
|
getRequest().ifPresent(request -> {
|
||||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -73,7 +90,7 @@ public interface GenApiDelegate {
|
|||||||
getRequest().ifPresent(request -> {
|
getRequest().ifPresent(request -> {
|
||||||
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
for (MediaType mediaType: MediaType.parseMediaTypes(request.getHeader("Accept"))) {
|
||||||
if (mediaType.isCompatibleWith(MediaType.valueOf("*/*"))) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.configuration;
|
||||||
|
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Home redirection to swagger api documentation
|
* Home redirection to api documentation
|
||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class HomeController {
|
public class HomeController {
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.configuration;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
@ -18,12 +35,12 @@ public class OpenAPIDocumentationConfig {
|
|||||||
|
|
||||||
ApiInfo apiInfo() {
|
ApiInfo apiInfo() {
|
||||||
return new ApiInfoBuilder()
|
return new ApiInfoBuilder()
|
||||||
.title("Swagger Generator")
|
.title("OpenAPI Generator Online")
|
||||||
.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/).")
|
.description("This is an online openapi generator server. You can find out more at https://github.com/OpenAPITools/openapi-generator.")
|
||||||
.license("Apache 2.0")
|
.license("Apache 2.0")
|
||||||
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
.licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html")
|
||||||
.termsOfServiceUrl("")
|
.termsOfServiceUrl("")
|
||||||
.version("2.3.1")
|
.version("3.0.0")
|
||||||
.contact(new Contact("","", ""))
|
.contact(new Contact("","", ""))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
/**
|
/*
|
||||||
* Copyright 2016 SmartBear Software
|
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||||
* <p>
|
* 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
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* <p>
|
* you may not use this file except in compliance with the License.
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* You may obtain a copy of the License at
|
||||||
* <p>
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* the License.
|
* 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;
|
package org.openapitools.codegen.online.model;
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
/**
|
/*
|
||||||
* Copyright 2016 SmartBear Software
|
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||||
* <p>
|
* 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
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* <p>
|
* you may not use this file except in compliance with the License.
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* You may obtain a copy of the License at
|
||||||
* <p>
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* the License.
|
* 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;
|
package org.openapitools.codegen.online.model;
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@ -39,7 +56,7 @@ public class GeneratorInput {
|
|||||||
this.options = options;
|
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() {
|
public String getOpenAPIUrl() {
|
||||||
return openAPIUrl;
|
return openAPIUrl;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
@ -25,7 +42,7 @@ public class ResponseCode {
|
|||||||
|
|
||||||
@ApiModelProperty(
|
@ApiModelProperty(
|
||||||
value = "URL for fetching the generated client",
|
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() {
|
public String getLink() {
|
||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.service;
|
||||||
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -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;
|
package org.openapitools.codegen.online.service;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
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 io.swagger.v3.parser.core.models.ParseOptions;
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
import io.swagger.v3.parser.core.models.AuthorizationValue;
|
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.openapitools.codegen.online.model.GeneratorInput;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
@ -1,15 +1,18 @@
|
|||||||
/**
|
/*
|
||||||
* Copyright 2016 SmartBear Software
|
* Copyright 2018 OpenAPI-Generator Contributors (https://openapi-generator.tech)
|
||||||
* <p>
|
* 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
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* <p>
|
* you may not use this file except in compliance with the License.
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* You may obtain a copy of the License at
|
||||||
* <p>
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software distributed under the License
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* 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
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* the License.
|
* 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;
|
package org.openapitools.codegen.online.service;
|
||||||
|
@ -2,4 +2,4 @@ springfox.documentation.swagger.v2.path=/api-docs
|
|||||||
server.servlet.context-path=/api
|
server.servlet.context-path=/api
|
||||||
server.port=8080
|
server.port=8080
|
||||||
spring.jackson.date-format=org.openapitools.codegen.online.RFC3339DateFormat
|
spring.jackson.date-format=org.openapitools.codegen.online.RFC3339DateFormat
|
||||||
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
|
spring.jackson.serialization.WRITE_DATES_AS_TIMESTAMPS=false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user