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

Refactor: Split API modules into public/internal #1083

Merged
merged 11 commits into from
Apr 30, 2020

Conversation

mheinzel
Copy link
Contributor

@mheinzel mheinzel commented Apr 29, 2020

services not quite following the pattern:

  1. cargohold: All endpoints are public here, so I'm not sure it makes sense to create a Public submodule. Maybe it does, for consistency's sake? done

  2. brig: The endpoints here are not in a single API module, but there are some small ones as well. I didn't want to split each of these into multiple modules, so I just split them into routesPublic and routesInternal.

@mheinzel mheinzel force-pushed the mheinzel/split-api-public-private branch from debbaf3 to 06da44a Compare April 30, 2020 07:03
Copy link
Member

@jschaul jschaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would put the /i/status endpoints to the internalRoutes / Internal.hs and not treat them any different. Otherwise looks good to me.


Public.sitemap
Public.apiDocs
Internal.sitemap
head "/i/status" (continue $ const (return empty)) true
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you leave the /i/status out from the internal endpoints?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They seemed very generic to me, in that every service has some common non-domain-related endpoints. Seems to me like they should be separated from the domain endpoints and could even be abstracted out for re-use (although in this case there's no big benefit for just 2 trivial endpoints).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, in some services we don't have an Internal module, so we would have to create another module just for the status endpoint or it will be inconsistent.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, in some services we don't have an Internal module, so we would have to create another module just for the status endpoint or it will be inconsistent.

Where there are only a few endpoints, you could do the same as in some of brig's modules - routesPublic and routesInternal functions.

They seemed very generic to me, in that every service has some common non-domain-related endpoints. Seems to me like they should be separated from the domain endpoints and could even be abstracted out for re-use (although in this case there's no big benefit for just 2 trivial endpoints).

They are necessary and while yes, they are not serving business logic, but serve operational/deployment concerns, they still fall into the category of "internal" endpoints (since they are not publicly reachable). I was simply surprised to see why it might make sense to treat them differently, as I don't see a good reason to not place them into the internalRoutes or Internal.hs module along with the rest of /i/. If you keep them separated out, I think a comment explaining why they are treated differently is required, as a future developer (or a developer in the future) may wonder the same question - so I have this new endpoint, it starts with /i/something - now, should it be under Internal? Or not? Since some endpoints are there, but the /i/status is not, so which path should I follow with my endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, I'll move them to the other internal endpoints.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@mheinzel mheinzel merged commit 37039b6 into develop Apr 30, 2020
@mheinzel mheinzel deleted the mheinzel/split-api-public-private branch April 30, 2020 18:13
@akshaymankar akshaymankar mentioned this pull request May 7, 2020
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.

2 participants