Giter VIP home page Giter VIP logo

Comments (5)

khrt avatar khrt commented on August 22, 2024

Could you show full example, please.

Because both of them right. It depends how you call it.

For instance:

resource subres => sub { ... }

and

desc 'subres desc',
resource => 'subres' => sub { ... }

from raisin.

chrisv avatar chrisv commented on August 22, 2024

I have 1 pm mounting 4 other pm's. I implemented only your below example, because when I use the top one then I get the afore-mentioned errors.

# /person
desc 'person-related methods',
resource => person => sub { .. 

    # /person/<id>
    route_param id => Int,
    sub {
        # get person 
        desc "Show a person's data",
    ...

    };
};

I didn't realize both were possible; I'll check the docs again ;-) Thanks.

from raisin.

khrt avatar khrt commented on August 22, 2024

Maybe you could give me an advice?

Is current syntax clear for you?
Maybe it would be better if I changed the syntax, where all keywords would be act as a separate subroutine?

For instance:

desc 'some action';
params required => { name => 'somename', type => Int }, optional => { name => 'optname', type => Str };
get sub {
  ...
};

Or it will be better to leave as it is?

from raisin.

chrisv avatar chrisv commented on August 22, 2024

Thanks for your feedback and checking with me.

My take on this is that unless there's a clear reason (and description) why there are 2 different notations (and when & how to use them), it might indeed be better to use only 1 consistent notation that does not allow for any guesswork.

Also, at least in my experience, too many different ways of allowing definitions and/or too much aliasing to remain backwards compatible almost invariably end up being a maintenance and testing nightmare.

You'll have to decide eventually (because there is always a risk that by refactoring this, existing (albeit only a few weeks' or months' old) code could break), but I for one will be sticking with only 1 notation, like my earlier example, as it makes the raisin parser behave as I would expect.

Thanks again for the great work on Raisin. Very much appreciated!

Best,
Chris.

from raisin.

khrt avatar khrt commented on August 22, 2024

You can use Raisin::API '-old' for your old API.

from raisin.

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.