question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`path-segment-plural` built in rule

See original GitHub issue

Is your feature request related to a problem? Please describe.

Path items are often named in the plural: /customers.

Describe the solution you’d like

lint:
  rules:
     path-segment-plural: error

Path items are often named in the plural: /customers.

This should ignore path parameters and take the segment prior if the path parameter is there… example:

Path items: /customers/{customerId}… the rule should identify there is a path parameter and remove the /{customerId} from that before evaluating if it is plural (ends in an s).

Describe alternatives you’ve considered

It is similar to #394. It could be path-includes-pattern?

Additional context none

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
RomanHotsiycommented, Oct 21, 2021

Yes, I feel like this is still a valid use-case way to often, e.g.

While it could be refactored to PUT /invoice-abandonments or PUT invoice-payments I believe it would make API worse.

This is a completely different discussion though not related to the rule itself.

@andriyl making sure you see the updates here ^.

1reaction
adamaltmancommented, Oct 21, 2021

That’s very good. (Although that example is still a violation in my view… this happens with command-like APIs which are generally avoided.)

Read more comments on GitHub >

github_iconTop Results From Across the Web

`path-segment-plural` built in rule · Issue #395 - GitHub
Path items are often named in the plural: /customers . This should ignore path parameters and take the segment prior if the path...
Read more >
path-segment-plural - Redocly
RESTful API design often uses resources in path segments and those resources are typically plural. For example, "customers" instead of ...
Read more >
Intl.PluralRules - JavaScript - MDN Web Docs
Chrome Edge PluralRules Full support. Chrome63. Toggle history Full support. Edge18. Tog... PluralRules() constructor Full support. Chrome63. Toggle history Full support. Edge18. Tog... resolvedOptions Full support....
Read more >
PluralRules (ICU4J 72.1)
Rules are constructed from a text description, consisting of a series of keywords and ... Parses a plural rules description and returns a...
Read more >
Plural forms (GNU gettext utilities)
Once again people fell into the trap of believing the rules their language is using are universal. ... The form how plural forms...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found