Skip to content

Commit ddedbf9

Browse files
committed
Merge branch '3.0.0' into kotlin
2 parents 5efe922 + a9bdfe3 commit ddedbf9

File tree

8 files changed

+1175
-16
lines changed

8 files changed

+1175
-16
lines changed

modules/swagger-codegen/pom.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -198,16 +198,6 @@
198198
<diffutils-version>1.3.0</diffutils-version>
199199
</properties>
200200
<dependencies>
201-
<dependency>
202-
<groupId>io.swagger</groupId>
203-
<artifactId>swagger-models</artifactId>
204-
<version>1.5.17</version>
205-
</dependency>
206-
<dependency>
207-
<groupId>io.swagger</groupId>
208-
<artifactId>swagger-core</artifactId>
209-
<version>1.5.17</version>
210-
</dependency>
211201
<dependency>
212202
<groupId>io.swagger.core.v3</groupId>
213203
<artifactId>swagger-models</artifactId>

modules/swagger-generator/openapi.yaml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
openapi: 3.0.0
22
servers:
3-
- url: /v2
3+
- url: /
44
info:
55
description: codegen generator server API
66
version: "1.0.0"
@@ -13,6 +13,8 @@ info:
1313
tags:
1414
- name: developers
1515
description: Operations available to regular developers
16+
- name: clients
17+
- name: servers
1618
paths:
1719
/generate:
1820
get:
@@ -82,8 +84,10 @@ paths:
8284

8385
/clients:
8486
get:
87+
tags:
88+
- "clients"
8589
x-swagger-router-controller: "io.swagger.generator.online.GeneratorController"
86-
operationId: getClients
90+
operationId: clientOptions
8791
responses:
8892
200:
8993
description: successful operation
@@ -95,8 +99,10 @@ paths:
9599
type: string
96100
/servers:
97101
get:
102+
tags:
103+
- "servers"
98104
x-swagger-router-controller: "io.swagger.generator.online.GeneratorController"
99-
operationId: getServers
105+
operationId: serverOptions
100106
responses:
101107
200:
102108
description: successful operation

modules/swagger-generator/pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,22 @@
3333
</archive>
3434
</configuration>
3535
</plugin>
36+
<plugin>
37+
<groupId>org.apache.maven.plugins</groupId>
38+
<artifactId>maven-war-plugin</artifactId>
39+
<version>3.1.0</version>
40+
<configuration>
41+
<webResources>
42+
<resource>
43+
<!-- this is relative to the pom.xml directory -->
44+
<directory>${project.build.directory}/swagger-ui-master/dist</directory>
45+
<excludes>
46+
<exclude>index.html</exclude>
47+
</excludes>
48+
</resource>
49+
</webResources>
50+
</configuration>
51+
</plugin>
3652
<plugin>
3753
<artifactId>maven-dependency-plugin</artifactId>
3854
<executions>
@@ -173,6 +189,11 @@
173189
<artifactId>swagger-inflector</artifactId>
174190
<version>${inflector-version}</version>
175191
</dependency>
192+
<dependency>
193+
<groupId>javax.servlet</groupId>
194+
<artifactId>servlet-api</artifactId>
195+
<version>${servlet-api.version}</version>
196+
</dependency>
176197
<dependency>
177198
<groupId>org.testng</groupId>
178199
<artifactId>testng</artifactId>
@@ -187,5 +208,6 @@
187208
<junit-version>4.8.2</junit-version>
188209
<slf4j-version>1.6.3</slf4j-version>
189210
<swagger-codegen-generators-version>1.0.0-SNAPSHOT</swagger-codegen-generators-version>
211+
<servlet-api.version>2.5</servlet-api.version>
190212
</properties>
191213
</project>

modules/swagger-generator/src/main/java/io/swagger/generator/online/GeneratorController.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ public class GeneratorController {
4949
Collections.sort(SERVERS, String.CASE_INSENSITIVE_ORDER);
5050
}
5151

52-
public ResponseContext getClients(RequestContext requestContext) {
52+
public ResponseContext clientOptions(RequestContext requestContext) {
5353
return new ResponseContext()
5454
.status(Response.Status.OK.getStatusCode())
5555
.entity(CLIENTS);
5656

5757
}
5858

59-
public ResponseContext getServers(RequestContext requestContext) {
59+
public ResponseContext serverOptions(RequestContext requestContext) {
6060
return new ResponseContext()
6161
.status(Response.Status.OK.getStatusCode())
6262
.entity(SERVERS);
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package io.swagger.generator.online;
2+
3+
import org.apache.commons.io.IOUtils;
4+
5+
import javax.servlet.http.HttpServlet;
6+
import javax.servlet.http.HttpServletRequest;
7+
import javax.servlet.http.HttpServletResponse;
8+
import javax.ws.rs.core.MediaType;
9+
import java.io.IOException;
10+
11+
public class PetstoreServlet extends HttpServlet {
12+
13+
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
14+
String json = IOUtils.toString(getClass().getResourceAsStream("/petstore.json"));
15+
response.setContentType(MediaType.APPLICATION_JSON);
16+
response.setStatus(HttpServletResponse.SC_OK);
17+
18+
response.getWriter().append(json);
19+
20+
}
21+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi":"3.0.0","servers":[{"url":"/v2"}],"info":{"description":"codegen generator server API","version":"1.0.0","title":"Generator API","contact":{"email":"[email protected]"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"tags":[{"name":"developers","description":"Operations available to regular developers"},{"name":"clients"},{"name":"servers"}],"paths":{"/generate":{"get":{"x-swagger-router-controller":"io.swagger.generator.online.GeneratorController","operationId":"generateFiles","parameters":[{"name":"argumentsUrl","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"successful operation","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}}}},"post":{"x-swagger-router-controller":"io.swagger.generator.online.GeneratorController","operationId":"generate","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/GenerationRequest"}}}},"responses":{"200":{"description":"successful operation","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}}}}},"/generate/{language}":{"get":{"x-swagger-router-controller":"io.swagger.generator.online.GeneratorController","operationId":"generate","parameters":[{"name":"language","in":"path","description":"language to generate","required":true,"schema":{"type":"string"}},{"name":"specUrl","in":"query","description":"spec url location","required":true,"schema":{"type":"string"}},{"name":"library","in":"query","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"successful operation","content":{"application/octet-stream":{"schema":{"type":"string","format":"binary"}}}}}}},"/clients":{"get":{"tags":["clients"],"x-swagger-router-controller":"io.swagger.generator.online.GeneratorController","operationId":"clientOptions","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}}}}},"/servers":{"get":{"tags":["servers"],"x-swagger-router-controller":"io.swagger.generator.online.GeneratorController","operationId":"serverOptions","responses":{"200":{"description":"successful operation","content":{"application/json":{"schema":{"type":"array","items":{"type":"string"}}}}}}}}},"components":{"schemas":{"GenerationRequest":{"x-swagger-router-model":"io.swagger.generator.model.GenerationRequest","required":["spec","options"],"properties":{"spec":{"type":"object","description":"spec in json format."},"options":{"$ref":"#/components/schemas/Options"}}},"Options":{"x-swagger-router-model":"io.swagger.generator.model.Options","required":["lang"],"properties":{"lang":{"type":"string","title":"language","description":"client language to generate (maybe class name in classpath, required)","example":"java"},"auth":{"type":"string","title":"authorization","description":"adds authorization headers when fetching the open api 3 definitions remotely. Pass in a URL-encoded string of name:header with a comma separating multiple values"},"apiPackage":{"type":"string","title":"api package","description":"package for generated api classes"},"templateVersion":{"type":"string","title":"Template Version","description":"template version for generation"},"modelPackage":{"type":"string","title":"model package","description":"package for generated models"},"modelNamePrefix":{"type":"string","title":"model name prefix","description":"Prefix that will be prepended to all model names. Default is the empty string."},"modelNameSuffix":{"type":"string","title":"model name suffix","description":"PrefixSuffix that will be appended to all model names. Default is the empty string."},"systemProperties":{"type":"array","items":{"type":"string"},"title":"System Properties","description":"sets specified system properties in the format of name=value,name=value (or multiple options, each with name=value)"},"instantiationTypes":{"type":"array","items":{"type":"string"},"title":"instantiation types","description":"sets instantiation type mappings in the format of type=instantiatedType,type=instantiatedType. For example (in Java): array=ArrayList,map=HashMap. In other words array types will get instantiated as ArrayList in generated code. You can also have multiple occurrences of this option."},"typeMappings":{"type":"array","items":{"type":"string"},"title":"type mappings","description":"sets mappings between swagger spec types and generated code types in the format of swaggerType=generatedType,swaggerType=generatedType. For example: array=List,map=Map,string=String. You can also have multiple occurrences of this option."},"additionalProperties":{"type":"array","items":{"type":"string"},"title":"additional properties","description":"sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value. You can also have multiple occurrences of this option."},"languageSpecificPrimitives":{"type":"array","items":{"type":"string"},"title":"language specific primitives","description":"specifies additional language specific primitive types in the format of type1,type2,type3,type3. For example: String,boolean,Boolean,Double. You can also have multiple occurrences of this option."},"importMappings":{"type":"array","items":{"type":"string"},"title":"import mappings","description":"specifies mappings between a given class and the import that should be used for that class in the format of type=import,type=import. You can also have multiple occurrences of this option."},"invokerPackage":{"type":"string","title":"invoker package","description":"root package for generated code"},"groupId":{"type":"string","title":"group id","description":"groupId in generated pom.xml"},"artifactId":{"type":"string","title":"artifact id","description":"artifactId in generated pom.xml"},"artifactVersion":{"type":"string","title":"artifact version","description":"artifact version generated in pom.xml"},"library":{"type":"string","title":"library","description":"library template (sub-template)"},"gitUserId":{"type":"string","title":"git user id","description":"Git user ID, e.g. swagger-api."},"gitRepoId":{"type":"string","title":"git repo id","description":"Git repo ID, e.g. swagger-codegen."},"releaseNote":{"type":"string","title":"release note","description":"Release note, default to 'Minor update'."},"httpUserAgent":{"type":"string","title":"http user agent","description":"HTTP user agent, e.g. codegen_csharp_api_client, default to 'Swagger-Codegen/{packageVersion}}/{language}'"},"reservedWordsMappings":{"type":"array","items":{"type":"string"},"title":"reserved words mappings","description":"pecifies how a reserved name should be escaped to. Otherwise, the default _<name> is used. For example id=identifier. You can also have multiple occurrences of this option."},"ignoreFileOverride":{"type":"string","title":"ignore file override location","description":"Specifies an override location for the .swagger-codegen-ignore file. Most useful on initial generation."},"removeOperationIdPrefix":{"type":"boolean","title":"remove prefix of the operationId","description":"Remove prefix of operationId, e.g. config_getId => getId"}}}}}}

0 commit comments

Comments
 (0)