-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[docs] Add basic rules for routes #1245
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for moodledevdocs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
b5ef1b6
to
2354ce5
Compare
⚡️ Lighthouse report for the deploy preview of this PR
|
2354ce5
to
22aeb3f
Compare
|
||
:::tip Singular or Plural | ||
|
||
Where present, entities should always be in the plural form. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree regarding plural form. Should examples for course entity be changed accordingly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to strictly follow the subsystems names here.
However, in the example of course, /courses/<courseid>/view
sounds not correct, as you are only going to ever look at a singular course. So I think in this case singular is the way to go.
Not sure how we make the docs clearer though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the moment the component resolution is automatic based on the location of the class and we automatically normalise it.
If we want to do something different then we'll have to work out the best way of doing so and in which situations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, in the example of course,
/courses/<courseid>/view
sounds not correct, as you are only going to ever look at a singular course. So I think in this case singular is the way to go.
Yeah, it is sounds not correct in individual scenario, unless one see it as query "select <courseid>
from courses". Thinking in broader context, what will be the endpoint for querying list of courses? Different /courses
path or /course/list
action? Something better to consider while we are at early stage I guess :)
With regard to this "tip", to avoid contradition for now we might say "Where possible, entities should be in the plural form."
PS In Martin Fowler's REST maturity model article all entities are plural (Level 1 onwards).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Andrew's point is a good one that resolution is based on automatic resolution. Messing around with that feels like it may add more complexity than it's worth.
Also, thanks for the extract context Ruslan
The issue with the course entity is that it is the name of the subsystem
itself. I’m not sure how we would pluralise a subsystem name
|
This is an initial set of rules for routes.
I've tried to keep things relatively simple but I may have dumbed it down too much.