module RubyAem::Swagger
Swagger
module contains logic related to swagger_aem.
Public Class Methods
Given a config node name, return the corresponding OSGI config name. OSGI config name are available from AEM Web Console's Config Manager page.
@param config_node_name the name of the node for a given config @return config name
# File lib/ruby_aem/swagger.rb, line 56 def self.config_node_name_to_config_name(config_node_name) case config_node_name when 'org.apache.felix.http' 'Apache Felix Jetty Based HTTP Service' when 'org.apache.sling.servlets.get.DefaultGetServlet' 'Apache Sling GET Servlet' when 'org.apache.sling.security.impl.ReferrerFilter' 'Apache Sling Referrer Filter' when 'org.apache.sling.jcr.davex.impl.servlets.SlingDavExServlet' 'Apache Sling DavEx Servlet' when 'com.shinesolutions.aem.passwordreset.Activator' 'AEM Password Reset Activator' when 'com.shinesolutions.healthcheck.hc.impl.ActiveBundleHealthCheck' 'AEM Health Check Servlet' when 'com.adobe.granite.auth.saml.SamlAuthenticationHandler.config' 'Adobe Granite SAML Authentication Handler' when 'org.apache.http.proxyconfigurator.config' 'Apache HTTP Components Proxy Configuration' end end
Convert ruby_aem spec's operation (consistent with Swagger
spec's operationId) into swagger_aem's generated method name.
@param operation operation ID @return swagger_aem method name
# File lib/ruby_aem/swagger.rb, line 23 def self.operation_to_method(operation) operation.gsub(/[A-Z]/) { |char| '_' + char.downcase } end
Sanitise path value by removing leading and trailing slashes swagger_aem accepts paths without those slashes.
@param path path name @return sanitised path name
# File lib/ruby_aem/swagger.rb, line 47 def self.path(path) path.gsub(%r{^/}, '').gsub(%r{/$}, '') end
Convert ruby_aem spec's property name (by replacing dots with underscores) into swagger_aem's generated parameter name.
@param property property name @return swagger_aem parameter name
# File lib/ruby_aem/swagger.rb, line 34 def self.property_to_parameter(property) if ['alias'].include? property "_#{property}" else property.tr('.', '_').tr('-', '_') end end