Skip to content

Commit 4396945

Browse files
authored
Merge branch 'master' into slf4j-1.7.30
2 parents 202f3fc + 3511810 commit 4396945

File tree

4 files changed

+146
-1
lines changed

4 files changed

+146
-1
lines changed

modules/swagger-parser-v3/src/main/java/io/swagger/v3/parser/util/OpenAPIDeserializer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,12 @@ public Server getServer(ObjectNode obj, String location, ParseResult result, Str
413413
if("http".equals(absURI.getScheme()) || "https".equals(absURI.getScheme())){
414414
value = absURI.resolve(new URI(value)).toString();
415415
}
416+
else {
417+
result.warning(location," invalid url : "+value);
418+
}
419+
416420
} catch (URISyntaxException e) {
421+
result.warning(location,"invalid url : "+value);
417422
e.printStackTrace();
418423
}
419424

modules/swagger-parser-v3/src/test/java/io/swagger/v3/parser/test/OpenAPIV3ParserTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,6 +2261,15 @@ private static int getDynamicPort() {
22612261
}
22622262

22632263
@Test
2264+
public void testIssue1236() {
2265+
final ParseOptions options = new ParseOptions();
2266+
options.setResolve(true);
2267+
2268+
SwaggerParseResult result = new OpenAPIV3Parser()
2269+
.readLocation("src/test/resources/issue-1236/petstore.json",null,options);
2270+
assertEquals(result.getMessages().get(0),"attribute .servers. invalid url : /te st/sample.yaml");
2271+
}
2272+
22642273
public void testSampleParser() {
22652274
final String location = "src/test/resources/issue-1211.json";
22662275

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
{
2+
"openapi": "3.0.2",
3+
"info": {
4+
"title": "Swagger Petstore - OpenAPI 3.0",
5+
"description": "This is a sample Pet Store Server based on the OpenAPI 3.0 specification. You can find out more about\nSwagger at [http://swagger.io](http://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!\nYou can now help us improve the API whether it's by making changes to the definition itself or to the code.\nThat way, with time, we can improve the API in general, and expose some of the new features in OAS3.\n\nSome useful links:\n- [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)\n- [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)",
6+
"termsOfService": "http://swagger.io/terms/",
7+
"contact": {
8+
"email": "[email protected]"
9+
},
10+
"license": {
11+
"name": "Apache 2.0",
12+
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
13+
},
14+
"version": "1.0.4"
15+
},
16+
"externalDocs": {
17+
"description": "Find out more about Swagger",
18+
"url": "http://swagger.io"
19+
},
20+
"servers": [
21+
{
22+
"url": "/te st/sample.yaml"
23+
}
24+
],
25+
"tags": [
26+
{
27+
"name": "pet",
28+
"description": "Everything about your Pets",
29+
"externalDocs": {
30+
"description": "Find out more",
31+
"url": "http://swagger.io"
32+
}
33+
},
34+
{
35+
"name": "store",
36+
"description": "Operations about user"
37+
},
38+
{
39+
"name": "user",
40+
"description": "Access to Petstore orders",
41+
"externalDocs": {
42+
"description": "Find out more about our store",
43+
"url": "http://swagger.io"
44+
}
45+
}
46+
],
47+
"paths": {
48+
"/user/login": {
49+
"get": {
50+
"tags": [
51+
"user"
52+
],
53+
"summary": "Logs user into the system",
54+
"description": "",
55+
"operationId": "loginUser",
56+
"parameters": [
57+
{
58+
"name": "username",
59+
"in": "query",
60+
"description": "The user name for login",
61+
"required": false,
62+
"schema": {
63+
"type": "string"
64+
}
65+
},
66+
{
67+
"name": "password",
68+
"in": "query",
69+
"description": "The password for login in clear text",
70+
"required": false,
71+
"schema": {
72+
"type": "string"
73+
}
74+
}
75+
],
76+
"responses": {
77+
"200": {
78+
"description": "successful operation",
79+
"headers": {
80+
"X-Rate-Limit": {
81+
"description": "calls per hour allowed by the user",
82+
"schema": {
83+
"type": "integer",
84+
"format": "int32"
85+
}
86+
},
87+
"X-Expires-After": {
88+
"description": "date in UTC when toekn expires",
89+
"schema": {
90+
"type": "string",
91+
"format": "date-time"
92+
}
93+
}
94+
},
95+
"content": {
96+
"application/xml": {
97+
"schema": {
98+
"type": "string"
99+
}
100+
},
101+
"application/json": {
102+
"schema": {
103+
"type": "string"
104+
}
105+
}
106+
}
107+
},
108+
"400": {
109+
"description": "Invalid username/password supplied"
110+
}
111+
}
112+
}
113+
},
114+
"/user/logout": {
115+
"get": {
116+
"tags": [
117+
"user"
118+
],
119+
"summary": "Logs out current logged in user session",
120+
"description": "",
121+
"operationId": "logoutUser",
122+
"parameters": [],
123+
"responses": {
124+
"default": {
125+
"description": "successful operation"
126+
}
127+
}
128+
}
129+
}
130+
}
131+
}

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@
295295
<wiremock-version>2.15.0</wiremock-version>
296296
<surefire-version>2.21.0</surefire-version>
297297
<commons-lang-version>3.2.1</commons-lang-version>
298-
<jackson-version>2.10.1</jackson-version>
298+
<jackson-version>2.10.2</jackson-version>
299299
</properties>
300300

301301
</project>

0 commit comments

Comments
 (0)