Skip to content

Commit

Permalink
migrate all examples to openapi
Browse files Browse the repository at this point in the history
  • Loading branch information
sonrac committed Jan 16, 2018
1 parent 3a8d79b commit c5cf3a9
Show file tree
Hide file tree
Showing 23 changed files with 1,433 additions and 939 deletions.
125 changes: 76 additions & 49 deletions Examples/petstore.swagger.io/controllers/PetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ final class PetController
* type="array",
* @OAS\Items(type="string"),
* ),
* form="array"
* style="form"
* ),
* @OAS\Response(
* response=200,
* description="successful operation",
* @OAS\Schema(
* type="array",
* @OAS\Items(ref="#/definitions/Pet")
* @OAS\Items(ref="#/components/schemas/Pet")
* ),
* ),
* @OAS\Response(
Expand Down Expand Up @@ -65,7 +65,7 @@ public function findByTags()
* default="available"
* ),
* ),
* form="array"
* style="form"
* ),
* @OAS\Response(
* response=200,
Expand All @@ -74,7 +74,7 @@ public function findByTags()
* mediaType="application/json",
* @OAS\Schema(
* type="array",
* @OAS\Items(ref="#/definitions/Pet")
* @OAS\Items(ref="#/components/schemas/Pet")
* ),
* )
* ),
Expand Down Expand Up @@ -113,7 +113,7 @@ public function findByStatus()
* description="successful operation",
* @OAS\MediaType(
* mediaType="application/json",
* @OAS\Schema(ref="#/definitions/Pet")
* @OAS\Schema(ref="#/components/schemas/Pet")
* )
* ),
* @OAS\Response(
Expand All @@ -140,12 +140,25 @@ public function getPetById()
* operationId="addPet",
* summary="Add a new pet to the store",
* description="",
* consumes={"application/json", "application/xml"},
* @OAS\RequestBody(
* request="body",
* description="Pet object that needs to be added to the store",
* required=true,
* @OAS\Schema(ref="#/components/schemes/Pet"),
* @OAS\MediaType(
* mediaType="application/json",
* @OAS\Schema(ref="#/components/schemas/Pet")
* ),
* @OAS\MediaType(
* mediaType="application/xml",
* @OAS\Schema(ref="#/components/schemas/Pet")
* ),
* ),
* @OAS\RequestBody(
* description="Pet object that needs to be added to the store",
* required=true,
* @OAS\MediaType(
* mediaType="application/xml",
* @OAS\Schema(ref="#/components/schemas/Pet")
* )
* ),
* @OAS\Response(
* response=405,
Expand All @@ -166,15 +179,15 @@ public function addPet()
* summary="Update an existing pet",
* description="",
* @OAS\RequestBody(
* request="body",
* required=true,
* description="Pet object that needs to be added to the store",
* @OAS\MediaType(
* mediaType="application/json"
* @OAS\Schema(ref="#/definitions/Pet", required=true),
* mediaType="application/json",
* @OAS\Schema(ref="#/components/schemas/Pet"),
* ),
* @OAS\MediaType(
* mediaType="application/xml"
* @OAS\Schema(ref="#/definitions/Pet", required=true),
* mediaType="application/xml",
* @OAS\Schema(ref="#/components/schemas/Pet"),
* )
* ),
* @OAS\Response(
Expand Down Expand Up @@ -215,6 +228,7 @@ public function updatePet()
* ),
* @OAS\Header(
* header="api_key",
* description="Api key header",
* required=false,
* @OAS\Schema(
* type="string"
Expand Down Expand Up @@ -242,29 +256,34 @@ public function deletePet()
* summary="Updates a pet in the store with form data",
* description="",
* operationId="updatePetWithForm",
* @OAS\
* consumes={"application/x-www-form-urlencoded"},
* @OAS\RequestBody(
* required=false,
* @OAS\MediaType(
* mediaType="application/x-www-form-urlencoded",
* @OAS\Schema(
* type="object",
* @OAS\Property(
* property="name",
* description="Updated name of the pet",
* type="string"
* ),
* @OAS\Property(
* property="status",
* description="Updated status of the pet",
* type="string"
* ),
* )
* )
* ),
* @OAS\Parameter(
* name="petId",
* in="path",
* description="ID of pet that needs to be updated",
* required=true,
* type="integer",
* format="int64"
* ),
* @OAS\Parameter(
* name="name",
* in="formData",
* description="Updated name of the pet",
* required=false,
* type="string"
* ),
* @OAS\Parameter(
* name="status",
* in="formData",
* description="Updated status of the pet",
* required=false,
* type="string"
* @OAS\Schema(
* type="integer",
* format="int64"
* )
* ),
* @OAS\Response(response="405",description="Invalid input"),
* security={{
Expand All @@ -279,35 +298,44 @@ public function updatePetWithForm()
/**
* @OAS\Post(
* path="/pet/{petId}/uploadImage",
* consumes={"multipart/form-data"},
* description="",
* summary="uploads an image",
* operationId="uploadFile",
* @OAS\Parameter(
* description="Additional data to pass to server",
* in="formData",
* name="additionalMetadata",
* required=false,
* type="string"
* ),
* @OAS\Parameter(
* description="file to upload",
* in="formData",
* name="file",
* required=false,
* type="file"
* @OAS\RequestBody(
* required=true,
* @OAS\MediaType(
* mediaType="multipart/form-data",
* @OAS\Schema(
* type="object",
* @OAS\Property(
* description="Additional data to pass to server",
* property="additionalMetadata",
* type="string"
* ),
* @OAS\Property(
* description="file to upload",
* property="file",
* type="string",
* format="file",
* ),
* required={"file"}
* )
* )
* ),
* @OAS\Parameter(
* description="ID of pet to update",
* format="int64",
* in="path",
* name="petId",
* required=true,
* type="integer"
* @OAS\Schema(
* type="integer",
* format="int64"
* ),
* ),
* @OAS\Response(
* response="200",
* description="successful operation",
* @OAS\Schema(ref="#/definitions/ApiResponse")
* @OAS\Schema(ref="#/components/schemas/ApiResponse")
* ),
* security={
* {
Expand All @@ -317,7 +345,6 @@ public function updatePetWithForm()
* }
* }
* },
* summary="uploads an image",
* tags={
* "pet"
* }
Expand Down
30 changes: 18 additions & 12 deletions Examples/petstore.swagger.io/controllers/StoreController.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,17 @@ public function getInventory()
* description="",
* operationId="placeOrder",
* @OAS\RequestBody(
* request="StoreOrderBody",
* required=true,
* description="order placed for purchasing the pet",
* @OAS\Schema(ref="#/components/schemes/Order")
* @OAS\MediaType(
* mediaType="application/json",
* @OAS\Schema(ref="#/components/schemas/Order")
* )
* ),
* @OAS\Response(
* response=200,
* description="successful operation",
* @OAS\Schema(ref="#/components/schemes/Order")
* @OAS\Schema(ref="#/components/schemas/Order")
* ),
* @OAS\Response(response=400, description="Invalid Order")
* )
Expand All @@ -67,16 +69,18 @@ public function placeOrder()
* in="path",
* description="ID of pet that needs to be fetched",
* required=true,
* type="integer",
* format="int64",
* minimum=1.0,
* maximum=10.0,
* @OAS\Schema(
* type="integer",
* format="int64",
* minimum=1.0,
* maximum=10.0
* )
* ),
* @OAS\Response(
* response=200,
* description="successful operation",
* @OAS\Schema(
* ref="#/definitions/Order"
* ref="#/components/schemas/Order"
* )
* ),
* @OAS\Response(response=400, description="Invalid ID supplied"),
Expand All @@ -96,11 +100,13 @@ public function getOrderById()
* @OAS\Parameter(
* name="orderId",
* in="path",
* description="ID of the order that needs to be deleted",
* required=true,
* type="integer",
* format="int64",
* minimum=1.0
* description="ID of the order that needs to be deleted",
* @OAS\Schema(
* type="integer",
* format="int64",
* minimum=1.0
* )
* ),
* @OAS\Response(response=400, description="Invalid ID supplied"),
* @OAS\Response(response=404, description="Order not found")
Expand Down
Loading

0 comments on commit c5cf3a9

Please sign in to comment.