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

[REST-compliance] Create a test to be sure APIs are REST compliant #1284

Closed
hdurix opened this issue Apr 8, 2022 · 5 comments
Closed

[REST-compliance] Create a test to be sure APIs are REST compliant #1284

hdurix opened this issue Apr 8, 2022 · 5 comments

Comments

@hdurix
Copy link
Member

hdurix commented Apr 8, 2022

See if there is a way to create a test to be sure all JHipster Lite's APIs are REST compliant (more details in #1273).

Could be something like a integration tests getting all the exposed APIs (not sure there is easier with Spring, to check), and checking that:

  • starts with /api/
  • n+1 terms ending with s
  • n+2 terms not ending with s

Check if those rules can be applied for every URIs. If yes, keep this test and redirect to a documentation when failing.

@pascalgrimaud pascalgrimaud added area: enhancement 🔧 theme: api $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/ generator: internal labels Apr 8, 2022
@hdurix
Copy link
Member Author

hdurix commented Apr 8, 2022

Thinking twice, not sure this is doable and correct because of exceptions like:

  • codespaces should not be considered as a collection but as an element even if it's ending by s
  • feet is the plural of foot (I can't find a "tech" example) so maybe not all collections should be ending by s

@pascalgrimaud
Copy link
Member

@hdurix : it's like "chips" :D

@Bolo89
Copy link
Contributor

Bolo89 commented Apr 10, 2022

Maybe to handle the exceptions, in the test, add 2 hard coded lists :

List<String> singularEndedWithSExceptions = List.of("codespace",..);
List<String> pluralNotEndedWithSExceptions = List.of("feet", ...)

And if a word in the uri does not match the rule, check if it's present in corresponding list of exceptions.
It's not very clean :/ but I've no better idea

@pascalgrimaud
Copy link
Member

With the new module system, I think we can close this ticket
Am I correct @hdurix @DamnClin ?

@DamnClin
Copy link
Collaborator

Yep

@pascalgrimaud pascalgrimaud removed $$ bug-bounty $$ https://www.jhipster.tech/bug-bounties/ $100 https://www.jhipster.tech/bug-bounties/ labels Jul 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants