Skip to content

Commit

Permalink
fixed bugs in specifying unAPI responses (fix #31)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanch3d committed Feb 7, 2018
1 parent f386116 commit ce0605a
Showing 1 changed file with 71 additions and 10 deletions.
81 changes: 71 additions & 10 deletions resources/api/Controllers/APIController.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
use Slim\Http\Response;
use Swagger\Annotations as OAS;

/**
* Class SwaggerAPI
* @see https://gist.github.com/vanch3d/fce679e6ab9f6877a27d7a21c5170aa9
*/
class SwaggerAPI extends APIController
{
/**
Expand Down Expand Up @@ -42,33 +46,90 @@ class SwaggerAPI extends APIController
* ),
* @OAS\Response(
* response=200,
* description="successful operation",
* description="no parameters in query; return the list of all supported formats",
* @OAS\MediaType(
* mediaType="application/xml",
* @OAS\Schema(
* ref="#/components/schemas/Formats"
*
* ref="#/components/schemas/AllFormats"
* ),
* ),
* ),
* @OAS\Response(
* response=300,
* description="format is missing; return a list of supported formats for the given id",
* response=404,
* description="bad request: the id is missing or not recognised",
* @OAS\MediaType(
* mediaType="application/xml",
* @OAS\Schema(
* ref="#/components/schemas/Formats"
*
* type="object",
* @OAS\Xml( name= "nvl-slim-api" ),
* @OAS\Property(
* property="version",
* type="string",
* @OAS\Xml( attribute=true ),
* example="0.3",
* ),
* @OAS\Property(
* property="error",
* type="array",
* ref="#/components/schemas/Error",
* )
* ),
* ),
* ),
* @OAS\Response(
* response=404,
* description="id is missing or not defined",
* response=300,
* description="format is missing; return a list of supported formats",
* @OAS\MediaType(
* mediaType="application/xml",
* @OAS\Schema(
* ref="#/components/schemas/PublicationFormats"
* ),
* ),
* ),
* @OAS\Response(
* response=406,
* description="this format is not recognised",
* description="bad request; the format is not recognised",
* @OAS\MediaType(
* mediaType="application/xml",
* @OAS\Schema(
* type="object",
* @OAS\Xml( name= "nvl-slim-api" ),
* @OAS\Property(
* property="version",
* type="string",
* @OAS\Xml( attribute=true ),
* example="0.3",
* ),
* @OAS\Property(
* property="error",
* type="array",
* ref="#/components/schemas/Error",
* )
* ),
* ),
* ),
* @OAS\Response(
* response=302,
* description="operation successful; redirect to the publication record in the given format",
* @OAS\MediaType(
* mediaType="application/xml",
* @OAS\Schema(
* type="object",
* @OAS\Xml( name= "nvl-slim-api" ),
* @OAS\Property(
* property="version",
* type="string",
* @OAS\Xml( attribute=true ),
* example="0.3",
* ),
* @OAS\Property(
* property="error",
* type="array",
* ref="#/components/schemas/Error",
* )
* ),
* ),
* )
* )
*/
public function unAPI(Request $request, Response $response)
Expand Down

0 comments on commit ce0605a

Please sign in to comment.