Skip to content

Commit

Permalink
THREESCALE-9183: Removing leftovers of source2swagger (#3327)
Browse files Browse the repository at this point in the history
* Removing leftovers of source2swagger

* Remove circleci job for swagger generation

* More source2swagger removals

* More cleanups

* Fix CircleCI config
  • Loading branch information
mayorova authored Apr 28, 2023
1 parent 0bf1e8e commit 0b03c2c
Show file tree
Hide file tree
Showing 86 changed files with 486 additions and 9,619 deletions.
32 changes: 0 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -533,27 +533,6 @@ jobs:
destination: licenses
- notify_failure

swagger:
parameters:
executor:
type: string
default: builder-ruby26
executor:
name: << parameters.executor >>
steps:
- checkout
- *attach-to-workspace
- *use-example-config-files
- run:
name: Swagger validation
command: |
bundle exec rake doc:swagger:validate:all
bundle exec rake doc:swagger:generate:all
- store_artifacts:
path: doc/active_docs
destination: active_docs
- notify_failure

jest:
resource_class: medium+
parameters:
Expand Down Expand Up @@ -996,10 +975,6 @@ workflows:
- licenses:
requires:
- dependencies_bundler
- swagger:
requires:
- dependencies_npm
- dependencies_bundler
- lint:
requires:
- dependencies_npm
Expand All @@ -1009,7 +984,6 @@ workflows:
- notify_success:
requires:
- licenses
- swagger
- lint
- jest
<<: *only-master-filter
Expand Down Expand Up @@ -1174,11 +1148,6 @@ workflows:
executor: builder-ruby26
requires:
- dependencies_bundler
- swagger:
executor: builder-ruby26
requires:
- dependencies_npm
- dependencies_bundler
- lint:
executor: builder-ruby26
requires:
Expand All @@ -1190,7 +1159,6 @@ workflows:
- notify_success:
requires:
- licenses
- swagger
- lint
- jest
<<: *only-master-filter
Expand Down
2 changes: 0 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,6 @@ group :development, :test do
gem 'pry-shell'
gem 'pry-stack_explorer'

# for `rake doc:liquid:generate` and similar
gem 'source2swagger', git: 'https://github.com/3scale/source2swagger'
gem 'unicorn-rails'
end

Expand Down
8 changes: 0 additions & 8 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ GIT
nokogiri (~> 1)
rspec (>= 3.0.0.a, < 4)

GIT
remote: https://github.com/3scale/source2swagger
revision: 9a787007577fc58b5822b55720e977cc063057fd
specs:
source2swagger (0.0.2)
json

GIT
remote: https://github.com/3scale/swagger-ui_rails.git
revision: f88bb8bed4fdb57fcf5be6425f3fc10c638788d1
Expand Down Expand Up @@ -1044,7 +1037,6 @@ DEPENDENCIES
sidekiq-throttled
simplecov (~> 0.21.2)
slim-rails (~> 3.2)
source2swagger!
sprockets-rails (= 3.2.2)
state_machines (~> 0.5.0)
state_machines-activerecord (~> 0.5.0)
Expand Down
21 changes: 2 additions & 19 deletions app/controllers/admin/api/access_tokens_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,25 +12,8 @@ class Admin::Api::AccessTokensController < Admin::Api::BaseController

before_action :authorize_access_tokens

##~ sapi = source2swagger.namespace("Account Management API")
##~ e = sapi.apis.add
##~ e.path = "/admin/api/users/{user_id}/access_tokens.json"
##~ e.responseClass = "access_token"
#
##~ op = e.operations.add
##~ op.deprecated = true
##~ op.httpMethod = "POST"
##~ op.summary = "Access Token Create"
##~ op.description = "[Deprecated API] Use \"Personal Access Tokens Create\". Creates an access token. Make sure to copy your new personal access token now. You will not be able to see it again as it is not stored for security reasons."
##~ op.group = "access_token"
#
##~ op.parameters.add :name => "user_id", :description => "ID of the user.", :dataType => "integer", :paramType => "path", :required => true
##~ op.parameters.add :name => "name", :description => "Name of the access token.", :dataType => "string", :required => true, :paramType => "query"
##~ op.parameters.add :name => "permission", :description => "Permission of the access token. It must be either 'ro' (read only) or 'rw' (read and write).", :dataType => "string", :required => true, :paramType => "query"
##~ op.parameters.add :name => "scopes", :defaultName => "scopes[]", :description => "Scope of the access token. URL-encoded array containing one or more of the possible values. The possible values are, for a master user [\"account_management\", \"stats\"], and for a tenant user [\"finance\", \"account_management\", \"stats\"]", :dataType => "custom", :allowMultiple => true, :required => true, :paramType => "query"
#
##~ op.parameters.add @parameter_access_token
#
# Access Token Create (deprecated)
# POST /admin/api/users/{user_id}/access_tokens.json
def create
access_token = user.access_tokens.create(access_token_params)
respond_with access_token
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,104 +8,32 @@ class Admin::Api::Account::AuthenticationProvidersController < Admin::Api::BaseC
before_action :authorize_rolling_update
before_action :find_authentication_provider, only: %i[update show]

##~ @parameter_authentication_provider_id_by_id = {:name => "id", :description => "ID of the authentication provider.", :dataType => "string", :required => true, :paramType => "path"}
##~ @parameter_authentication_provider_admin_kind_required = {:name => "kind", :description => "The kind of authentication provider which can be either 'auth0' or 'keycloak'. Use 'keycloak' for Red Hat Single Sign-On.", :dataType => "string", :required => true, :paramType => "query"}
##~ @parameter_authentication_provider_name = {:name => "name", :description => "Name of the authentication provider.", :dataType => "string", :required => false, :paramType => "query"}
##~ @parameter_authentication_provider_system_name = {:name => "system_name", :description => "System Name of the authentication provider.", :dataType => "string", :required => false, :paramType => "query"}
##~ @parameter_authentication_provider_client_id = {:name => "client_id", :description => "Client ID of the authentication provider.", :dataType => "string", :required => false, :paramType => "query"}
##~ @parameter_authentication_provider_client_secret = {:name => "client_secret", :description => "Client Secret of the authentication provider.", :dataType => "string", :required => false, :paramType => "query"}
##~ @parameter_authentication_provider_site = {:name => "site", :description => "Site or Realm of the authentication provider.", :dataType => "string", :required => false, :paramType => "query"}
##~ @parameter_authentication_provider_skip_ssl_certificate_verification = {:name => "skip_ssl_certificate_verification", :description => "Skip SSL certificate verification. False by default.", :dataType => "boolean", :required => false, :paramType => "query"}
##~ @parameter_authentication_provider_published = {:name => "published", :description => "Published authentication provider. False by default", :dataType => "boolean", :required => false, :paramType => "query"}

# swagger
##~ sapi = source2swagger.namespace("Account Management API")
##~ e = sapi.apis.add
##~ e.path = "/admin/api/account/authentication_providers.xml"
##~ e.responseClass = "authentication_provider"
#
##~ op = e.operations.add
##~ op.httpMethod = "POST"
##~ op.summary = "Authentication Provider Admin Portal Create"
##~ op.description = "Creates an authentication provider for the admin portal."
##~ op.group = "authentication_provider"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add @parameter_authentication_provider_admin_kind_required
##~ op.parameters.add @parameter_authentication_provider_name
##~ op.parameters.add @parameter_authentication_provider_system_name
##~ op.parameters.add @parameter_authentication_provider_client_id
##~ op.parameters.add @parameter_authentication_provider_client_secret
##~ op.parameters.add @parameter_authentication_provider_site
##~ op.parameters.add @parameter_authentication_provider_skip_ssl_certificate_verification
##~ op.parameters.add @parameter_authentication_provider_published
#
# Authentication Provider Admin Portal Create
# POST /admin/api/account/authentication_providers.xml
def create
attributes = authentication_provider_create_params
@authentication_provider = self_authentication_providers.build_kind(kind: attributes.require(:kind), **attributes.to_h.symbolize_keys)
authentication_provider.save
respond_with authentication_provider_presenter
end

# swagger
##~ sapi = source2swagger.namespace("Account Management API")
##~ e = sapi.apis.add
##~ e.path = "/admin/api/account/authentication_providers/{id}.xml"
##~ e.responseClass = "authentication_provider"
#
##~ op = e.operations.add
##~ op.httpMethod = "PUT"
##~ op.summary = "Authentication Provider Admin Portal Update"
##~ op.description = "Updates an authentication provider for the admin portal."
##~ op.group = "authentication_provider"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add @parameter_authentication_provider_id_by_id
##~ op.parameters.add @parameter_authentication_provider_client_id
##~ op.parameters.add @parameter_authentication_provider_client_secret
##~ op.parameters.add @parameter_authentication_provider_site
##~ op.parameters.add @parameter_authentication_provider_skip_ssl_certificate_verification
##~ op.parameters.add @parameter_authentication_provider_published
#
# Authentication Provider Admin Portal Update
# PUT /admin/api/account/authentication_providers/{id}.xml
def update
authorize_changes
authentication_provider.update_attributes(authentication_provider_update_params)
respond_with authentication_provider_presenter
end

##~ sapi = source2swagger.namespace("Account Management API")
##~ e = sapi.apis.add
##~ e.path = "/admin/api/account/authentication_providers.xml"
##~ e.responseClass = "List[authentication_provider]"
#
##~ op = e.operations.add
##~ op.httpMethod = "GET"
##~ op.summary = "Authentication Providers Admin Portal List"
##~ op.description = "Returns the list of all the authentication providers for the admin portal."
##~ op.group = "authentication_provider"
#
##~ op.parameters.add @parameter_access_token
#
# Authentication Providers Admin Portal List
# GET /admin/api/account/authentication_providers.xml
def index
presenters = ProviderOauthFlowPresenter.wrap(self_authentication_providers, request, request.host)
respond_with(presenters)
end

# swagger
##~ sapi = source2swagger.namespace("Account Management API")
##~ e = sapi.apis.add
##~ e.path = "/admin/api/account/authentication_providers/{id}.xml"
##~ e.responseClass = "authentication_provider"
#
##~ op = e.operations.add
##~ op.httpMethod = "GET"
##~ op.summary = "Authentication Provider Admin Portal Read"
##~ op.description = "Read an authentication provider for the admin portal."
##~ op.group = "authentication_provider"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add @parameter_authentication_provider_id_by_id
#
# Authentication Provider Admin Portal Read
# GET /admin/api/account/authentication_providers/{id}.xml
def show
respond_with authentication_provider_presenter
end
Expand Down
17 changes: 2 additions & 15 deletions app/controllers/admin/api/account/proxy_configs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,8 @@ class Admin::Api::Account::ProxyConfigsController < Admin::Api::BaseController
render_error 'invalid environment', status: :unprocessable_entity
end

##~ e = sapi.apis.add
##~ e.path = "/admin/api/account/proxy_configs/{environment}.json"
##~ e.responseClass = "proxy_config"
#
##~ op = e.operations.add
##~ op.httpMethod = "GET"
##~ op.summary = "Proxy Configs List (Provider)"
##~ op.description = "Returns the Proxy Configs of the provider"
##~ op.group = "proxy_config"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add @parameter_environment
##~ op.parameters.add :name => "host", :description => "Filter by host", :dataType => "string", :required => false, :paramType => "query"
##~ op.parameters.add :name => "version", :description => "Filter by version", :dataType => "string", :required => false, :paramType => "query"
#
# Proxy Configs List (Provider)
# GET /admin/api/account/proxy_configs/{environment}.json
def index
respond_with proxy_configs.order(:id).paginate(pagination_params)
end
Expand Down
70 changes: 10 additions & 60 deletions app/controllers/admin/api/account_features_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,36 @@ class Admin::Api::AccountFeaturesController < Admin::Api::BaseController
wrap_parameters Feature
representer Feature

# swagger
##~ sapi = source2swagger.namespace("Account Management API")
##~ e = sapi.apis.add
##~ e.path = "/admin/api/features.xml"
##~ e.responseClass = "List[feature]"
#
##~ op = e.operations.add
##~ op.httpMethod = "GET"
##~ op.summary = "Account Features List"
##~ op.description = "Returns the list of the features available to accounts. Account features are globally scoped."
##~ op.group = "account_feature"
#
##~ op.parameters.add @parameter_access_token
#
# Account Features List
# GET /admin/api/features.xml
def index
respond_with(features)
end

##~ op = e.operations.add
##~ op.httpMethod = "POST"
##~ op.summary = "Account Feature Create"
##~ op.description = "Create an account feature. The features of the account are globally scoped. Creating a feature does not associate the feature with an account plan."
##~ op.group = "account_feature"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add :name => "name", :description => "Name of the feature.", :dataType => "string", :allowMultiple => false, :required => true, :paramType => "query"
##~ op.parameters.add @parameter_system_name_by_name
#
# Account Feature Create
# POST /admin/api/features.xml
def create
feature = features.create(feature_params)

respond_with(feature)
end

##~ e = sapi.apis.add
##~ e.path = "/admin/api/features/{id}.xml"
##~ e.responseClass = "feature"
##~ e.description = "Returns an account feature."
#
##~ op = e.operations.add
##~ op.httpMethod = "GET"
##~ op.summary = "Account Feature Read"
##~ op.description = "Returns an account feature."
##~ op.group = "account_feature"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add @parameter_feature_id_by_id
#
# Account Feature Read
# GET /admin/api/features/{id}.xml
def show
respond_with(feature)
end


# swagger
#
##~ op = e.operations.add
##~ op.httpMethod = "PUT"
##~ op.summary = "Account Feature Update"
##~ op.description = "Updates an account feature."
##~ op.group = "account_feature"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add @parameter_feature_id_by_id
##~ op.parameters.add :name => "name", :description => "Name of the feature.", :dataType => "string", :allowMultiple => false, :required => true, :paramType => "query"
#
# Account Feature Update
# PUT /admin/api/features/{id}.xml
def update
feature.update_attributes(feature_params)

respond_with(feature)
end

##~ op = e.operations.add
##~ op.httpMethod = "DELETE"
##~ op.summary = "Account Feature Delete"
##~ op.description = "Deletes an account feature."
##~ op.group = "account_feature"
#
##~ op.parameters.add @parameter_access_token
##~ op.parameters.add @parameter_feature_id_by_id
#
# Account Feature Delete
# DELETE /admin/api/features/{id}.xml
def destroy
feature.destroy

Expand Down
Loading

0 comments on commit 0b03c2c

Please sign in to comment.