Module: RubyAem::Swagger

Defined in:
lib/ruby_aem/swagger.rb

Overview

Swagger module contains logic related to swagger_aem.

Class Method Summary collapse

Class Method Details

.config_node_name_to_config_name(config_node_name) ⇒ Object

Given a config node name, return the corresponding OSGI config name. OSGI config name are available from AEM Web Console’s Config Manager page.

Parameters:

  • config_node_name

    the name of the node for a given config

Returns:

  • config name



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# 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

.operation_to_method(operation) ⇒ Object

Convert ruby_aem spec’s operation (consistent with Swagger spec’s operationId) into swagger_aem’s generated method name.

Parameters:

  • operation

    operation ID

Returns:

  • swagger_aem method name



23
24
25
26
27
# File 'lib/ruby_aem/swagger.rb', line 23

def self.operation_to_method(operation)
  operation.gsub(/[A-Z]/) { |char|
    '_' + char.downcase
  }
end

.path(path) ⇒ Object

Sanitise path value by removing leading and trailing slashes swagger_aem accepts paths without those slashes.

Parameters:

  • path

    path name

Returns:

  • sanitised path name



47
48
49
# File 'lib/ruby_aem/swagger.rb', line 47

def self.path(path)
  path.gsub(%r{^/}, '').gsub(%r{/$}, '')
end

.property_to_parameter(property) ⇒ Object

Convert ruby_aem spec’s property name (by replacing dots with underscores) into swagger_aem’s generated parameter name.

Parameters:

  • property

    property name

Returns:

  • swagger_aem parameter name



34
35
36
37
38
39
40
# 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