Skip to content

Simplify APIs endpoints #17790

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

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

Simplify APIs endpoints #17790

wants to merge 1 commit into from

Conversation

hishamco
Copy link
Member

This PR intends to simply use API endpoints. Currently, each end point has its file, which is suitable for small but not for enterprise because it's a miss. That's why Controller & ApiController organize the actions into a single unit. Sometimes, we might need to use partial classes if there are many endpoints for a particular entity.

Another good thing about the current implementation is that it groups the APIs and reduces the amount of the configuration, such as API prefix, group name, and setting authentication scheme.

FYI, we could use the source generator to register the end point. If we do so

@sebastienRO,s your feedback please

@MikeAlhayek
Copy link
Member

@hishamco personally I rather keep one file per request for endpoint. I think it is a much cleaner approach.

@sebastienros
Copy link
Member

It's not "simplifying", it's adding magic that people would have to learn/discover to understand how that works. I had to. So if you have a class named ContentEndpoints then the url will magically become api/content because your class ends with Endpoints.

@sebastienros
Copy link
Member

We need to have a discussion about how endpoints are grouped and the classes named though. @MikeAlhayek likes them in different files, I like them grouped by entity.

@hishamco
Copy link
Member Author

I might agree with you to group them by entity, and we could use a partial class in case the code is too long

@hishamco
Copy link
Member Author

I had to. So if you have a class named ContentEndpoints then the url will magically become api/content

The prefix could be configurable as well as the group name, but I follow the conventions over the configuration pattern

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