openapi-explorer 0.8.287 → 0.8.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openapi-explorer",
3
- "version": "0.8.287",
3
+ "version": "0.8.288",
4
4
  "description": "OpenAPI Explorer - API viewer with dynamically generated components, documentation, and interaction console",
5
5
  "author": "Rhosys Developers <developers@rhosys.ch>",
6
6
  "repository": {
@@ -54,7 +54,8 @@
54
54
  "path-browserify": "^1.0.1",
55
55
  "prismjs": "^1.23.0",
56
56
  "regex-to-strings": "^2.0.3",
57
- "swagger-client": "^3.13"
57
+ "swagger-client": "^3.13",
58
+ "xml-but-prettier": "^1.0.1"
58
59
  },
59
60
  "scripts": {
60
61
  "build": "NODE_ENV=production webpack --mode=production",
@@ -1085,9 +1085,10 @@ export default class ApiRequest extends LitElement {
1085
1085
  } else {
1086
1086
  respText = await fetchResponse.text();
1087
1087
  if (contentType.includes('xml')) {
1088
- this.responseText = prettyXml(respText);
1088
+ this.responseText = formatXml(respText, { textNodesOnSameLine: true, indentor: ' ' });
1089
+ } else {
1090
+ this.responseText = respText;
1089
1091
  }
1090
- this.responseText = respText;
1091
1092
  }
1092
1093
  if (this.responseIsBlob) {
1093
1094
  const contentDisposition = fetchResponse.headers.get('content-disposition');
@@ -108,27 +108,6 @@ export function advancedSearch(searchVal, allSpecTags, searchOptions = []) {
108
108
  return pathsMatched;
109
109
  }
110
110
 
111
- export function prettyXml(sourceXmlString) {
112
- const xmlDoc = new DOMParser().parseFromString(sourceXmlString, 'text/xml');
113
- const xsltDoc = new DOMParser().parseFromString([
114
- // describes how we want to modify the XML - indent everything
115
- `<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
116
- <xsl:strip-space elements="*"/>
117
- <xsl:template match="para[content-style][not(text())]">
118
- <xsl:value-of select="normalize-space(.)"/>
119
- </xsl:template>
120
- <xsl:template match="node()|@*">
121
- <xsl:copy><xsl:apply-templates select="node()|@*"/></xsl:copy>
122
- </xsl:template>
123
- <xsl:output indent="yes"/>
124
- </xsl:stylesheet>`,
125
- ].join('\n'), 'application/xml');
126
- const xsltProcessor = new XSLTProcessor();
127
- xsltProcessor.importStylesheet(xsltDoc);
128
- const resultDoc = xsltProcessor.transformToDocument(xmlDoc);
129
- return new XMLSerializer().serializeToString(resultDoc);
130
- }
131
-
132
111
  export function getCurrentElement() {
133
112
  const currentQuery = (window.location.hash || '').split('?')[1];
134
113
  const query = new URLSearchParams(currentQuery);