Forum Discussion

BostonKevin's avatar
BostonKevin
Contributor
6 years ago

Swagger Editor Cannot Process Multiline Response

An API call that I am documenting produces a multiline non-JSON response.  I am able to document a generic response successfully, up to a point.  However, a few characters in the response are not being read by Swagger editor properly.  I tried escaping various characters without success.  Perhaps someone has encountered a similar problem?

 

The code in question is as follows:

 

    inline_response_GET_VVVVVV_XXXXX_Key:
      type: string
      example: |
        var g_TranslationRules={};
        document.addEventListener("DOMContentLoaded",function(){MoxieTranslate("XXXX-XXXX-XXXX-XXXX", "https://localhost:6060/");});
        document.addEventListener("DOMContentLoaded",function(){MoxieStartStatsTimer("XXXX-XXXX-XXXX-XXXX", "https://localhost:6060/");});
        var sUrlForHash = document.location.pathname + document.location.search;
        sUrlForHash = sUrlForHash.toLowerCase();
        var sUrlHash = FNV1aHash(sUrlForHash);
        var g_TranslationArray=null;
      	k$jax ({
		    url: "https://localhost:6060/" + "xapis/Pretranslate/" + "0149-BF69-EA83-32A3" + "/" + sUrlHash + ".json",
		    method: "GET",
		    success/: function (oXHR, oParms) {
			  var oJSON = null;
			  try
			  {
			  	oJSON = JSON.parse(oXHR.responseText);
				  g_TranslationArray=oJSON;
			  }
			  catch (e) {}
		    }
	      });  

The problem begins with k$jax . Any idea how I could get this string and what comes after to be displayed properly in the inspector panel?

thanks

No RepliesBe the first to reply