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

Fixes #37824 - Hide taxonomies from parts of api documentation #10322

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions app/controllers/api/v2/architectures_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module V2
class ArchitecturesController < V2::BaseController
include Foreman::Controller::Parameters::Architecture

hide_taxonomy_options

before_action :find_optional_nested_object
before_action :find_resource, :only => %w{show update destroy}

Expand Down
7 changes: 7 additions & 0 deletions app/controllers/api/v2/base_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,13 @@ def render_error(error, options = { })
render options.merge(:template => "api/v2/errors/#{error}",
:layout => 'api/v2/layouts/error_layout')
end

def self.hide_taxonomy_options
resource_description do
param :location_id, Integer, :show => false
param :organization_id, Integer, :show => false
end
end
Copy link
Member

Choose a reason for hiding this comment

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

Waiting for revert to a previous state? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oof, no idea how that happened but I must've force pushed some code that I was testing out. Thank you for pointing this out, I will fix it.

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, now it should be in the previous state. Works as expected.

end
end
end
2 changes: 2 additions & 0 deletions app/controllers/api/v2/external_usergroups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ class ExternalUsergroupsController < V2::BaseController
include Api::Version2
include Foreman::Controller::Parameters::ExternalUsergroup

hide_taxonomy_options

before_action :find_resource, :only => [:show, :update, :destroy, :refresh]
before_action :find_required_nested_object, :only => [:index, :show, :create]
after_action :refresh_external_usergroup, :only => [:create, :update, :destroy]
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/api/v2/settings_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module Api
module V2
class SettingsController < V2::BaseController
hide_taxonomy_options

before_action :find_resource, :only => %w{show update}

def_param_group :setting_params do
Expand Down
2 changes: 2 additions & 0 deletions app/controllers/api/v2/usergroups_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module V2
class UsergroupsController < V2::BaseController
include Foreman::Controller::Parameters::Usergroup

hide_taxonomy_options

before_action :find_optional_nested_object
before_action :find_resource, :only => %w{show update destroy}

Expand Down
Loading