Update PHP Slim server samples with OAS2, OAS3 (#258)

* update php slim server petstore with oas2

* update php slim petstore with oas3 (no diff)
This commit is contained in:
William Cheng 2018-04-28 21:48:40 +08:00 committed by GitHub
parent 7621deeb9f
commit 490255025e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 44 additions and 12 deletions

View File

@ -0,0 +1,32 @@
#!/bin/sh
SCRIPT="$0"
echo "# START SCRIPT: $SCRIPT"
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/openapi-generator-cli/target/openapi-generator-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/openapi-generator/src/main/resources/slim -i modules/openapi-generator/src/test/resources/3_0/petstore.yaml -l php-slim -o samples/server/petstore/slim"
java $JAVA_OPTS -jar $executable $ags

View File

@ -1 +1 @@
2.2.3-SNAPSHOT 3.0.0-SNAPSHOT

View File

@ -13,7 +13,7 @@ $app = new Slim\App();
* POST addPet * POST addPet
* Summary: Add a new pet to the store * Summary: Add a new pet to the store
* Notes: * Notes:
* Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/v2/pet', function($request, $response, $args) { $app->POST('/v2/pet', function($request, $response, $args) {
@ -29,7 +29,7 @@ $app->POST('/v2/pet', function($request, $response, $args) {
* DELETE deletePet * DELETE deletePet
* Summary: Deletes a pet * Summary: Deletes a pet
* Notes: * Notes:
* Output-Formats: [application/xml, application/json]
*/ */
$app->DELETE('/v2/pet/{petId}', function($request, $response, $args) { $app->DELETE('/v2/pet/{petId}', function($request, $response, $args) {
$headers = $request->getHeaders(); $headers = $request->getHeaders();
@ -95,7 +95,7 @@ $app->GET('/v2/pet/{petId}', function($request, $response, $args) {
* PUT updatePet * PUT updatePet
* Summary: Update an existing pet * Summary: Update an existing pet
* Notes: * Notes:
* Output-Formats: [application/xml, application/json]
*/ */
$app->PUT('/v2/pet', function($request, $response, $args) { $app->PUT('/v2/pet', function($request, $response, $args) {
@ -111,7 +111,7 @@ $app->PUT('/v2/pet', function($request, $response, $args) {
* POST updatePetWithForm * POST updatePetWithForm
* Summary: Updates a pet in the store with form data * Summary: Updates a pet in the store with form data
* Notes: * Notes:
* Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/v2/pet/{petId}', function($request, $response, $args) { $app->POST('/v2/pet/{petId}', function($request, $response, $args) {
@ -143,7 +143,7 @@ $app->POST('/v2/pet/{petId}/uploadImage', function($request, $response, $args) {
* DELETE deleteOrder * DELETE deleteOrder
* Summary: Delete purchase order by ID * Summary: Delete purchase order by ID
* Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors * Notes: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
* Output-Formats: [application/xml, application/json]
*/ */
$app->DELETE('/v2/store/order/{orderId}', function($request, $response, $args) { $app->DELETE('/v2/store/order/{orderId}', function($request, $response, $args) {
@ -207,7 +207,7 @@ $app->POST('/v2/store/order', function($request, $response, $args) {
* POST createUser * POST createUser
* Summary: Create user * Summary: Create user
* Notes: This can only be done by the logged in user. * Notes: This can only be done by the logged in user.
* Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/v2/user', function($request, $response, $args) { $app->POST('/v2/user', function($request, $response, $args) {
@ -223,7 +223,7 @@ $app->POST('/v2/user', function($request, $response, $args) {
* POST createUsersWithArrayInput * POST createUsersWithArrayInput
* Summary: Creates list of users with given input array * Summary: Creates list of users with given input array
* Notes: * Notes:
* Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/v2/user/createWithArray', function($request, $response, $args) { $app->POST('/v2/user/createWithArray', function($request, $response, $args) {
@ -239,7 +239,7 @@ $app->POST('/v2/user/createWithArray', function($request, $response, $args) {
* POST createUsersWithListInput * POST createUsersWithListInput
* Summary: Creates list of users with given input array * Summary: Creates list of users with given input array
* Notes: * Notes:
* Output-Formats: [application/xml, application/json]
*/ */
$app->POST('/v2/user/createWithList', function($request, $response, $args) { $app->POST('/v2/user/createWithList', function($request, $response, $args) {
@ -255,7 +255,7 @@ $app->POST('/v2/user/createWithList', function($request, $response, $args) {
* DELETE deleteUser * DELETE deleteUser
* Summary: Delete user * Summary: Delete user
* Notes: This can only be done by the logged in user. * Notes: This can only be done by the logged in user.
* Output-Formats: [application/xml, application/json]
*/ */
$app->DELETE('/v2/user/{username}', function($request, $response, $args) { $app->DELETE('/v2/user/{username}', function($request, $response, $args) {
@ -304,7 +304,7 @@ $app->GET('/v2/user/login', function($request, $response, $args) {
* GET logoutUser * GET logoutUser
* Summary: Logs out current logged in user session * Summary: Logs out current logged in user session
* Notes: * Notes:
* Output-Formats: [application/xml, application/json]
*/ */
$app->GET('/v2/user/logout', function($request, $response, $args) { $app->GET('/v2/user/logout', function($request, $response, $args) {
@ -320,7 +320,7 @@ $app->GET('/v2/user/logout', function($request, $response, $args) {
* PUT updateUser * PUT updateUser
* Summary: Updated user * Summary: Updated user
* Notes: This can only be done by the logged in user. * Notes: This can only be done by the logged in user.
* Output-Formats: [application/xml, application/json]
*/ */
$app->PUT('/v2/user/{username}', function($request, $response, $args) { $app->PUT('/v2/user/{username}', function($request, $response, $args) {