blueprint icon indicating copy to clipboard operation
blueprint copied to clipboard

Default to plural api route naming, with config to allow plural or singular

Open benjam-es opened this issue 3 years ago • 8 comments

Fixes #480

Issue created requiring plural api resource slugs. Hopefully this covers the issue as you requested @pktharindu?

This implementation seems very simple, so there may be more needed, so happy to take any pointers @jasonmccreary or @pktharindu

benjam-es avatar Feb 11 '22 14:02 benjam-es

It really depends on how deep the developer feels the plural should go: route? controller name? view folder name? etc...

In this end, this is one developers opinion. As such, it's unlikely I would merge this without some consensus.

jasonmccreary avatar Feb 11 '22 14:02 jasonmccreary

My reading of issue #480 is that he is referencing the widely used (opinions vary) api resource naming convention using plural naming. So in this instance, I think it stands alone, and the pull request meets that one request only (with added config so its not strictly enforced).

benjam-es avatar Feb 11 '22 17:02 benjam-es

While I have seen devs use both plural and singular resource routes, I believe the plural form is more common and is in accordance with Laravel docs and REST naming conventions.

The only other thing I usually pluralize is the view folder name. But I'm not sure what the norm is in that regard. So I agree with Jason that we need some consensus.

pktharindu avatar Feb 12 '22 05:02 pktharindu

I think the option for routes is good. It's really a matter if we want to also pluralize the views folder.

jasonmccreary avatar Feb 12 '22 12:02 jasonmccreary

I think @pktharindu's raised issue (#480) offers a better sensible default for api resources, so think the pull request has merit for that reason.

I'm happy to amend or delete if needed.

benjam-es avatar Feb 12 '22 14:02 benjam-es

Agreed. I will merge this as-is. However, trying to ask if either of you feel we should pluralize the views folder when this option is enabled?

jasonmccreary avatar Feb 12 '22 14:02 jasonmccreary

View folders are usually named after the routes, which makes them easier to find IMHO. Package like spatie/laravel-route-discovery seems to follow the same convention. So, I think it is a sensible thing to do so. What do you guys think?

pktharindu avatar Feb 13 '22 03:02 pktharindu

Yes views folder no controller

dillingham avatar May 06 '22 12:05 dillingham

Yes pls merge this, it's the only reason I'm unable to use this package. It's great what this package has to offer but forcing singular is a big entry barrier for me as all my projects follow the plural naming conventions for routes(including web routes) and view folders.

dalpat avatar Sep 23 '22 11:09 dalpat

I'm going to be working on Blueprint in my live streams during the month of October. I will start with this.

jasonmccreary avatar Sep 23 '22 11:09 jasonmccreary

That would be wonderful.

dalpat avatar Sep 23 '22 12:09 dalpat

I'm going to be working on Blueprint in my live streams during the month of October. I will start with this.

Nice, subscribed :muscle:

spekulatius avatar Sep 23 '22 12:09 spekulatius

Given the age, I am closing. However, I have used this work to create #574.

jasonmccreary avatar Oct 05 '22 17:10 jasonmccreary