150 questions
0
votes
0
answers
66
views
How to document multiple routes using the same controller method with l5-swagger in Laravel?
I'm working on a Laravel API using l5-swagger for documentation.
I have two routes:
/post/{id}/like
/comment/{id}/like
Both are handled by the same method defined in a base controller (e.g. ...
0
votes
0
answers
59
views
How to use different schema representations for request and response in L5-Swagger (Laravel)
I'm using L5-Swagger to document my API in a Laravel application.
Let’s consider the following models:
Dog
Shop
Sale (which has foreign keys to both dog_id and shop_id)
In my API documentation, I ...
0
votes
1
answer
269
views
cannot get rid of phpstan errors since switching to php attributes for OpenApi - has no value type specified in iterable type array
I am using swagger to create an OpenApi documentation.
I am switching now to php attributes and phpstan in level 6 complain about missing specific array declaration, which worked totally fine as long ...
1
vote
1
answer
163
views
How to use anyOf in swagger-php for the \Response attribute
I'm trying to use attributes in swagger-php. The intention is to support multiple Content-Type responses with the same API endpoint.
Below a minimal code example:
#[OA\Get(path: '/myEndpoint')]
#[OA\...
0
votes
1
answer
2k
views
zircote/swagger-php - Skipping unknown La\Product
Problem
I'm trying to use zircote/swagger-php to generate an OpenApi file from PHP-code. For some reason I keep getting the following error:
Warning: Skipping unknown La\Product
Warning: Required @OA\...
0
votes
1
answer
453
views
What is correct syntax to apply security globally for OpanApi 3.0 and PHP attributes with swagger-php
I am using PHP attributes to produce my OpenApi yaml file specfication/documentation and then using Swagger UI to interact with it.
I have the following defined which creates the .yaml file without ...
4
votes
2
answers
5k
views
swagger-php response array of objects using attributes
Just learning to use attributes to describe function parameters and responses. I'm trying to describe a response object that returns an array of objects, but so far not a lot of luck using an array, ...
0
votes
2
answers
549
views
How to use Swagger/OpenAPI annotations in PHP to describe a Cookie?
When using the block below to generate swagger documentation:
/**
* @OA\Get(
* path="/api/users",
* summary="...",
* @OA\Response(
* response="200&...
0
votes
0
answers
723
views
Multiple @OA\Response() with the same response=200 error showing in: (Laravel swagger)
Locally apache server documentation properly Running but when it deploy the live server then showing error,
LOG.error: ErrorException: Multiple @OA\Response() with the same response="200" :
...
1
vote
1
answer
966
views
Sorting API paths in ReDoc with zircote/swagger-php (OpenAPI / Symfony)
I can't find a way to sort the API paths defined in my PHP annotations with zircote/swagger-php, i found nothing in OpenAPI specification nor in swagger-php documentation to achieve this. This related ...
0
votes
1
answer
508
views
Resolver error "Could not resolve reference: undefined" in Swagger PHP
enter image description here
I’m inputting Swagger PHP notation into our API. When I use schemas I’ve created I'm getting a resolver error "Could not resolve reference: undefined”.
When I call my ...
1
vote
2
answers
597
views
Swagger-php: How to enable verbose to check excluded directories?
Using Swagger-php and the following command, how can I make it show the folders/files it searches so that I can check my excudes actually work?
$openapi = \OpenApi\scan('./myfolder', [
'exclude' =&...
1
vote
1
answer
527
views
How to define nested arrays using zircote/swagger-php
I generated the array below in PHP and now don't know how to define it using zircote/swagger-php, I would be very grateful if you could help me.
PHP array.
$arr = [
['name' => 'foo', 'age' =>...
1
vote
0
answers
549
views
Swagger-php how to specify key => typed value pairs?
I'm stuck when trying to define settings API documentation. Let's say, that in
@OA\JsonContent()
I need to have two properties - key and value. But properties are strictly defined as
key => type ...
0
votes
1
answer
303
views
using a two dimensional array in swagger php api
i want to get a get request http://localhost/api/catalog/product/list?filters[filter14][]=0
but in swagger it turns out only
how to create two dimensional array input in swagger editor?
0
votes
1
answer
3k
views
Are there custom properties in openapi 3?
We have php-swagger which generates developer documentation in open api 3.0 format.
There was a task - to make OTHER documentation based on the generated api-docs.json, for clients with a limited ...
0
votes
1
answer
1k
views
Laravel swagger annotations into a separate file
I am using DarkaOnLine/L5-Swagger package for project. Here is example annotation
/**
* @OA\Post(
* //annotations etc..
* )
*/
public function login(LoginRequest $request): JsonResponse
{
/...
0
votes
1
answer
553
views
Laravel L5 Swagger "Package Unable to render this definition"
Upgraded from Laravel 8 to 9 and I received this message on swagger docs.
"Unable to render this definition
The provided definition does not specify a valid version field".
Please indicate a ...
1
vote
0
answers
368
views
Swagger API doc from Lumen REST API
I have my API in lumen 8.* As my annotations are getting longer, I want to put all of them into a single or multiple yamls so that my codes get clean.
The package that I'm using is https://github.com/...
-1
votes
1
answer
976
views
How can i write this JSON swagger-php below with annotations?
I'm using OpenAPI 3.0 to document my Symfony API. this is the JSON code that authenticates the user to send requests:
"securitySchemes": {
"Bearer": {
"...
2
votes
0
answers
490
views
Specific api has some middlewares in swagger api
I'm writing API documentation for my application using Swagger 3.0. My application has some apis that include some middlewares. I want to describe that which api has the middlewares (like parameters ...
0
votes
2
answers
8k
views
How to combine a property and json response in Laravel + Swagger?
I have this a project that is using Laravel for the api and swagger for documentation
I have this method in my login controller:
/**
* Handle an incoming authentication request.
*
*
* @OA\Post(
...
1
vote
2
answers
2k
views
PHP Swagger OpenApi Generic Type
I'm using zircote/swagger-php for annotations to generate swagger for my php WebApi.
I have my generic model HttpResponse, it has 2 common properties (messages and statusCode) but data is generic and ...
0
votes
1
answer
494
views
Undefined class constant 'DUMP_OBJECT_AS_MAP'
I'm getting following errors when I run openapi command to generate swagger file.
Command
#vendor/bin/openapi api/modules/v3/controllers/AbcController.php swagger
Notice: Trying to access array ...
4
votes
8
answers
20k
views
Swagger - "Required @OA\Info() not found"
I just got into api documentation and tried to use Swagger
here is my php file with routes that I want to document:
<?php
use OpenApi\Annotations as OA;
/**
* @OA\Info(title="My First API&...
1
vote
2
answers
2k
views
l5-swagger/swagger-php - adding component to block makes it dissapear from the output
If I add this response to my definition:
@OA\Response(
response="default",
description="unexpected error",
@OA\JsonContent(ref="#/components/schemas/ErrorModel&...
0
votes
3
answers
8k
views
$ref "#/components/responses/" not found for @OA\Response(response=200)
I am trying to implement openAPI documentation in a Laravel project. I am using darkaonline/l5-swagger package, which is built on top of swagger-php to generate the documentation. I am facing a ...
5
votes
1
answer
4k
views
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": "[email protected]&...
1
vote
1
answer
1k
views
l5-swagger/swagger-php support for x-logo within the OpenAPI (3.0.1) in the @OA\Info block (for Laravel 8)
I am using l5-swagger and redocly to display API documentation for a Laravel 8 project.
Open API supports:
"x-logo": {
"url": "path_to_your_logo"
},
I have ...
1
vote
1
answer
1k
views
Laravel array validation in swagger
My form-data consists of an array 'items' which contains details like:
items[0][id]:1
items[0][amount]:50
items[1][id]:2
items[1][amount]:25
This is how it looks like in postman.
How can I write the ...
1
vote
1
answer
2k
views
Documenting multiple response possibilities with OpenApi annotation
I have an endpoint that can return either a single item or a list of items, depending on the parameters passed in (There's no flexibility in the endpoint currently, I am unable to make code changes).
...
0
votes
1
answer
1k
views
OpenApi Annotations causing double slash
I'm using zircote/swagger-php to generated API documentation based on OpenApi annotations that I have added to existing code.
For the most part it's working fine, but I've noticed one strange bit. I ...
2
votes
1
answer
4k
views
DarkaOnLine/l5-swagger Laravel Array Input Incorrect
I am trying to send an array using swagger. But when I check the array in inspect mode, I notice that the array being send is just a string and is not an array
/**
* @OA\Post(
* path="/...
0
votes
1
answer
876
views
How to set @SWG\Info annotation for only area in Symfony using NelmioApiDocBundle
/**
* @SWG\Swagger(
* @SWG\Info(
* title="My first swagger documented API",
* version="1.0.0"
* )
* )
*/
I tried to write this block in:
my base controller - ...
1
vote
1
answer
3k
views
openapi-generator-cli not generating documentation from PHP file
Background: I have installed composer installed zircote/swagger-php and have installed openapi-generator-cli with apt-get.
I am not sure whether or not I am attempting to use these tools correctly, ...
3
votes
0
answers
573
views
Doctrine OpenApi Swagger issue - The annotation "@OpenApi\Annotations\Schema" in class ... was never imported
I'm running into an issue with the Doctrine annotations used with the zircote/swagger-php library. We're doing some dependency upgrades and the Doctrine proxy generation is failing with the error:
...
5
votes
1
answer
2k
views
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 ...
0
votes
1
answer
1k
views
How do I format OpenApi in swagger-php so that the swagger-ui shows a form instead of an array?
I'm on a Laravel build, and updating notations for all my API controller methods from @SWG to @OA. When I hit 'try it out' in the swagger-ui on a create method, I'm able to get it to show (and accept)...
1
vote
0
answers
709
views
How to generate swagger api-docs.json in php/laravel for multiple endpoints on same controller
All my api endpoints are pointed to same controller and have difference responses
e.g. /api/tags, /api/currencies, /api/countries are pointing to one BaseController
Should I write swagger annotations ...
1
vote
1
answer
814
views
Generic output schema with one variable difference
Quick question, im working with swagger-php to annotate my API. The output of the API always has the same basic structure and is being used over several endpoints:
[
{
"status": "...
2
votes
1
answer
1k
views
Indexed array in query
I am struggling to write a parameter annotation for a field that would have to result as indexed array of integers:
voucher_products[0]: 23
voucher_products[1]: 102
voucher_products[2]: 233
I tried ...
0
votes
0
answers
559
views
Swagger annotation error 500 in php laravel 5
* @SWG\Get(
* path="/settings",
* tags={"Settings"},
* operationId="settingsindex",
* summary="Get settings.",
* @SWG\Response(...
2
votes
1
answer
1k
views
Laravel Swagger getting [Syntax Error] Expected Value, got '@'
I have written Swagger Annotations for a function in a Controller and I am getting error while generating swagger-ui code. Following is my code for annotation
/*** End of Annotation For deleteNote ***/...
2
votes
1
answer
4k
views
Open API/Swagger Symfony Annotations? [closed]
I'm trying to setup Open API 2 (fka swagger) using swagger-php but i haven't been able to find an example of a implementation using annotations with
Content-Type: application/x-www-form-urlencoded
...
3
votes
2
answers
27k
views
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 ...
1
vote
2
answers
2k
views
Laravel Swagger PHP Couldn't find constant array
darkaonline/l5-swagger: 8.0.2
PHP Version: 7.3.13
zircote/swagger-php: 3.1.0
OS: Windows
I created a Contract ref object.
Now in my ContractController I want to list an array of contracts.
How can I ...
0
votes
1
answer
532
views
Swagger Documentation - How can i get only values separated by a comma in the json request body?
In my case, for a DELETE operation, i will have to pass a body which looks like below.
Request body should look like:
[
"Vi####1",
"Vi####2"
]
But when i tried to achieve this, ...
0
votes
1
answer
3k
views
Date type and format swagger in laravel
i am using swagger documentation to chow api data, i one of my case i want to get data from database by a specific date, get a day by a $day variable i use a method and working fine in Postman
in ...
0
votes
0
answers
318
views
Adding Date parametre in swagger documentation (laravel)
I want get data with specific date (timestamp) in database, i use this method and everything fine !
Method:
public function getdatabyday() {
$p = "zero";
$day = date('Y-m-d ', strtotime($...
1
vote
1
answer
2k
views
NelmioApiDocBundle v4.0.0-BETA1, $ref not found
I have a DTO like this:
# AppBundle\DTO
/**
* @OA\Schema(
* schema="ProductDto",
* type="object",
* required={
* "foo",
* "...