Uploaded image for project: 'Red Hat 3scale API Management'
  1. Red Hat 3scale API Management
  2. THREESCALE-7109

Empty variables definition in the servers block throws ruby error

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Minor Minor
    • SaaS
    • SaaS, 2.10 ER1
    • System
    • False
    • False
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Not Started
    • Undefined
    • Hide

      remove the variables: {} definition:

      "servers": [
        { 
          "url": "https://example.production.gw.apicast.io:443" 
        } 
      ],
      
      Show
      remove the variables: {} definition: "servers" : [ { "url" : "https: //example.production.gw.apicast.io:443" } ],
    • Hide

      Import an OAS3 spec into 3scale with a servers block that looks like this:

       

        "servers": [
          {
            "url": "https://example.production.gw.apicast.io:443",
            "variables": {}
          }
        ],
      

       

      Show
      Import an OAS3 spec into 3scale with a servers block that looks like this:   "servers" : [ { "url" : "https: //example.production.gw.apicast.io:443" , "variables" : {} } ],  

      A valid servers block in an OAS spec containing an empty variables declaration with cause the import to fail:

        "servers": [
          {
            "url": "https://example.production.gw.apicast.io:443",
            "variables": {}
          }
        ],
      

       

       

      {:exception=>{:class=>NoMethodError, :message=>"undefined method `map' for nil:NilClass", :backtrace=>["/opt/system/app/lib/three_scale/open_api/url_resolver.rb:23:in `resolve_servers_from_variables'", "/opt/system/app/lib/three_scale/open_api/url_resolver.rb:27:in `resolve_servers_from_variables'", "/opt/system/app/lib/three_scale/open_api/url_resolver.rb:16:in `block in servers'", "/opt/system/app/lib/three_scale/open_api/url_resolver.rb:13:in `map'"]}, :parameters=>{}}
      

       

       

              rhn-support-ahobson Aimi Hobson
              rhn-support-ahobson Aimi Hobson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 1 hour
                  1h
                  Remaining:
                  0m
                  Logged:
                  Time Not Required
                  Not Specified