Code Monkey home page Code Monkey logo

swaggerlume's People

Contributors

adreece avatar arep avatar cocochepeau avatar darkaonline avatar davidmoraisferreira avatar jbreuer95 avatar jvleeuwen avatar liambull avatar lloricode avatar mglinski avatar momodedf avatar nathanejohnson avatar rafayelarzumanyan avatar stcktrce avatar stylecibot avatar xwiz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

swaggerlume's Issues

Support Lumen 5.5

$this->app->group can no longer be used, use app->route->.. instead

No UI

image
I didn't change config.

http://localhost:8080/docs - is works.

API_KEY_VAR no longer used?

I've just upgraded to 1.0.1 and the config setting

'key_var' => env('API_KEY_VAR', 'token'),

is no longer being used.

I found this commit that removed the references to apiKeyVar from index.blade.php.

Is there any other way to set a custom api_key var?

lumen5.5 api/documentation show nothing

HI,bro, I use lumen5.5 , this is my code:

/**

  • @swg\Swagger(
  • schemes={"http","https"},
    
  • host="api.host.com",
    
  • basePath="/",
    
  • @SWG\Info(
    
  •     version="1.0.0",
    
  •     title="This is my website cool API",
    
  •     description="Api description...",
    
  •     termsOfService="",
    
  •     @SWG\Contact(
    
  •     ),
    
  •     @SWG\License(
    
  •         name="Private License",
    
  •         url="URL to the license"
    
  •     )
    
  • ),
    
  • @SWG\ExternalDocumentation(
    
  •     description="Find out more about my website",
    
  •     url="http..."
    
  • )
    
  • )
    */

class LessionController extends Controller
{
/**
* @swg\Get(
* path="/Controller/LessionController/{customerId}/rate",
* summary="List customer rates",
* operationId="getCustomerRates",
* @swg\Parameter(
* name="customerId",
* in="path",
* description="Target customer.",
* required=true,
* type="integer"
* ),
* @swg\Parameter(
* name="filter",
* in="query",
* description="Filter results based on query string value.",
* required=false,
* enum={"active", "expired", "scheduled"},
* type="string"
* ),
* @swg\Response(response=200, description="successful operation"),
* @swg\Response(response=406, description="not acceptable"),
* @swg\Response(response=500, description="internal server error")
* )
*
*/
public function index() {
return [
'apple',
'orgran',
'banana',
];
}
}

I haved run command "php artisan swagger-lume:generate” it no error output
but http://xxxx/api/documentation show nothing

php artisan swagger-lume:publish overrides config - ReadMe invalid...

When following the installation at a certain point the following is said - added numbers for easier reference:

- (1) Run `php artisan swagger-lume:publish-config` to publish configs (`config/swagger-lume.php`)
- (2) Make configuration changes if needed
- (3) Run `php artisan swagger-lume:publish` to publish everything

But when you do exactly as said, after step 3 - all your configuration changes made in step 2 are reset.
Is this intended to happen or aren't these actual steps?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Unable to add headers

Hi,
I suppose to use basic for my application , Here is my code

basicAuth=  "Basic " + btoa("admin:admin");
swaggerUi.api.clientAuthorizations.add("key", new SwaggerClient.ApiKeyAuthorization("Authorization", basicAuth, "header"));

it is not adding to request headers. Here is the screen shot
basic auth

How to view swagger doc using command

Currently I am copy pasting the json to swagger editor to display it.

I am expecting something like php artisan swagger-lume:view to view the swagger doc.
Is this function available? or i just miss it cause i don't see any in documentation.

swagger interface doesn't redirect from http to https

I'm on AWS Elastic BeanStalk with servers behind a load balancer. On lumen I have set it so that all http traffic is forwarded to https traffic.

However when I try to access /api/documentation via HTTPS swagger tried to pull the doc data from HTTP and I get the following error:

Can't read from server. It may not have the appropriate access-control-origin settings.

It's a minor issue since I have just manually fix http to https in the input field but a little annoying nonetheless.

I've tried adding

"view" => [
            'Access-Control-Allow-Origin' => env('APP_URL')
        ]

but no effect.

Is there a workaround for this?

SwaggerUI is outdated

Hey, thanks a lot for your package, I'm using it to document my API written in Lumen (doh!).

I was wondering if it makes a big issue to update SwaggerUI to latest version? The current UI used in the package is almost a year old.

Because I need basic auth functionality I actually stopped using built-in UI and only using the package to generate the schema to be inserted in latest UI available on petstore... domain. That's quite sad as I need to instruct all api consumers here on how to actually load the api so they can test endpoints against specific authenticated user. And I want them to be just using swagger ui on our own domain with our schema loaded automatically.
It's not just that, current UI used also contains a lot of other bugs. For example, tooltips on models are broken which makes it very difficult to read tooltips.

Let me know if you have any plans to update the UI.
Thanks!

Views path returning NULL on publish call

I might be missing appropriate configuration but I was trying to experiment this project by following the readme. I was able to publish the config but when I try to publish all or publish views from the console I get

[ErrorException]       
  mkdir(): Invalid path

debugging I got to this call sending NULL destinationPath
https://github.com/DarkaOnLine/SwaggerLume/blob/master/src/Console/PublishViewsCommand.php#L35
this config('swagger-lume.paths.views') returns NULL

Can you point me to anything wrong that I'm doing or is this just a bug ?


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

I want to use another db for swagger documentation

Hello,
I want to use another db instance for swagger documentation because if we use same db instance on production. there is fear of changes which can be made anyone who is using documentation. So different db for application and another one for documentation. How it can be done using swagger-lume???


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

zircote package updation for open api

Hello Dear,
Zircote package has been updated for open api annotations. Please update swagger lume as well. I am getting error that swagger/scan function does not exit.
Thanks

Please provide to work with openapi 3 lumen 5.5

We have successfully integrated package (composer require "darkaonline/swagger-lume:5.5.*" ) with lumen 5.5 and swagger document generated successfully..

Now I want to integrate Open API 3.. please provide detail step by step to do it...

[INFO] Required @OAS\Info() not found

debug output:

[cosnis@m ~/Workspace]$ php artisan swagger-lume:generate
Regenerating docs
Swagger\Analysis {#288
+annotations: SplObjectStorage {#289
storage: array:1 [
"00000000324d6201000000001c85c54c" => array:2 [
"object" => Swagger\Annotations\OpenApi {#316
+openapi: "3.0.0"
+info: null <--- always throw error with this
+servers: null
+paths: []
+components: null
+security: null
+tags: null
+externalDocs: null
+_analysis: Swagger\Analysis {#288}
+x: null
+_context: Swagger\Context {#344
+"-": ""
}
+_unmerged: []
}
"info" => Swagger\Context {#344}
]
]
}

===

real output:

[cosnis@m ~/Workspace/]$ php artisan swagger-lume:generate
Regenerating docs

In Logger.php line 38:

Required @oas\Info() not found

[cosnis@m ~/Workspace/]$

i search on google, but only show what about SWG\Info(), not OAS\Info ....

SwaggerUIBundle is not defined

When I try to navigate to api/documentation response SwaggerUIBundle is not defined. In the code, SwaggerUIBundle make reference to swagger-ui/dist/swagger-ui-bundle.js, but I don't know why response SwaggerUIBundle is not defined.

php artisan swagger-lume:generate "No operations defined in spec!"

When i run the following command
php artisan swagger-lume:generate
and i see "No operations defined in spec!" on http://localhost/api/v1/documentation

Here is my base controller

namespace App\Http\Controllers;

use Laravel\Lumen\Routing\Controller as BaseController;
use Illuminate\Http\Request;

class Controller extends BaseController
{}

/**
 * @SWG\Swagger(
 *     basePath=L5_SWAGGER_CONST_BASE_PATH,
 *     schemes={"http", "https"},
 *     host=L5_SWAGGER_CONST_HOST,
 *     @SWG\Info(
 *         version="1.0.0",
 *         title="L5 Swagger API",
 *         @SWG\Contact(
 *             email="[email protected]"
 *         ),
 *     )
 * )
 */
/**
 * @SWG\Tag(
 *     name="users",
 *     description="Operations about user",
 *     @SWG\ExternalDocumentation(
 *         description="Find out more about store",
 *         url="http://swagger.io"
 *     )
 * )
 */
/**
 * @SWG\SecurityScheme(
 *   securityDefinition="api_key",
 *   type="apiKey",
 *   in="query",
 *   name="api_key"
 * )
 */
/**
 * @SWG\SecurityScheme(
 *   securityDefinition="X-Api-Token",
 *   type="apiKey",
 *   in="header",
 *   name="X-Api-Token"
 * )
 */

This is my user controller login function

/**
     * Handle a login request to the application.
     *
     * @SWG\Post(path="/login",
     *   tags={"User actions"},
     *   summary="Perform user sign in",
     *   description="login user using request data",
     *   produces={"application/json"},
     *   consumes={"application/json"},
     *     @SWG\Parameter(
     *     in="body",
     *     name="login user",
     *     description="JSON Object which login user",
     *     required=true,
     *     @SWG\Schema(
     *         type="object",
     *         @SWG\Property(property="email", type="string", example="[email protected]"),
     *         @SWG\Property(property="password", type="string", example="password"),
     *     )
     *   ),
     *   @SWG\Response(response="200", description="Return token or error message")
     * )
     *
     * @param Request $request
     *
     * @return Response
     */
public function login(Request $request){}

routes not working

I installed "darkaonline/swagger-lume": "5.5.*"
The json is generated as well as config file and view but routes are not working:
/api, /docs

How to create a view of the JSON generated ?

After a lot of searching I was able to get a JSON which when I put in the online swagger editor produce a UI but how to automatically generate a UI component as when I define a route for the swaggers index.php like this
$app->get('/api', function () { return view('vendor.swagger-lume.index'); });
file I get a lot errors like this

(2/2) ErrorExceptionUndefined variable: urlToDocs (View: E:\xampp\htdocs\api\resources\views\vendor\swagger-lume\index.blade.php)
--

I know this is not the exact way but the lack of complete documentation is giving a very hard time.So can you please explain this part how to render the vendor/swagger-lume/index.php

Here is what happens if I try to give the path referred in the config/swagger-lume.php file.

swagger-bug

And of I visit api/documentation here is the error I get

swagger-doc-error

How to change swagger version from 2.0 to 3.0 ?

Hello,

First of all thanks for great work on SwaggerLume

I am trying to use type='object' in @SWG\Parameter( and found that type='object' in not working in swagger 2.0 so i want to change from 2.0 to 3.0.

i am trying to implement following definition

* @SWG\Parameter(
 *   name="body",
 *   in="body",
 *   description="cart data",
 *   required=true,
 *   @SWG\Schema(
 *       type="object",
 *       @SWG\Property(
 *         property="cart",
 *         type="array",
 *         @SWG\Items(
 *           type="object",
 *           @SWG\Property(property="product_id", type="integer"),
 *           @SWG\Property(property="amount", type="integer")
 *         )
 *       )
 *     )
 *   )
 * ),

what are the steps to change swagger version ? i am using 2.0

Unable to generate HTML output

Hi @DarkaOnLine ,
I did the same as per the documentation but I needed HTML output, so that I can share that URL to anyone.

Please suggest me how to convert that JSON response to HTML output.

Thanks.

Docker help @OpenApi\Annotations\OpenAPI

I've got a lumen running in a docker container and everything seems to work fine except SwaggerLume - for some reason I'm getting the following error and I don't know why - when running in the development version of de image it works but that one doesn't have the app build into it
The annotation "@OpenApi\Annotations\OpenAPI" in /var/www/app/Annotations/Info.php on line 2 does not exist, or could not be auto-loaded

REF: zircote/swagger-php#660

question: handle multiple API versions

Hi,

How could I handle multiple definitions for my API versions like v1, v2, v3... ?

I'm using different namespaces inside Lumen for each API version, the generation command try to scan everything.. is it not possible generate the definitions based on a folder?

something like:
php artisan swagger-lume:generate ApiV1
php artisan swagger-lume:generate ApiV2


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

SwaggerLume latest version.

Hi, i am trying to use SwaggerLume in the latest version of Lumen and i got this message.

$ php artisan swagger-lume:publish-config

PHP Fatal error:  Call to undefined method Laravel\Lumen\Application::share() in
 C:\xxyy\vendor\darkaonline\swagger-lume\src\ServiceProvider.php on line 46

  [Symfony\Component\Debug\Exception\FatalErrorException]
  Call to undefined method Laravel\Lumen\Application::share()

Next the composer require:

...
	"require" : {
		"php" : ">=5.6.4",
		"laravel/lumen-framework" : "5.4.*",
		"vlucas/phpdotenv" : "~2.2",
		"darkaonline/swagger-lume" : "1.*"
	},
...

Is there any error on my configuration? or the library does not support the latest version of Lumen.

Thanks and best regards.

Publishing configuration reset it!

When i try to publish configuration file by this code
php artisan swagger-lume:publish-config
it reset swagger-lume.php in config folder
i have add this code to header in swagger-lume.php

        "request" => [
    'APP_VERSION' => '4.0'
    ],

but after run php artisan swagger-lume:publish-config
it become

        /*"request" => [
    'TestMe' => 'testValue'
    ],*/

SwaggerUI v3?

Just wondering if its possible to update to swagger ui v3, as I would like to make use of the Authorization aspect.

Unable to create Model from Model Classes

As you know Laravel and Lumen models doesn't have variables from DB Model. We are only defining the table, but not the fields in table.

I need to use this kind of definition for each field, but I don't have fields.

/**
 * @var string
 * @SWG\Property()
 */

How can I generate User model without fields?

Here is my simple User Model

<?php

namespace App\Models;

use Illuminate\Auth\Authenticatable;
use Laravel\Lumen\Auth\Authorizable;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @SWG\Definition(definition="User", type="object", required={"name"})
 */
class User extends Model implements AuthenticatableContract, AuthorizableContract
{
    use Authenticatable, Authorizable, SoftDeletes;

    protected $table='user';
    
    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [
        'name', 'surname', 'email',
    ];

    /**
     * The attributes excluded from the model's JSON form.
     *
     * @var array
     */
    protected $hidden = [
        'password',
    ];
}

Unable to make the Asset controller working with version ~3.0

Installed packages :
"php": ">=5.6.4",
"laravel/lumen-framework": "5.4.",
"vlucas/phpdotenv": "2.4.0",
"illuminate/redis": "5.4.
",
"palanik/lumen-cors": "dev-master",
"giggsey/libphonenumber-for-php": "^8.8",
"darkaonline/swagger-lume": "~3.0"

withFacades is active, Service provider is registered, swaggerlume is configured in bootstrap.
All seems working except the controller with assets :
http://localhost:8000/swagger-ui-assets/swagger-ui.css return a templated page with :
The requested resource /swagger-ui-assets/swagger-ui.css was not found on this server.
Same thing with js files.

Question about using constants in Swagger annotation

Hi,

Your package is fantastic, I'm currently using it to document a Lumen-driven API. Quick question, I'd like to dynamically define the host value in @SWG\Swagger. The swagger-php documentation mentions this is possible by first defining a constant:

https://github.com/zircote/swagger-php/blob/master/docs/Getting-started.md#using-variables-in-annotations

However to do so the documentation mentions passing along a constants.php file. Is there some way to dynamically update annotations using SwaggerLume?

Thank you!

Issue when auth_token config had value

Hi guys,

1- REPORT ERROR:

I use your library and apprance issue:

'auth_token' config default value is 'false'. But I want to default value isn't false => Error javascript in index.blade.php

  • File: /resources/views/vender/swagger-lume/index.blade.php
  • Line: window.swaggerUi.api.clientAuthorizations.add("{{$apiKeyVar}}", apiKeyAuth);
  • Description error: documentation:86 Uncaught TypeError: Cannot read property 'clientAuthorizations' of null
  • Because: window.swaggerUi don't loaded
  • Fix: Move window.swaggerUi.load(); before function addApiKeyAuthorization(). Cause: first window.swaggerUi, second call function addApiKeyAuthorization()

2- FEEDBACK FEATURE
I use oauth2, normal key will add prefix (BEAERER, BASIC....)

Update:

  • Add 'key_prefix' in file config
  • Get 'key_prefix' in file route to send view
  • Add 'key_prefix' before key in file index.blade.php

if(key && key.trim() != "") { var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("{{$apiKeyVar}}",{{$apiPrefixKeyVar}} + key, "{{$apiKeyInject}}"); window.swaggerUi.api.clientAuthorizations.add("{{$apiKeyVar}}", apiKeyAuth); }

Thanks

field schema is required

Hi,

when i try to generate the docs I get the exception

  [ErrorException]                                                             
  Field "schema" is required when @SWG\Parameter(name="body",in="body") is in  
   "body" in \App\Http\Controllers\AccessLogController->create_login_log() in  
   /Users/dev/Documents/others/winkerapp-api/app/Http/Controllers/AccessLogCo  
  ntroller.php on line 30 


/**
     * @SWG\Post(
     *     path="/api/access/login",
     *     consumes={"application/json"},
     *     description="Create a loggin log",
     *     operationId="logloggin",
     *     @SWG\Parameter(
     *         description="user id",
     *         in="body",
     *         name="user_id",
     *         required=true,
     *         type="integer"
     *     ),
     *     @SWG\Response(
     *         response="200",
     *         description="successful operation",
     *         @SWG\Schema(ref="#/definitions/AccessLog")
     *     ),
     *     summary="register a loggin log",
     *     tags={
     *         "log"
     *     }
     * )
     * */

error in the swagger lume

Hello,

[Tue Jul 24 17:44:39 2018] ::1:57133 [200]: /api/documentation [Tue Jul 24 17:44:39 2018] ::1:57136 [404]: /swagger-ui-assets/swagger-ui.css?v=5a547f5645edb0cf963a796f34eed06b - No such file or directory [Tue Jul 24 17:44:39 2018] ::1:57137 [404]: /swagger-ui-assets/swagger-ui-bundle.js?v=3d68d211488eba1178503308e70caabc - No such file or directory [Tue Jul 24 17:44:39 2018] ::1:57138 [404]: /swagger-ui-assets/swagger-ui-standalone-preset.js?v=c30a2a12a47f2c4ca81b3cb7076a31bf - No such file or directory [Tue Jul 24 17:44:39 2018] ::1:57139 [404]: /swagger-ui-assets/swagger-ui-standalone-preset.js?v=c30a2a12a47f2c4ca81b3cb7076a31bf - No such file or directory
when i try to access to api/documentation
i get in the console this error i sent

i use Lumen (5.6.4) (Laravel Components 5.6.*)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Required @SWG\Info() not found

Hi,
Thank you for this package.
I follow all steps and , when I run (php artisan swagger-lume:generate) the terminal return error:
Required @swg\Info() not found
Can you please give me an example how to solve this?!! and where I should put the @swg\Info() ?

Update README/composer

Hi, great package! Thanks a lot for publishing it.

One thing I've noticed about the README:

composer require "darkaonline/swagger-lume ~1.0" throws the error:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - The requested package darkaonline/swagger-lume could not be found in any version, there may be a typo in the package name.

Using dev-master it works:
composer require darkaonline/swagger-lume:dev-master

Might be worth mentioning that in the README file or create a 1.0 version so the mentioned command line would work.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.