Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2640
Closed
Open
Issue created Apr 10, 2019 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG] PHPSlim Auth middleware TypeError

Created by: ybelenko

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

Current generator requires AbstractAuthenticator user implementation when schema contains security definitions. When implementation class is provided app throws TypeError.

openapi-generator version

4.0.0-SNAPSHOT

OpenAPI declaration file content or url

Any spec file file with secured endpoints can reproduce the bug. https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml

Command line used for generation
bin/php-slim-server-petstore.sh
Steps to reproduce
  1. Generate server stubs with any spec file with secured endpoints
  2. Make HTTP request to any secured endpoint
  3. App throws Exception with message
How about extending AbstractAuthenticator class by OpenAPIServer\\Auth\\OAuthAuthenticator?
  1. Overwrite AbstractAuthenticator with your own OAuthAuthenticator class.
  2. Generate new Composer autoload with composer dump-autoload
  3. Make the same HTTP request to any secured endpoint.
  4. App throws error
[10-Apr-2019 17:42:41 UTC] PHP Fatal error:  Uncaught TypeError: Argument 1 passed to OpenAPIServer\Auth\AbstractAuthenticator::__construct() 
must implement interface Psr\Container\ContainerInterface, array given, called in 
/Applications/MAMP/htdocs/openapi-generator/samples/server/petstore/php-slim/lib/SlimRouter.php on line 650 and defined in 
/Applications/MAMP/htdocs/openapi-generator/samples/server/petstore/php-slim/lib/Auth/AbstractAuthenticator.php:70
Suggest a fix

Will fix it myself.

Assignee
Assign to
Time tracking