-
Notifications
You must be signed in to change notification settings - Fork 26
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
Fix apidoc position of Puppet plugin #151
Conversation
4c83e3f
to
e5f8353
Compare
@@ -3,7 +3,8 @@ module Api | |||
module V2 | |||
class BaseController < ::Api::V2::BaseController | |||
resource_description do | |||
api_version '2' | |||
resource_id 'foreman_puppet_base' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where is the id of the resource used?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is used by Apipie to distinguish between the classes and get the documentation correctly, as far as I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should change the resource_id of the BaseController
and the one of the LookupsCommonController
to have a pp_
prefix such that all of the resource_ids are consistent.
With this PR, the API entries appear in addition to the core entries. Is this okay or should they replace the core entries? |
I believe when the plugin is installed, the core models and controllers don't work anymore and the endpoints from this plugin should be used. |
As of now, @ezr-ondrej said that the old routes are redirected to the new ones. But in any case, I think it makes more sense to remove the old apidoc entries or at least mark them as deprecated as it gives the impression that both can be used in parallel. I will fix that. |
I'm wondering if we can add something to the CI to verify all relevant fields are properly documented. |
This would be very helpful indeed as comparing all API entries manually is very tedious. I will think about it. Let me know if you have an idea how to do it. |
Correction: Old routes are not redirected, yet, but end up at the core API. Do we want to fix this?
With this PR, the documentation of the core API is overwritten, such that only new routes are shown. Moreover, The PR fixes #147 that were caused mostly by |
Yes, I think we should. We could also just disable the core routes. I think we should just make sure this is actually worth the effort. I can see a lot of tests in core break if we implement this.
I think it should be fairly easy to get all relevant API controllers (e.g. via the routes) and all the actions. We then need possible parameters that we could get from the parameter filters. And to finish it up, the documentation dsl should give us a list of all already documented parameters. |
I will open a new issue for this.
Let me give it a try. I guess it makes sense to have the tests as part of this PR? But I have not seen tests for apidoc completion before, so could be a new issue as well... |
I'd recommend a separate issue. |
Is there anything that needs fixing for this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me.
@@ -1,10 +1,9 @@ | |||
module ForemanPuppet | |||
module Api | |||
module V2 | |||
class BaseController < ::Api::V2::BaseController | |||
class PuppetBaseController < ::Api::V2::BaseController |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any other reason for renaming the controllers, or do you just feel it's a better name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is that the resource_id
of any controller is generated from the name of the controller. As there already exist a controller named BaseController
in Foreman core, there is a name clash. It is okay for the controllers that should be overwritten anyways, but not for the ones that should remain in Foreman core.
Thanks @nadjaheitmann 👍 |
This fixes #147