Skip to content

Commit 08d82b3

Browse files
committed
Merge branch 'develop_2.0'
2 parents e9ac84a + aeda643 commit 08d82b3

File tree

926 files changed

+26787
-37104
lines changed

Some content is hidden

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

926 files changed

+26787
-37104
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ samples/scala-play2/logs
99
.classpath
1010
.cache
1111
atlassian-ide-plugin.xml
12-
*.iml
12+
*.iml
13+
.java-version

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
sudo: false
12
language: java
2-
script: mvn verify
3+
script: mvn clean verify
34
jdk:
45
- oraclejdk7
56

README.md

Lines changed: 11 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Swagger Core library
22

3-
[![Build Status](https://travis-ci.org/swagger-api/swagger-core.png?branch=master)](https://travis-ci.org/swagger-api/swagger-core)
3+
[![Build Status](https://travis-ci.org/swagger-api/swagger-core.svg?branch=develop_2.0)](https://travis-ci.org/swagger-api/swagger-core)
44

55
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.
66

7-
Swagger-core is the Java/Scala implementation of Swagger. It supports *JAX-RS*, *plain Servlets*, and *Play Framework*.
7+
Swagger-core is the Java implementation of Swagger. Current version supports *JAX-RS*. Future milestone releases will add support for *plain Servlets* and *Play Framework*.
88

99
Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additional information about the Swagger project, including additional libraries with support for SpringMVC, other languages and more.
1010

@@ -20,22 +20,20 @@ The following methods are available to obtain support for Swagger:
2020

2121

2222
## Get started with Swagger!
23-
See the guide on [getting started with swagger](https://github.com/swagger-api/swagger-core/wiki/Adding-Swagger-to-your-API) to get started with adding swagger to your API.
23+
See the guide on [getting started with swagger](https://github.com/swagger-api/swagger-core/wiki/Swagger-Core-JAX-RS-Project-Setup) to get started with adding swagger to your API.
2424

2525
## Compatibility
2626
The Swagger Specification has undergone 3 revisions since initial creation in 2010. The swagger-core project has the following compatibilities with the swagger specification:
2727

2828
Swagger core Version | Release Date | Swagger Spec compatibility | Notes | Status
2929
------------------------- | ------------ | -------------------------- | ----- | ----
30-
1.5.0 (in development) | n/a | 2.0 | [branch develop_2.0](https://github.com/swagger-api/swagger-core/tree/develop_2.0) | [1.5 Milestone](https://github.com/swagger-api/swagger-core/milestones/v1.5)
31-
1.5.0-M1 | 2015-01-31 | 2.0 | [branch 1.5.0-M1](https://github.com/swagger-api/swagger-core/tree/1.5.0-M1) | JAX-RS support only
32-
1.3.12 | 2014-12-23 | 1.2 | [tag v1.3.12](https://github.com/swagger-api/swagger-core/tree/v1.3.12)
30+
1.5.0-M2 | 2015-03-30 | 2.0 | [master](https://github.com/swagger-api/swagger-core) |
31+
1.3.12 | 2014-12-23 | 1.2 | [tag v1.3.12](https://github.com/swagger-api/swagger-core/tree/v1.3.12)
3332
1.2.4 | 2013-06-19 | 1.1 | [tag swagger-project_2.10.0-1.2.4](https://github.com/swagger-api/swagger-core/tree/swagger-project_2.10.0-1.2.4)
3433
1.0.0 | 2011-10-16 | 1.0 | [tag v1.0](https://github.com/swagger-api/swagger-core/tree/v1.0)
3534

3635
## Overview
37-
This is a project to build the swagger-core library, which is required for the Reverb implementation of the Swagger spec. For more information about Wordnik's APIs, please visit http://developer.wordnik.com.
38-
36+
This is a project to build the swagger-core library, which is required for the Reverb implementation of the Swagger spec.
3937

4038
### Change History
4139
If you're interested in the change history of swagger and the swagger-core framework, see [here](https://github.com/swagger-api/swagger-core/wiki/Changelog).
@@ -44,11 +42,13 @@ If you're interested in the change history of swagger and the swagger-core frame
4442
### Prerequisites
4543
You need the following installed and available in your $PATH:
4644

47-
<li>- Java 7 (http://java.oracle.com)
45+
<li>- Java 6 (http://java.oracle.com)
4846

4947
<li>- Apache maven 3.0.4 or greater (http://maven.apache.org/)
5048

51-
### To build from source (currently 1.3.12)
49+
<li>- Jackson 2.4.2 or greater
50+
51+
### To build from source (currently 1.5.0-M2)
5252
```
5353
# first time building locally
5454
mvn -N
@@ -66,36 +66,8 @@ Of course if you don't want to build locally you can grab artifacts from maven c
6666
`http://repo1.maven.org/maven2/com/wordnik/`
6767

6868
## Sample Apps
69-
There are a number of sample apps in the [samples](https://github.com/swagger-api/swagger-core/tree/master/samples) folder:
70-
71-
[java-jaxrs](https://github.com/swagger-api/swagger-core/tree/master/samples/java-jaxrs/README.md) Java-based swagger server with JAX-RS
72-
73-
[scala-jaxrs](https://github.com/swagger-api/swagger-core/tree/master/samples/scala-jaxrs/README.md) Scala-based swagger server with JAX-RS
74-
75-
[scala-jaxrs-apm](https://github.com/swagger-api/swagger-core/tree/master/samples/scala-jaxrs-apm/README.md)
76-
Scala-based swagger server using wordnik-oss utils for Application Performance Monitoring (APM)
77-
78-
To run a sample app after initial compile:
79-
80-
```
81-
# run scala-jaxrs sample app
82-
cd samples/scala-jaxrs
83-
84-
mvn jetty:run
85-
```
86-
87-
And the [Play2](http://playframework.org) samples:
88-
89-
[java-play2](https://github.com/swagger-api/swagger-core/tree/master/samples/java-play2) Java-based Play2 sample app
90-
91-
[scala-play2](https://github.com/swagger-api/swagger-core/tree/master/samples/scala-play2) Scala-based Play2 sample app
92-
93-
To run the Play2 sample apps:
94-
95-
```
96-
cd samples/java-play2
69+
There are a number of sample apps in the [samples](https://github.com/swagger-api/swagger-core/tree/develop_2.0/samples) folder.
9770

98-
sbt run
9971
```
10072
10173
License

modules/swagger-annotations/pom.xml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,21 @@
22
<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">
33
<parent>
44
<groupId>com.wordnik</groupId>
5-
<artifactId>swagger-project_2.10</artifactId>
6-
<version>1.3.12</version>
5+
<artifactId>swagger-project</artifactId>
6+
<version>1.5.0-M2</version>
77
<relativePath>../..</relativePath>
88
</parent>
99
<modelVersion>4.0.0</modelVersion>
1010
<groupId>com.wordnik</groupId>
1111
<artifactId>swagger-annotations</artifactId>
12-
<version>1.3.12</version>
12+
<version>1.5.0-M2</version>
1313
<packaging>bundle</packaging>
1414
<name>swagger-annotations</name>
1515

1616
<build>
1717
<sourceDirectory>src/main/java</sourceDirectory>
1818
<defaultGoal>install</defaultGoal>
19+
1920
<plugins>
2021
<plugin>
2122
<groupId>org.apache.felix</groupId>
@@ -28,5 +29,6 @@
2829
</configuration>
2930
</plugin>
3031
</plugins>
32+
3133
</build>
3234
</project>
Lines changed: 111 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Copyright 2014 Reverb Technologies, Inc.
2+
* Copyright 2015 Reverb Technologies, Inc.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,10 +21,10 @@
2121

2222
/**
2323
* Marks a class as a Swagger resource.
24-
* <p/>
24+
* <p>
2525
* The resource affects both the root document of Swagger, the Resource
2626
* Listing, and the API Declaration of that specific resource.
27-
* <p/>
27+
* <p>
2828
* Swagger will only include and introspect only classes that are annotated
2929
* with {@code @Api} and will ignore other resources (JAX-RS endpoints, Servlets and
3030
* so on).
@@ -33,87 +33,120 @@
3333
@Retention(RetentionPolicy.RUNTIME)
3434
@Inherited
3535
public @interface Api {
36-
/**
37-
* The 'path' that is going to be used to host the API Declaration of the
38-
* resource.
39-
* <p/>
40-
* For JAX-RS resources, this would normally have the same value as the {@code @Path}
41-
* on the resource, but can be any other value as well. It will serve as the path
42-
* where the documentation is hosted.
43-
* <p/>
44-
* For Servlets, this path has to be the path serving the Servlet.
45-
* <p/>
46-
* If the value isn't preceded with a slash, one would be added to it.
47-
*/
48-
String value();
36+
/**
37+
* The 'path' that is going to be used to host the API Declaration of the
38+
* resource.
39+
* <p>
40+
* For JAX-RS resources, this would normally have the same value as the {@code @Path}
41+
* on the resource, but can be any other value as well. It will serve as the path
42+
* where the documentation is hosted.
43+
* <p>
44+
* For Servlets, this path has to be the path serving the Servlet.
45+
* <p>
46+
* If the value isn't preceded with a slash, one would be added to it.
47+
*
48+
* @return the document location value, or empty string if not set
49+
*/
50+
String value() default "";
4951

50-
/**
51-
* Corresponds to the `description` field of the Resource Listing API operation.
52-
* <p/>
53-
* This should be a short description of the resource.
54-
*/
55-
String description() default "";
52+
/**
53+
* A list of tags for API documentation control.
54+
* Tags can be used for logical grouping of operations by resources or any other qualifier.
55+
*
56+
* @since 1.5.2
57+
*
58+
* @return a string array of tag values
59+
*/
60+
String[] tags() default "";
5661

57-
/**
58-
* Corresponds to the `basePath` field of the API Declaration.
59-
* <p/>
60-
* The `basePath` is derived automatically by Swagger. This property allows
61-
* overriding the default value if needed.
62-
*
63-
* @since 1.3.7
64-
*/
65-
String basePath() default "";
62+
/**
63+
* Corresponds to the `description` field of the Resource Listing API operation.
64+
* <p>
65+
* This should be a short description of the resource.
66+
*
67+
* @return a longer description about this API
68+
*/
69+
String description() default "";
6670

67-
/**
68-
* Optional explicit ordering of this API resource in the Resource Listing.
69-
*/
70-
int position() default 0;
71+
/**
72+
* Corresponds to the `basePath` field of the API Declaration.
73+
* <p>
74+
* The `basePath` is derived automatically by Swagger. This property allows
75+
* overriding the default value if needed. for swagger 2.0 specifications, this
76+
* value is no longer supported
77+
*
78+
* @since 1.3.7
79+
*
80+
* @return the basePath for this operation
81+
*/
82+
@Deprecated
83+
String basePath() default "";
7184

72-
/**
73-
* Corresponds to the `produces` field of the API Declaration.
74-
* <p/>
75-
* Takes in comma-separated values of content types.
76-
* For example, "application/json, application/xml" would suggest this API Resource
77-
* generates JSON and XML output.
78-
* <p/>
79-
* For JAX-RS resources, this would automatically take the value of the {@code @Produces}
80-
* annotation if such exists. It can also be used to override the {@code @Produces} values
81-
* for the Swagger documentation.
82-
*/
83-
String produces() default "";
85+
/**
86+
* Optional explicit ordering of this API resource in the Resource Listing.
87+
* As of swagger-spec 2.0, this value is no longer used
88+
*
89+
*
90+
* @return the position of this API in the resource listing
91+
*/
92+
@Deprecated
93+
int position() default 0;
8494

85-
/**
86-
* Corresponds to the `consumes` field of the API Declaration.
87-
* <p/>
88-
* Takes in comma-separated values of content types.
89-
* For example, "application/json, application/xml" would suggest this API Resource
90-
* accepts JSON and XML input.
91-
* <p/>
92-
* For JAX-RS resources, this would automatically take the value of the {@code @Consumes}
93-
* annotation if such exists. It can also be used to override the {@code @Consumes} values
94-
* for the Swagger documentation.
95-
*/
96-
String consumes() default "";
95+
/**
96+
* Corresponds to the `produces` field of the API Declaration.
97+
* <p>
98+
* Takes in comma-separated values of content types.
99+
* For example, "application/json, application/xml" would suggest this API Resource
100+
* generates JSON and XML output.
101+
* <p>
102+
* For JAX-RS resources, this would automatically take the value of the {@code @Produces}
103+
* annotation if such exists. It can also be used to override the {@code @Produces} values
104+
* for the Swagger documentation.
105+
*
106+
* @return the supported media types supported by the server, or an empty string if not set
107+
*/
108+
String produces() default "";
97109

98-
/**
99-
* This property is currently not in use.
100-
*/
101-
String protocols() default "";
110+
/**
111+
* Corresponds to the `consumes` field of the API Declaration.
112+
* <p>
113+
* Takes in comma-separated values of content types.
114+
* For example, "application/json, application/xml" would suggest this API Resource
115+
* accepts JSON and XML input.
116+
* <p>
117+
* For JAX-RS resources, this would automatically take the value of the {@code @Consumes}
118+
* annotation if such exists. It can also be used to override the {@code @Consumes} values
119+
* for the Swagger documentation.
120+
*
121+
* @return the consumes value, or empty string if not set
122+
*/
123+
String consumes() default "";
102124

103-
/**
104-
* Corresponds to the `authorizations` field of the API Declaration.
105-
* <p/>
106-
* Takes in a list of the required authorizations for this API Resource.
107-
* This may be overridden by specific operations.
108-
*
109-
* @see Authorization
110-
*/
111-
Authorization[] authorizations() default @Authorization("");
125+
/**
126+
* This property is currently not in use.
127+
*
128+
* @return the protocols supported by the server
129+
*/
130+
String protocols() default "";
112131

113-
/**
114-
* Hides the api.
115-
*
116-
* @since 1.3.8
117-
*/
118-
boolean hidden() default false;
132+
/**
133+
* Corresponds to the `authorizations` field of the API Declaration.
134+
* <p>
135+
* Takes in a list of the required authorizations for this API Resource.
136+
* This may be overridden by specific operations.
137+
*
138+
* @see Authorization
139+
*
140+
* @return an array of authorizations required by the server, or a single, empty authorization value if not set
141+
*/
142+
Authorization[] authorizations() default @Authorization(value = "", type = "");
143+
144+
/**
145+
* Hides the api.
146+
*
147+
* @since 1.3.8
148+
*
149+
* @return true if the api should be hidden from the swagger documentation
150+
*/
151+
boolean hidden() default false;
119152
}

0 commit comments

Comments
 (0)