feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
15.07k stars 752 forks source link

CLI(typebox): Type Singular name #2877

Closed fratzinger closed 1 year ago

fratzinger commented 1 year ago

See the two typebox schemas generated by the cli. On the left, it's a 'custom' messages service that I created with feathers g service. On the right it's the default users service that got created by feathers g app:

image

See the difference between the namings. In almost every variable name it's plural (left) vs. singular (right):

We should make it singular by default, right? Popular solutions:

daffl commented 1 year ago

I've been trying to leave the naming to the end user. In this case if you pick message as the name and messages as the path then the naming would be the way you expect (see e.g. the generating service section in the guide).

Generating messages

fratzinger commented 1 year ago

Ok, I oversaw that 🤦‍♂️

But in services/index.ts i would have expected the plural version:

export const services = (app: Application) => {
  app.configure(messages)
  app.configure(user)
  // All services will be registered here
}

At least that was my understanding of feathers v4:

What do you think about that?

So in my head (and I remember it was the case in the old cli) the serviceName is like the servicePath with camelCase and stripped /v1/sub/....

Don't get me wrong, this is such a tiny detail which anyone can easily change. But I think it's worth to think about the convention.

What do you think about adding another question? For example:

What is the name of the model?

fratzinger commented 1 year ago

Next question: naming-convention for the services folder and containing files? It's users by default. I would have expect it to match the 'name of the service'.