Giter VIP home page Giter VIP logo

Comments (4)

erunion avatar erunion commented on May 26, 2024

I think there are a few options we can do:

  • Add a methods attribute to the <class> element for controllers in mill.xml, that takes a comma separated list of methods.
    • Pros
      • Makes it very clear what methods of your controllers are being documented.
    • Cons
      • Config file will become incredibly large, and unwieldy with tens, to hundreds of <class> entries.
      • This would break the <directory> element for specifying a directory of controllers to scan.
  • Look at all the pubic methods that exist on the controller
    • Pros
      • No configuration changes needed or required for this to work
    • Cons
      • Will make documentation validation a little trickier as right now Mill throws errors if a resource action is undocumented. So we could make it that if there is no @api-uri on the public method that it's looking at, it'll just ignore it completely. Downside to that, though, is that if you ever forget to add that annotation, that action isn't going to be in your documentation.

In any case, we'd need to add a new, required, @api-method annotation for documenting the REST method that that action is supported on. Unclear if we'd allow multiple of those on a single action.

from mill.

erunion avatar erunion commented on May 26, 2024

Another option we can do is support regex on methods annotations. So if you don't support GET, PATCH, etc. but at least have a common format for your controller methods, that might work.

<directory name="controllers/" suffix=".php" methods="^get(.+)" />
<class name="\MyApplication\Some\Controller" methods="^handle(.+)" />

It's not horrible.

from mill.

erunion avatar erunion commented on May 26, 2024

Along with the config change necessary to handle this, we'll also need to update the @api-uri annotation to support supplying an HTTP method, since that method will no longer be obtained by the class method.

Maybe:

@api-uri:visibility {Movies} GET:/movies

from mill.

erunion avatar erunion commented on May 26, 2024

The new plan is to introduce an @api-method annotation that'll solve all of these problems automatically.

from mill.

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.