Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: required
language: java
jdk:
- oraclejdk8
- openjdk7

cache:
directories:
Expand Down
3 changes: 2 additions & 1 deletion bin/java-play-framework-petstore-server-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@
./bin/java-play-framework-petstore-server-no-interface.sh
./bin/java-play-framework-petstore-server-no-swagger-ui.sh
./bin/java-play-framework-petstore-server-no-wrap-calls.sh
./bin/java-play-framework-petstore-server-fake-endpoints.sh
./bin/java-play-framework-petstore-server-fake-endpoints.sh
./bin/java-play-framework-petstore-server-api-package-override.sh
31 changes: 31 additions & 0 deletions bin/java-play-framework-petstore-server-api-package-override.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

SCRIPT="$0"

while [ -h "$SCRIPT" ] ; do
ls=`ls -ld "$SCRIPT"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
SCRIPT="$link"
else
SCRIPT=`dirname "$SCRIPT"`/"$link"
fi
done

if [ ! -d "${APP_DIR}" ]; then
APP_DIR=`dirname "$SCRIPT"`/..
APP_DIR=`cd "${APP_DIR}"; pwd`
fi

executable="./modules/swagger-codegen-cli/target/swagger-codegen-cli.jar"

if [ ! -f "$executable" ]
then
mvn clean package
fi

# if you've executed sbt assembly previously it will use that instead.
export JAVA_OPTS="${JAVA_OPTS} -XX:MaxPermSize=256M -Xmx1024M -DloggerPath=conf/log4j.properties"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/JavaPlayFramework -i modules/swagger-codegen/src/test/resources/2_0/petstore.yaml -l java-play-framework -o samples/server/petstore/java-play-framework-api-package-override -DhideGenerationTimestamp=true,apiPackage=com.puppies.store.apis"

java $JAVA_OPTS -jar $executable $ags
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void processOpts() {
if(this.useSwaggerUI) {
//App/Controllers
supportingFiles.add(new SupportingFile("swagger.mustache", "public", "swagger.json"));
supportingFiles.add(new SupportingFile("apiDocController.mustache", "app/controllers", "ApiDocController.java"));
supportingFiles.add(new SupportingFile("apiDocController.mustache", String.format("app/%s", apiPackage.replace(".", File.separator)), "ApiDocController.java"));
}

//We remove the default api.mustache that is used
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package controllers;
package {{apiPackage}};

import javax.inject.*;
import play.mvc.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import com.google.inject.AbstractModule;

import controllers.*;
import {{apiPackage}}.*;

public class Module extends AbstractModule {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# ~~~~

{{#useSwaggerUI}}
GET /api controllers.ApiDocController.api
GET /api {{apiPackage}}.ApiDocController.api
{{/useSwaggerUI}}

{{#apiInfo}}
Expand All @@ -12,7 +12,7 @@ GET /api controllers.ApiDocController.api
#Functions for {{{baseName}}} API
{{#operations}}
{{#operation}}
{{httpMethod}} {{{contextPath}}}{{{path}}} controllers.{{classname}}Controller.{{operationId}}({{#pathParams}}{{paramName}}: {{#isUuid}}java.util.UUID{{/isUuid}}{{^isUuid}}{{{dataType}}}{{/isUuid}}{{#hasMore}}, {{/hasMore}}{{/pathParams}})
{{httpMethod}} {{{contextPath}}}{{{path}}} {{apiPackage}}.{{classname}}Controller.{{operationId}}({{#pathParams}}{{paramName}}: {{#isUuid}}java.util.UUID{{/isUuid}}{{^isUuid}}{{{dataType}}}{{/isUuid}}{{#hasMore}}, {{/hasMore}}{{/pathParams}})
{{/operation}}
{{/operations}}
{{/apis}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen

# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.

# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs

# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux

# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux

# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.3.0
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This software is licensed under the Apache 2 license, quoted below.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this project 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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
This is your new Play application
=================================

This file will be packaged with your application when using `activator dist`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import com.google.inject.AbstractModule;

import com.puppies.store.apis.*;

public class Module extends AbstractModule {

@Override
protected void configure() {
bind(PetApiControllerImpInterface.class).to(PetApiControllerImp.class);
bind(StoreApiControllerImpInterface.class).to(StoreApiControllerImp.class);
bind(UserApiControllerImpInterface.class).to(UserApiControllerImp.class);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
package apimodels;

import com.fasterxml.jackson.annotation.*;
import java.util.Set;
import javax.validation.*;
import java.util.Objects;
import javax.validation.constraints.*;
/**
* A category for a pet
*/

@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class Category {
@JsonProperty("id")
private Long id = null;

@JsonProperty("name")
private String name = null;

public Category id(Long id) {
this.id = id;
return this;
}

/**
* Get id
* @return id
**/
public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Category name(String name) {
this.name = name;
return this;
}

/**
* Get name
* @return name
**/
public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Category category = (Category) o;
return Objects.equals(id, category.id) &&
Objects.equals(name, category.name);
}

@Override
public int hashCode() {
return Objects.hash(id, name);
}

@SuppressWarnings("StringBufferReplaceableByString")
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class Category {\n");

sb.append(" id: ").append(toIndentedString(id)).append("\n");
sb.append(" name: ").append(toIndentedString(name)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
package apimodels;

import com.fasterxml.jackson.annotation.*;
import java.util.Set;
import javax.validation.*;
import java.util.Objects;
import javax.validation.constraints.*;
/**
* Describes the result of uploading an image resource
*/

@SuppressWarnings({"UnusedReturnValue", "WeakerAccess"})
public class ModelApiResponse {
@JsonProperty("code")
private Integer code = null;

@JsonProperty("type")
private String type = null;

@JsonProperty("message")
private String message = null;

public ModelApiResponse code(Integer code) {
this.code = code;
return this;
}

/**
* Get code
* @return code
**/
public Integer getCode() {
return code;
}

public void setCode(Integer code) {
this.code = code;
}

public ModelApiResponse type(String type) {
this.type = type;
return this;
}

/**
* Get type
* @return type
**/
public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public ModelApiResponse message(String message) {
this.message = message;
return this;
}

/**
* Get message
* @return message
**/
public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}


@Override
public boolean equals(java.lang.Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
ModelApiResponse _apiResponse = (ModelApiResponse) o;
return Objects.equals(code, _apiResponse.code) &&
Objects.equals(type, _apiResponse.type) &&
Objects.equals(message, _apiResponse.message);
}

@Override
public int hashCode() {
return Objects.hash(code, type, message);
}

@SuppressWarnings("StringBufferReplaceableByString")
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("class ModelApiResponse {\n");

sb.append(" code: ").append(toIndentedString(code)).append("\n");
sb.append(" type: ").append(toIndentedString(type)).append("\n");
sb.append(" message: ").append(toIndentedString(message)).append("\n");
sb.append("}");
return sb.toString();
}

/**
* Convert the given object to string with each line indented by 4 spaces
* (except the first line).
*/
private String toIndentedString(java.lang.Object o) {
if (o == null) {
return "null";
}
return o.toString().replace("\n", "\n ");
}
}

Loading