docs/documentation/_plugins/openapi.rb
# params:
# 1 - parameter name to render (string)
# 2 - parameter attributes (hash)
# 3 - parent item data (hash)
# 4 - object with primary language data
# 5 - object with language data which use if there is no data in primary language
parameter name to render (string)
2 - parameter attributes (hash)
3 - parent item data (hash)
4 - object with primary language data
5 - object with language data which use if there is no data in primary language
parameter name to render ( string ) 2 - parameter attributes ( hash ) 3 - parent item data ( hash ) 4 - object with primary language data 5 - object with language data which use if there is no data in primary language
def format_schema(name, attributes, parent, primaryLanguage = nil, fallbackLanguage = nil)
        result = Array.new()
        if name != ""
            name_text = ''
            result.push('<li>')
            attributes_type = ''
            if attributes.is_a?(Hash)
              if attributes.has_key?('type')
                 attributes_type = attributes["type"]
              elsif attributes.has_key?('x-kubernetes-int-or-string')
                 attributes_type = "x-kubernetes-int-or-string"
              end
            end
            if attributes_type != ''
                if attributes.is_a?(Hash) and attributes.has_key?("items")
                    name_text = format_key_name(name)+ ' (<i>' +  format_type(attributes_type, attributes["items"]["type"]) + '</i>)'
                else
                    name_text = format_key_name(name)+ ' (<i>' +  format_type(attributes_type, nil) + '</i>)'
                end
            else
                name_text = format_key_name(name)
            end
            if attributes['x-doc-deprecated']
                name_text = name_text + ' <span class="deprecated">' + get_i18n_term('deprecated').upcase + '!</span>'
            end
            result.push(name_text)
        end
        result.push(format_attribute(name, attributes, parent, primaryLanguage, fallbackLanguage)) if attributes.is_a?(Hash)
        if attributes.is_a?(Hash) and attributes.has_key?("properties")
            result.push('<ul>')
            attributes["properties"].sort.to_h.each do |key, value|
                result.push(format_schema(key, value, attributes, get_hash_value(primaryLanguage, "properties", key), get_hash_value(fallbackLanguage, "properties", key)))
            end
            result.push('</ul>')
        elsif attributes.is_a?(Hash) and  attributes.has_key?('items')
            if get_hash_value(attributes,'items','properties')
                result.push('<ul>')
                attributes['items']["properties"].sort.to_h.each do |item_key, item_value|
                    result.push(format_schema(item_key, item_value, attributes['items'], get_hash_value(primaryLanguage,"items", "properties", item_key) , get_hash_value(fallbackLanguage,"items", "properties", item_key)))
                end
                result.push('</ul>')
            else
                result.push(format_schema("", attributes['items'], attributes, get_hash_value(primaryLanguage,'items'), get_hash_value(fallbackLanguage,'items') ))
            end
        else
        end
        if name != ""
            result.push('</li>')
        end
        result.join
    end
def format_schema ( name , attributes , parent , primaryLanguage = nil , fallbackLanguage = nil ) result = Array . new ( ) if name != "" name_text = '' result . push ( '<li>' ) attributes_type = '' if attributes . is_a? ( Hash ) if attributes . has_key? ( 'type' ) attributes_type = attributes [ "type" ] elsif attributes . has_key? ( 'x-kubernetes-int-or-string' ) attributes_type = "x-kubernetes-int-or-string" end end if attributes_type != '' if attributes . is_a? ( Hash ) and attributes . has_key? ( "items" ) name_text = format_key_name ( name ) + ' (<i>' + format_type ( attributes_type , attributes [ "items" ] [ "type" ] ) + '</i>)' else name_text = format_key_name ( name ) + ' (<i>' + format_type ( attributes_type , nil ) + '</i>)' end else name_text = format_key_name ( name ) end if attributes [ 'x-doc-deprecated' ] name_text = name_text + ' <span class="deprecated">' + get_i18n_term ( 'deprecated' ) . upcase + '!</span>' end result . push ( name_text ) end result . push ( format_attribute ( name , attributes , parent , primaryLanguage , fallbackLanguage ) ) if attributes . is_a? ( Hash ) if attributes . is_a? ( Hash ) and attributes . has_key? ( "properties" ) result . push ( '<ul>' ) attributes [ "properties" ] . sort . to_h . each do | key , value | result . push ( format_schema ( key , value , attributes , get_hash_value ( primaryLanguage , "properties" , key ) , get_hash_value ( fallbackLanguage , "properties" , key ) ) ) end result . push ( '</ul>' ) elsif attributes . is_a? ( Hash ) and attributes . has_key? ( 'items' ) if get_hash_value ( attributes , 'items' , 'properties' ) result . push ( '<ul>' ) attributes [ 'items' ] [ "properties" ] . sort . to_h . each do | item_key , item_value | result . push ( format_schema ( item_key , item_value , attributes [ 'items' ] , get_hash_value ( primaryLanguage , "items" , "properties" , item_key ) , get_hash_value ( fallbackLanguage , "items" , "properties" , item_key ) ) ) end result . push ( '</ul>' ) else result . push ( format_schema ( "" , attributes [ 'items' ] , attributes , get_hash_value ( primaryLanguage , 'items' ) , get_hash_value ( fallbackLanguage , 'items' ) ) ) end else end if name != "" result . push ( '</li>' ) end result . join end
params:
1 - parameter name to render (string)
2 - parameter attributes (hash)
3 - parent item data (hash)
4 - object with primary language data
5 - object with language data which use if there is no data in primary language
params : 1 - parameter name to render ( string ) 2 - parameter attributes ( hash ) 3 - parent item data ( hash ) 4 - object with primary language data 5 - object with language data which use if there is no data in primary language
# object items # result.push("no properties for #{name}")
name
<not_specific>
attributes
<not_specific>
parent
<not_specific>
primaryLanguage
<not_specific>
fallbackLanguage
<not_specific>