Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

andrewnicols
Copy link
Member

@andrewnicols andrewnicols commented Jan 29, 2025

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.

Copy link

netlify bot commented Jan 29, 2025

Deploy Preview for moodledevdocs ready!

Name Link
🔨 Latest commit 22aeb3f
🔍 Latest deploy log https://app.netlify.com/sites/moodledevdocs/deploys/679a18a442cb330008282159
😎 Deploy Preview https://deploy-preview-1245--moodledevdocs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Contributor

github-actions bot commented Jan 29, 2025

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🔴 33 🟢 95 🟢 100 🟢 90 🟢 100 Report
/docs/5.0/apis/commonfiles 🟠 53 🟢 93 🟢 100 🟢 100 🟢 100 Report
/general/development/gettingstarted 🟠 55 🟢 95 🟢 100 🟢 90 🟢 100 Report
/general/releases 🟠 65 🟢 95 🟢 100 🟢 100 🟢 100 Report

@kabalin
Copy link
Collaborator

kabalin commented Jan 29, 2025


:::tip Singular or Plural

Where present, entities should always be in the plural form.
Copy link
Collaborator

@kabalin kabalin Jan 29, 2025

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?

Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

@kabalin kabalin Jan 30, 2025

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).

Copy link
Collaborator

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

@andrewnicols
Copy link
Member Author

andrewnicols commented Jan 29, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants