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 bin/silex-petstore-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@ 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/silex -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l silex -o samples/server/petstore/silex"
ags="$@ generate -t modules/swagger-codegen/src/main/resources/silex -i modules/swagger-codegen/src/test/resources/2_0/petstore.json -l silex-PHP -o samples/server/petstore/silex"

java $JAVA_OPTS -jar $executable $ags
Empty file modified bin/slim-petstore-server.sh
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public JavaInflectorServerCodegen() {

languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"byte[]",
"String",
"boolean",
"Boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public SpringMVCServerCodegen() {

languageSpecificPrimitives = new HashSet<String>(
Arrays.asList(
"byte[]",
"String",
"boolean",
"Boolean",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.swagger.model.Pet;
import java.io.File;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class PetController {
/**
* Uncomment and implement as you see fit. These operations will map
Expand Down Expand Up @@ -69,5 +69,11 @@ public ResponseContext uploadFile(RequestContext request , Long petId, String ad
}
*/

/*
public ResponseContext getPetByIdWithByteArray(RequestContext request , Long petId) {
return new ResponseContext().status(Status.INTERNAL_SERVER_ERROR).entity( "Not implemented" );
}
*/

}

Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.util.Map;
import io.swagger.model.Order;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class StoreController {
/**
* Uncomment and implement as you see fit. These operations will map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import io.swagger.model.User;
import java.util.*;

@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class UserController {
/**
* Uncomment and implement as you see fit. These operations will map
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class Category {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class Order {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class Pet {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class Tag {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@



@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-05T14:57:33.884+08:00")
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaInflectorServerCodegen", date = "2016-01-19T23:33:17.124+08:00")
public class User {

private Long id = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,72 @@ paths:
- "read:pets"
x-contentType: "multipart/form-data"
x-accepts: "application/json"
/pet/{petId}?testing_byte_array=true:
get:
tags:
- "pet"
summary: "Fake endpoint to test byte array return by 'Find pet by ID'"
description: "Returns a pet when ID < 10. ID > 10 or nonintegers will simulate\
\ API error conditions"
operationId: "getPetByIdWithByteArray"
produces:
- "application/json"
- "application/xml"
parameters:
- name: "petId"
in: "path"
description: "ID of pet that needs to be fetched"
required: true
type: "integer"
format: "int64"
responses:
200:
description: "successful operation"
schema:
type: "string"
format: "binary"
400:
description: "Invalid ID supplied"
404:
description: "Pet not found"
security:
- api_key: []
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
/pet?testing_byte_array=true:
post:
tags:
- "pet"
summary: "Fake endpoint to test byte array in body parameter for adding a new\
\ pet to the store"
description: ""
operationId: "addPetUsingByteArray"
consumes:
- "application/json"
- "application/xml"
produces:
- "application/json"
- "application/xml"
parameters:
- in: "body"
name: "body"
description: "Pet object in the form of byte array"
required: false
schema:
type: "string"
format: "binary"
responses:
405:
description: "Invalid input"
security:
- petstore_auth:
- "write:pets"
- "read:pets"
x-contentType: "application/json"
x-accepts: "application/json"
/store/inventory:
get:
tags:
Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/silex/SwaggerServer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
is an example of building a PHP server.

This example uses the [Silex](http://silex.sensiolabs.org/) micro-framework. To see how to make this your own, please take a look at the template here:
Expand Down
16 changes: 16 additions & 0 deletions samples/server/petstore/silex/SwaggerServer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,22 @@
});



$app->GET('/pet/{petId}?testing_byte_array=true', function(Application $app, Request $request, $pet_id) {


return new Response('How about implementing getPetByIdWithByteArray as a GET method ?');
});



$app->POST('/pet?testing_byte_array=true', function(Application $app, Request $request) {


return new Response('How about implementing addPetUsingByteArray as a POST method ?');
});





Expand Down
2 changes: 1 addition & 1 deletion samples/server/petstore/slim/SwaggerServer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Overview
This server was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the
[swagger-spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
[OpenAPI-Spec](https://github.com/swagger-api/swagger-core/wiki) from a remote server, you can easily generate a server stub. This
is an example of building a PHP server.

This example uses the [Slim Framework](http://www.slimframework.com/). To see how to make this your own, please take a look at the template here:
Expand Down
Loading