Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Added bootstrap for manual mapping #1

Open
wants to merge 5 commits into from

1 participant

Commits on Mar 30, 2013
  1. @fehguy
Commits on Apr 9, 2013
  1. @fehguy

    .travis.yml

    fehguy authored
  2. @fehguy

    Update README.md

    fehguy authored
  3. @fehguy

    Update README.md

    fehguy authored
  4. @fehguy

    Update README.md

    fehguy authored
This page is out of date. Refresh to see the latest.
View
3  .travis.yml
@@ -0,0 +1,3 @@
+language: java
+jdk:
+ - oraclejdk6
View
3  README.md
@@ -1,5 +1,8 @@
# Swagger Core library
+[![Build Status](https://travis-ci.org/fehguy/swagger-core.png)](https://travis-ci.org/fehguy/swagger-core)
+
+
## [See the Wiki!](https://github.com/wordnik/swagger-core/wiki)
The [github wiki](https://github.com/wordnik/swagger-core/wiki) contains documentation, samples, etc. Start there
View
6 samples/java-jaxrs/conf/web/web.xml
@@ -36,7 +36,11 @@
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
-
+ <servlet>
+ <servlet-name>Bootstrap</servlet-name>
+ <servlet-class>com.wordnik.swagger.sample.Bootstrap</servlet-class>
+ <load-on-startup>1</load-on-startup>
+ </servlet>
<servlet-mapping>
<servlet-name>jersey</servlet-name>
<url-pattern>/*</url-pattern>
View
46 samples/java-jaxrs/src/main/java/com/wordnik/swagger/sample/Bootstrap.java
@@ -0,0 +1,46 @@
+/**
+ * Copyright 2012 Wordnik, Inc.
+ *
+ * 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 com.wordnik.swagger.sample;
+
+import com.wordnik.swagger.core.DocumentationObject;
+import com.wordnik.swagger.core.DocumentationParameter;
+import com.wordnik.swagger.jaxrs.JaxrsApiReader;
+
+import javax.servlet.http.HttpServlet;
+
+public class Bootstrap extends HttpServlet {
+ static {
+ // add the Username object to map to the generic
+ String targetClass = "com.wordnik.swagger.sample.type.Code<com.wordnik.swagger.sample.type.Username>";
+ DocumentationObject m = new DocumentationObject();
+ m.setName("Username");
+
+ DocumentationParameter field = new DocumentationParameter(
+ "username", // field name
+ "The Username", // optional description
+ "Put your notes here", // optional notes
+ "string", // datatype of parameter
+ null, // default value
+ null, // allowable values
+ true, // required
+ false); // allow multiple
+
+ m.addField(field);
+ com.wordnik.swagger.core.ApiPropertiesReader.add(targetClass,
+ "Username", m);
+ }
+}
Something went wrong with that request. Please try again.