Skip to content

Commit d6f8438

Browse files
committed
chore: code cleanup
1 parent a549ba5 commit d6f8438

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

lib/bundle.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,6 @@ export interface InventoryEntry {
2323
value: any;
2424
}
2525

26-
/**
27-
* Determines whether an internal $ref should be inlined (copied) rather than left as a $ref.
28-
* Currently inlines OpenAPI path items ("#/paths/..."), while keeping components/definitions/declarations as refs.
29-
*/
30-
const shouldInlineInternal = (entry: InventoryEntry) => {
31-
if (entry.external) {
32-
return false;
33-
}
34-
const h = entry.hash as string | undefined;
35-
if (!h || h === "#") {
36-
return false;
37-
}
38-
if (h.startsWith("#/components/schemas") || h.startsWith("#/definitions")) {
39-
return false;
40-
}
41-
return h.startsWith("#/paths/");
42-
};
43-
4426
/**
4527
* TODO
4628
*/
@@ -318,7 +300,7 @@ function remap(inventory: InventoryEntry[]) {
318300
for (const entry of inventory) {
319301
// console.log('Re-mapping $ref pointer "%s" at %s', entry.$ref.$ref, entry.pathFromRoot);
320302

321-
if (!entry.external && !shouldInlineInternal(entry)) {
303+
if (!entry.external && !entry.hash?.startsWith("#/paths/")) {
322304
// This $ref already resolves to the main JSON Schema file
323305
entry.$ref.$ref = entry.hash;
324306
} else if (entry.file === file && entry.hash === hash) {

0 commit comments

Comments
 (0)