-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Remountable APIs, allows to re-mount APIs that inherit from this class #1802
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
Conversation
Creates a new module that can replace a Grape::API in most cases which allows APIs to be re-mounted
This is amazing, well done 👏 Dumb question first, why don't we make |
Hi. Thanks @dblock . It is a very fair question. Perhaps I should be clearer that, while
|
I've carried on working on it and now have a version that passes all specs. I still feel because of the core internal details changing, it's a safer idea to create a new class for this version, and then potentially we could make it the default if no problem arise. |
It worries me that the re-mountable version doesn't behave like the original I really want this feature in Grape and I really think we can make it work. I would start moving parts of I realize I am asking for a lot. What do you think? |
I wrote the above before seeing #1803. You've done the work! Lets discuss that PR first there. |
Addresses this feature request: #570
A lot of times (specially when using versioning) we want to re-mount an endpoint in a different namespace, perhaps with some tiny bit of different configuration each time.
On our project, for example, we have a massive API using Grape, and while we want to introduce versioning we don't want to:
1- Have to copy & paste the whole project (nor re-write the whole project at once),
2- Have to re-write our project to use one of the proposed meta-programming approaches.
As such, this solution allows you to replace Grape::API for Grape::RemountableAPI on inheritance, and with that alone the API will now be mountable in several places.
This is a first pass, but I'd appreciate feedback and comments