Questions tagged [swagger-php]

The php swagger annotation and parsing library

Swagger-PHP library implementing the swagger.wordnik.com specification to describe web services, operations/actions and models enabling a uniform means of producing, consuming, and visualizing RESTful web services.

http://zircote.com/swagger-php/

148 questions
4
votes
1 answer

Swagger-php - how to add paths programmatically?

I'm using Swagger for Documentation. Generating json file from annotation works great. Further, I want to add some more paths to the generated json file programmatically. I discovered that the Swagger class has merge method so I tried to deserialize…
jesuisgenial
  • 685
  • 1
  • 5
  • 15
4
votes
1 answer

How to generate Model/Example value section for GET request in Swagger

I am concerned on generating Model/Example value section for my GET request with Swagger. The link to official example shows that section perfectly. In official docs it is generated using existing model: * …
Bandydan
  • 623
  • 1
  • 8
  • 24
4
votes
2 answers

Swagger-php Annotations for Request Headers

I am creating a Restful api in php using Slim framework. To document the api's am using Swagger-php Annotations. How to annotate the Request Headers for a api ?
4
votes
3 answers

PHP-Swagger query-params

in my Zend-Application I am writing a little API for mobile-Applications. To make it easy for the mobile-developers I am using Swagger. Up to now everything works fine except one GET-Request. When I am calling…
rholtermann
  • 105
  • 3
  • 10
3
votes
1 answer

Set example of array with ids in Swagger Property (OAS3)

I'm trying to specify the following requestBody in swagger (OAS3): { "first_name": "John", "last_name": "Doe", "email": "user@example.com", "interest_ids": [ 1,2 ] } I currently have specified the requestBody as follows: * …
user2191227
  • 392
  • 3
  • 15
3
votes
2 answers

L5 Swagger - how to add examples for request body or response body

i'm trying to define some request body example in a file and link this file to the actual request, i saw we can use Swagger $ref to do that Reusing Examples but i can't find the correct L5 Swagger syntax to do it please any help. my code: /** *…
Fadi
  • 2,320
  • 8
  • 38
  • 77
3
votes
1 answer

Is the schemas section in the nelmio_api_doc.yaml required?

I have been setting up the Nelmio API Doc Bundle with Swagger-PHP. All is working as expected the only thing I cannot seem to figure out/understand is the schemas. In the User controller I have the following annotation: * @OA\RequestBody( …
RolandD
  • 70
  • 1
  • 6
3
votes
1 answer

swagger with laravel passport not working

I want to connect swagger with laravel passport. My swagger config file settings 'passport' => [ // Unique name of security 'type' => 'oauth2', // The type of the security scheme. Valid values are "basic", "apiKey" or "oauth2". …
Zain Farooq
  • 97
  • 2
  • 9
3
votes
1 answer

@AO\JsonContent in parameter of get request

In swagger's documentation using OpenApi specification, you can wrap schema in parameter to content with application/json: parameters: - in: query name: filter # Wrap 'schema' into 'content.' content: …
3
votes
1 answer

NelmioApiDoc model definition / how to ignore getter or alias to existing property with other name?

Can we overwride model accessor property name or ignore it? Here my User::getUsername function which is an getter for email property (I need this function named like that to implement interface): class User extends AbstractDocument implements…
FAjir
  • 4,384
  • 2
  • 26
  • 30
3
votes
2 answers

Swagger.php : how to change POST request header Content-type

I use lib: darkaonline/l5-swagger (^5.5) (which contains swagger-php + swagger-ui), I need to change header Content-Type in my POST request to upload file (to read it in Laravel Input::file('photo') ). I read that I should add consumes and produces…
Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
3
votes
0 answers

How can I make parameter optional in some but required in other cases in Swagger/PHP?

I'm documenting PHP REST-API with Swagger. So I defined my datamodel. My current Problem is, that the required state of some fields varies on different request types. My model looks like this: * @SWG\Definition(required={"firstName", "lastName"}) …
3
votes
2 answers

Two paths for the same method

Been trying to use Swagger to generate my documentation for my PHP Rest API, using swagger-php. It's working pretty great, not quite sure if I'm a fan of having huge comment blocks due to the documentation, but that's not the issue. I have two…
Growiel
  • 775
  • 1
  • 7
  • 20
3
votes
1 answer

Swagger PHP Object instead of Array

Example swagger markup for a model * @SWG\Model( * id="UserSubscriptionSearchResultsFilter", * @SWG\Property(name="total", type="integer"), * @SWG\Property(name="perPage", type="integer"), * @SWG\Property(name="query", type="string"), * …
ajameswolf
  • 1,650
  • 4
  • 21
  • 43
3
votes
1 answer

PHP Swagger and Yii

I have searched and found i have been lost all day now, and I feel I am going round in circles. I have written, (with help of a few guides), a simple API for my Yii based application. I have now come to document this API for other to use it. I read…
Liam
  • 536
  • 8
  • 23
1
2
3
9 10