Skip to content

Commit 93b0db9

Browse files
committed
Merge pull request #58 from swagger-api/develop
merge from develop 2.0 for release
2 parents 65e0086 + 9eba5fd commit 93b0db9

File tree

124 files changed

+16857
-15412
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+16857
-15412
lines changed

LICENSE

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Copyright 2015 SmartBear Software
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at [apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
6+
7+
Unless required by applicable law or agreed to in writing, software
8+
distributed under the License is distributed on an "AS IS" BASIS,
9+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10+
See the License for the specific language governing permissions and
11+
limitations under the License.

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
## Overview
66
This is the swagger parser project, which reads swagger specifications into current Java POJOs. It also provides a simple framework to add additional converters from different formats into the Swagger objects, making the entire toolchain available.
77

8+
## What's Swagger?
9+
10+
The goal of Swagger™ is to define a standard, language-agnostic interface to REST APIs which allows both humans and computers to discover and understand the capabilities of the service without access to source code, documentation, or through network traffic inspection. When properly defined via Swagger, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interfaces have done for lower-level programming, Swagger removes the guesswork in calling the service.
11+
12+
813
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for other languages and more.
914

1015

@@ -13,7 +18,7 @@ Using the swagger-parser is simple. Once included in your project, you can read
1318

1419
```java
1520
import io.swagger.parser.SwaggerParser;
16-
import com.wordnik.swagger.models.Swagger;
21+
import io.swagger.models.Swagger;
1722

1823
// ... your code
1924

@@ -34,7 +39,7 @@ And with the swagger-compat-spec-parser module, you can read older formats, and
3439

3540
If your swagger resource is protected, you can pass headers in the request:
3641
```java
37-
import com.wordnik.swagger.models.auth.AuthorizationValue;
42+
import io.swagger.models.auth.AuthorizationValue;
3843

3944
// ... your code
4045

+72-71
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,75 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3-
<parent>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<parent>
5+
<groupId>io.swagger</groupId>
6+
<artifactId>swagger-parser-project</artifactId>
7+
<version>1.0.8</version>
8+
<relativePath>../..</relativePath>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
411
<groupId>io.swagger</groupId>
5-
<artifactId>swagger-parser-project</artifactId>
6-
<version>1.0.7</version>
7-
<relativePath>../..</relativePath>
8-
</parent>
9-
<modelVersion>4.0.0</modelVersion>
10-
<groupId>io.swagger</groupId>
11-
<artifactId>swagger-compat-spec-parser</artifactId>
12-
<version>1.0.7</version>
13-
<packaging>jar</packaging>
14-
<name>swagger-compat-spec-parser</name>
15-
<dependencies>
16-
<dependency>
17-
<groupId>com.wordnik</groupId>
18-
<artifactId>swagger-core</artifactId>
19-
<version>${swagger-core-version}</version>
20-
</dependency>
21-
<dependency>
22-
<groupId>io.swagger</groupId>
23-
<artifactId>swagger-parser</artifactId>
24-
<version>${project.parent.version}</version>
25-
</dependency>
26-
<dependency>
27-
<groupId>com.github.fge</groupId>
28-
<artifactId>json-schema-validator</artifactId>
29-
<version>2.2.3</version>
30-
</dependency>
31-
<dependency>
32-
<groupId>com.github.fge</groupId>
33-
<artifactId>json-patch</artifactId>
34-
<version>1.6</version>
35-
</dependency>
36-
<dependency>
37-
<groupId>org.scalatest</groupId>
38-
<artifactId>scalatest_2.10</artifactId>
39-
<version>${scala-test-version}</version>
40-
<scope>test</scope>
41-
</dependency>
42-
<dependency>
43-
<groupId>junit</groupId>
44-
<artifactId>junit</artifactId>
45-
<version>${junit-version}</version>
46-
<scope>test</scope>
47-
</dependency>
48-
<dependency>
49-
<groupId>org.testng</groupId>
50-
<artifactId>testng</artifactId>
51-
<version>6.8.7</version>
52-
<scope>test</scope>
53-
<exclusions>
54-
<exclusion>
55-
<artifactId>junit</artifactId>
56-
<groupId>junit</groupId>
57-
</exclusion>
58-
<exclusion>
59-
<artifactId>snakeyaml</artifactId>
60-
<groupId>org.yaml</groupId>
61-
</exclusion>
62-
<exclusion>
63-
<artifactId>bsh</artifactId>
64-
<groupId>org.beanshell</groupId>
65-
</exclusion>
66-
</exclusions>
67-
</dependency>
68-
<dependency>
69-
<groupId>org.apache.httpcomponents</groupId>
70-
<artifactId>httpclient</artifactId>
71-
<version>4.3.3</version>
72-
</dependency>
73-
</dependencies>
12+
<artifactId>swagger-compat-spec-parser</artifactId>
13+
<version>1.0.8</version>
14+
<packaging>jar</packaging>
15+
<name>swagger-compat-spec-parser</name>
16+
<dependencies>
17+
<dependency>
18+
<groupId>io.swagger</groupId>
19+
<artifactId>swagger-core</artifactId>
20+
<version>${swagger-core-version}</version>
21+
</dependency>
22+
<dependency>
23+
<groupId>io.swagger</groupId>
24+
<artifactId>swagger-parser</artifactId>
25+
<version>${project.parent.version}</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>com.github.fge</groupId>
29+
<artifactId>json-schema-validator</artifactId>
30+
<version>2.2.3</version>
31+
</dependency>
32+
<dependency>
33+
<groupId>com.github.fge</groupId>
34+
<artifactId>json-patch</artifactId>
35+
<version>1.6</version>
36+
</dependency>
37+
<dependency>
38+
<groupId>org.scalatest</groupId>
39+
<artifactId>scalatest_2.10</artifactId>
40+
<version>${scala-test-version}</version>
41+
<scope>test</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>junit</groupId>
45+
<artifactId>junit</artifactId>
46+
<version>${junit-version}</version>
47+
<scope>test</scope>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.testng</groupId>
51+
<artifactId>testng</artifactId>
52+
<version>6.8.7</version>
53+
<scope>test</scope>
54+
<exclusions>
55+
<exclusion>
56+
<artifactId>junit</artifactId>
57+
<groupId>junit</groupId>
58+
</exclusion>
59+
<exclusion>
60+
<artifactId>snakeyaml</artifactId>
61+
<groupId>org.yaml</groupId>
62+
</exclusion>
63+
<exclusion>
64+
<artifactId>bsh</artifactId>
65+
<groupId>org.beanshell</groupId>
66+
</exclusion>
67+
</exclusions>
68+
</dependency>
69+
<dependency>
70+
<groupId>org.apache.httpcomponents</groupId>
71+
<artifactId>httpclient</artifactId>
72+
<version>4.3.3</version>
73+
</dependency>
74+
</dependencies>
7475
</project>

modules/swagger-compat-spec-parser/src/main/java/io/swagger/deserializer/AbstractSwaggerDeserializer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import java.lang.reflect.ParameterizedType;
1313

1414
public abstract class AbstractSwaggerDeserializer<T> implements SwaggerDeserializer<T> {
15-
@SuppressWarnings({ "unchecked" })
15+
@SuppressWarnings({"unchecked"})
1616
protected final Class<T> clazz = (Class<T>) ((ParameterizedType) getClass().getGenericSuperclass()).getActualTypeArguments()[0];
1717
protected final ObjectMapper objectMapper;
1818

Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package io.swagger.models;
22

3-
import com.fasterxml.jackson.annotation.*;
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonValue;
45

5-
import java.util.Map;
66
import java.util.HashMap;
7+
import java.util.Map;
78

89
/**
910
* Created by ron on 11/04/14.
@@ -13,24 +14,25 @@ public enum AuthorizationType {
1314

1415
private static Map<String, AuthorizationType> names = new HashMap<String, AuthorizationType>();
1516

16-
static {
17-
names.put("basicAuth", BASIC_AUTH);
18-
names.put("apiKey", APIKEY);
19-
names.put("oauth2", OAUTH2);
20-
}
21-
2217
@JsonCreator
2318
public static AuthorizationType forValue(String value) {
24-
return names.get(value.toLowerCase());
19+
return names.get(value.toLowerCase());
2520
}
2621

2722
@JsonValue
2823
public String toValue() {
29-
for (Map.Entry<String, AuthorizationType> entry : names.entrySet()) {
30-
if (entry.getValue() == this)
31-
return entry.getKey();
32-
}
24+
for (Map.Entry<String, AuthorizationType> entry : names.entrySet()) {
25+
if (entry.getValue() == this) {
26+
return entry.getKey();
27+
}
28+
}
29+
30+
return null; // or fail
31+
}
3332

34-
return null; // or fail
33+
static {
34+
names.put("basicAuth", BASIC_AUTH);
35+
names.put("apiKey", APIKEY);
36+
names.put("oauth2", OAUTH2);
3537
}
3638
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package io.swagger.models;
22

3-
import com.fasterxml.jackson.annotation.*;
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonValue;
45

5-
import java.util.Map;
66
import java.util.HashMap;
7+
import java.util.Map;
78

89
/**
910
* Created by ron on 11/04/14.
@@ -13,36 +14,38 @@ public enum Format {
1314

1415
private static Map<String, Format> names = new HashMap<String, Format>();
1516

16-
static {
17-
names.put("int32", INT32);
18-
names.put("int64", INT64);
19-
names.put("float", FLOAT);
20-
names.put("double", DOUBLE);
21-
names.put("byte", BYTE);
22-
names.put("date", DATE);
23-
names.put("date-time", DATE_TIME);
24-
}
25-
2617
@JsonCreator
2718
public static Format forValue(String value) {
28-
return names.get(value.toLowerCase());
19+
return names.get(value.toLowerCase());
2920
}
3021

3122
@JsonValue
3223
public String toValue() {
33-
for (Map.Entry<String, Format> entry : names.entrySet()) {
34-
if (entry.getValue() == this)
35-
return entry.getKey();
36-
}
24+
for (Map.Entry<String, Format> entry : names.entrySet()) {
25+
if (entry.getValue() == this) {
26+
return entry.getKey();
27+
}
28+
}
3729

38-
return null; // or fail
30+
return null; // or fail
3931
}
4032

4133
public String toString() {
42-
for (Map.Entry<String, Format> entry : names.entrySet()) {
43-
if (entry.getValue() == this)
44-
return entry.getKey().toLowerCase();
45-
}
46-
return null;
34+
for (Map.Entry<String, Format> entry : names.entrySet()) {
35+
if (entry.getValue() == this) {
36+
return entry.getKey().toLowerCase();
37+
}
38+
}
39+
return null;
40+
}
41+
42+
static {
43+
names.put("int32", INT32);
44+
names.put("int64", INT64);
45+
names.put("float", FLOAT);
46+
names.put("double", DOUBLE);
47+
names.put("byte", BYTE);
48+
names.put("date", DATE);
49+
names.put("date-time", DATE_TIME);
4750
}
4851
}
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
package io.swagger.models;
22

3-
import com.fasterxml.jackson.annotation.*;
3+
import com.fasterxml.jackson.annotation.JsonCreator;
4+
import com.fasterxml.jackson.annotation.JsonValue;
45

5-
import java.util.Map;
66
import java.util.HashMap;
7+
import java.util.Map;
78

89
/**
910
* Created by ron on 11/04/14.
@@ -13,28 +14,29 @@ public enum Method {
1314

1415
private static Map<String, Method> names = new HashMap<String, Method>();
1516

16-
static {
17-
names.put("get", GET);
18-
names.put("put", PUT);
19-
names.put("post", POST);
20-
names.put("delete", DELETE);
21-
names.put("patch", PATCH);
22-
names.put("options", OPTIONS);
23-
names.put("head", HEAD);
24-
}
25-
2617
@JsonCreator
2718
public static Method forValue(String value) {
28-
return names.get(value.toLowerCase());
19+
return names.get(value.toLowerCase());
2920
}
3021

3122
@JsonValue
3223
public String toValue() {
33-
for (Map.Entry<String, Method> entry : names.entrySet()) {
34-
if (entry.getValue() == this)
35-
return entry.getKey();
36-
}
24+
for (Map.Entry<String, Method> entry : names.entrySet()) {
25+
if (entry.getValue() == this) {
26+
return entry.getKey();
27+
}
28+
}
29+
30+
return null; // or fail
31+
}
3732

38-
return null; // or fail
33+
static {
34+
names.put("get", GET);
35+
names.put("put", PUT);
36+
names.put("post", POST);
37+
names.put("delete", DELETE);
38+
names.put("patch", PATCH);
39+
names.put("options", OPTIONS);
40+
names.put("head", HEAD);
3941
}
4042
}

0 commit comments

Comments
 (0)