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
121
votes
13 answers

Converting Swagger specification JSON to HTML documentation

For some REST APIs written in PHP, I was asked to create Swagger documentation, and since I was not aware of any easy way of annotating those existing APIs and create such a documentation, I used this editor to generate some for now. I saved the…
Salil
  • 1,739
  • 2
  • 15
  • 25
23
votes
2 answers

RESTful API Doc using SLIM and SWAGGER?

I am new to this stuff but I love it. I made a little REST Api using the Slim Framework. Now I would like to have an ongoing documentation about it. I think swagger is the right choice but I have not found out yet how to integrate it ? Cheers &…
user2942586
  • 333
  • 1
  • 2
  • 12
10
votes
1 answer

How to fix ErrorException: @OA\Items() is required when @OA\Property() has type "array"?

I've tried to add a nested array of arbitrary types. These are my annotations: * @OA\Property( * @OA\Schema( * type="array", * @OA\Items( * type="array", * @OA\Items(type={}) * ) * ), * …
Andrei Lupuleasa
  • 2,677
  • 3
  • 14
  • 32
10
votes
2 answers

How to add accept application/json header for swagger-php OpenApi

I'm use L5-Swagger 5.7.* package (wrapper of Swagger-php) and tried describe Laravel REST API. So, my code like this: /** * @OA\Post(path="/subscribers", * @OA\RequestBody( * @OA\MediaType( * mediaType="application/json", …
Nikolay Votintsev
  • 452
  • 1
  • 6
  • 14
10
votes
1 answer

Swagger PHP - how to define a nested property?

I'm using Swagger PHP and most of the definitions are easy to define, but I'm having an issue with a particular piece of data that is not part of a seperate class, but instead an associative array. The json response I wish to show (simplified for…
hyarion
  • 2,251
  • 2
  • 17
  • 28
10
votes
2 answers

Generating REST documentation in a Codeigniter project

I have a REST webservice using Codeigniter and using this lib : https://github.com/chriskacerguis/codeigniter-restserver I want to generate documentation for this web service. I look to use Swagger UI to generate this documentation. But, I didn't…
Xavier W.
  • 1,270
  • 3
  • 21
  • 47
9
votes
1 answer

Issue 'Authorization: Bearer ' in a Swagger openAPI Annotations

I use these packages (installed via composer) "swagger-api/swagger-ui": "^3.0", "zircote/swagger-php": "~2.0|3.*" In my def controller I have these annotations /** * @OA\Info(title="My API", version="0.1") * @OA\Schemes(format="http") *…
spezia
  • 183
  • 1
  • 1
  • 7
9
votes
1 answer

How to automatically format PHP annotations in PHPStorm

I'm working with a large number of files that have PHP block docs with Swagger PHP annotations on them, however they are not indented. Is there anyway to automatically format them with spaces? Turning /** * @SWG\Api( *…
Ed Knowles
  • 1,925
  • 1
  • 16
  • 24
7
votes
7 answers

Can I make swagger-php use arrays on the query string?

I use Swagger-php. When I define a parameter that's on the query string it can be an array. But from what I can see, it doesn't support this kind of querystring: https://api.domain.tld/v1/objects?q[]=1&q[]=5&q[]=12 I believe this would be set in…
LeonardChallis
  • 7,759
  • 6
  • 45
  • 76
6
votes
0 answers

Swagger-PHP annotations for pre-defined examples

I'm using swagger-php annotations to generatee the documentation of my REST API, and I'd like to use pre-defined examples for describing responses. The YAML code below works: components: examples: exampleUser: value: id: 1 …
Alan PS
  • 197
  • 2
  • 12
5
votes
2 answers

How to upload a file in swagger-php array

I want to uplaod a file in swagger-php in the json requestBody How can upload with the help of swagger anonations Trying from lot of hours but not luck how can send and file in application/json array Can you help if any information about this so…
Spiral
  • 917
  • 1
  • 9
  • 15
5
votes
2 answers

Swagger OpenAPI use object with schema instead of array

I'm using L5 Swagger from DarkOnLine to generate Swagger docs using OpenApi schematics. To use schema I can do @OA\Property(property="certification", type="array", @OA\Items(ref="#/components/schemas/Certification")) and it works perfectly fine and…
abhig10
  • 535
  • 7
  • 24
4
votes
1 answer

Are declarations of entire responses reusable in swagger-php?

I would love a way to declare some responses that are the same for every endpoint; for example every endpoint will output a 401 if you don't have a proper token, and then there can be another group of endpoints that will all output 404 if you don't…
Digital Ninja
  • 3,415
  • 5
  • 26
  • 51
4
votes
2 answers

How to resolve l5-swagger issue -"Trying to access array offset on value of type bool" in php 7.4?

I was working on php version 7.2 but now upgrading to 7.4 gave an issue while generating l5-swagger. I read this stackoverflow qauestion which is not working for me. php artisan l5-swagger:generate Regenerating docs ErrorException : Trying to…
monica kauri
  • 49
  • 1
  • 3
4
votes
2 answers

Swagger CSV Post

We are working on Swagger Documentation for our Laravel REST API implementation. Several of the POST endpoints will use CSV as the parameter content type. Is there a way in Swagger to have the "Try It Now" function work with a CSV POST file…
mwex501
  • 492
  • 1
  • 8
  • 23
1
2 3
9 10