Skip to content

Commit 3d66893

Browse files
committed
new attribute enable/disable resolving of circular refs
1 parent 883b852 commit 3d66893

File tree

11 files changed

+50
-30
lines changed

11 files changed

+50
-30
lines changed

dist/rapidoc-min.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rapidoc-min.js.gz

150 Bytes
Binary file not shown.

dist/rapidoc-min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/rapidoc-min.js.map.gz

28 Bytes
Binary file not shown.

dist/report.html

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

docs/index.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,16 @@ <h2> Attributes</h2>
322322
</td>
323323
<td>row</td>
324324
</tr>
325-
325+
<tr>
326+
<td class="mono-bold"> resolve-circular-refs </td>
327+
<td class="gray">RapiDoc attempts to resolve all the circular references (if prsent) in the api spec.
328+
However if you face any performance issues while loading the spec, then you can disable it by setting it to 'false'
329+
Our recommendation is to leave it as the default value of 'true'.
330+
</td>
331+
<td>true</td>
332+
</tr>
333+
334+
326335
</table>
327336
</div>
328337

docs/rapidoc-min.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/api-request.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,9 @@ export default class ApiRequest extends LitElement {
277277
if (mimeReqObj.schema.$ref){
278278
mimeReqObj.schema = this.parser.$refs.get(mimeReqObj.schema.$ref);
279279
}
280-
//mimeReqObj.schema = JSON.parse(JSON.stringify(mimeReqObj.schema, removeCircularReferences()));
280+
else{
281+
mimeReqObj.schema = JSON.parse(JSON.stringify(mimeReqObj.schema, removeCircularReferences()));
282+
}
281283
}
282284
catch{
283285
console.error("Unable to resolve circular refs in schema", mimeReqObj.schema);

src/components/api-response.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ export default class ApiResponse extends LitElement {
114114
if (mimeRespObj.schema.$ref){
115115
mimeRespObj.schema = this.parser.$refs.get(mimeRespObj.schema.$ref);
116116
}
117-
//mimeRespObj.schema = JSON.parse(JSON.stringify(mimeRespObj.schema, removeCircularReferences(0)));
117+
else{
118+
mimeRespObj.schema = JSON.parse(JSON.stringify(mimeRespObj.schema, removeCircularReferences(0)));
119+
}
118120
}
119121
catch{
120122
console.error("Unable to resolve circular refs in schema", mimeRespObj.schema);

src/rapidoc.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ export default class RapiDoc extends LitElement {
280280
logoUrl : { type: String , attribute: 'logo-url' },
281281
apiKeyName : { type: String, attribute: 'api-key-name' },
282282
apiKeyValue : { type: String, attribute: 'api-key-value' },
283-
apiKeyLocation: { type: String, attribute: 'api-key-location' },
283+
apiKeyLocation: { type: String, attribute: 'api-key-location'},
284+
resolveCircularRefs: { type: String, attribute: 'resolve-circular-refs' },
284285
};
285286
}
286287
attributeChangedCallback(name, oldVal, newVal) {
@@ -351,7 +352,7 @@ export default class RapiDoc extends LitElement {
351352
this.server = "";
352353
this.matchPaths = "";
353354

354-
ProcessSpec(specUrl).then(function(spec){
355+
ProcessSpec(specUrl, this.resolveCircularRefs).then(function(spec){
355356
me.loading = false;
356357
if (spec===undefined || spec === null){
357358
console.error('Unable to resolve the API spec. ');

0 commit comments

Comments
 (0)