Code Monkey home page Code Monkey logo

Comments (4)

cnizzardini avatar cnizzardini commented on July 24, 2024 1

Looks like this needs to be cleaned up: https://github.com/cnizzardini/cakephp-swagger-bake/blob/master/src/Lib/Operation/ExceptionResponse.php#L73

from cakephp-swagger-bake.

jamisonbryant avatar jamisonbryant commented on July 24, 2024

By reading the stack trace closer I think I have uncovered the problem.

When the OpenApiPathGenerator scans the controller docblock for my PagesController it picks up the several @throws annotations that are put there by default:

/**
 * Displays a view
 *
 * @param string ...$path Path segments.
 *
 * @return \Cake\Http\Response|null
 * @throws \Cake\Http\Exception\ForbiddenException When a directory traversal attempt.
 * @throws \Cake\View\Exception\MissingTemplateException When the view file could not
 *   be found and in debug mode.
 * @throws \Cake\Http\Exception\NotFoundException When the view file could not
 *   be found and not in debug mode.
 * @throws \Cake\View\Exception\MissingTemplateException In debug mode.
 */
#[Route('/pages/*', 'pages:display', resource: false)]
public function display(string ...$path): ?Response
{ ... }

I'm guessing the path scanner tries to instantiate these exceptions as objects, which it cannot do for the MissingTemplateException because it doesn't have the required parameter, thus the crash.

Indeed, if I comment out the @throws lines (there are two) for the MTE the crash disappears.

from cakephp-swagger-bake.

cnizzardini avatar cnizzardini commented on July 24, 2024

I will run a manual test before doing a release on this, but probably not today.

from cakephp-swagger-bake.

cnizzardini avatar cnizzardini commented on July 24, 2024

https://github.com/cnizzardini/cakephp-swagger-bake/releases/tag/v2.5.7

from cakephp-swagger-bake.

Related Issues (20)

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.