@contractual/differs.openapi 0.1.0-dev.1 → 0.1.0-dev.3

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.
@@ -2,7 +2,9 @@
2
2
  * OpenAPI spec resolver using @redocly/openapi-core
3
3
  *
4
4
  * Handles both OpenAPI 3.0 and 3.1 specifications.
5
- * Resolves all $ref pointers and produces fully dereferenced documents.
5
+ * Uses Redocly to bundle external refs into a single document,
6
+ * then uses the core ref-resolver to dereference internal $refs
7
+ * (which handles circular references safely).
6
8
  */
7
9
  /**
8
10
  * Resolve an OpenAPI spec file to a fully dereferenced object
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAkB3F"}
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAwB3F"}
package/dist/resolver.js CHANGED
@@ -2,8 +2,11 @@
2
2
  * OpenAPI spec resolver using @redocly/openapi-core
3
3
  *
4
4
  * Handles both OpenAPI 3.0 and 3.1 specifications.
5
- * Resolves all $ref pointers and produces fully dereferenced documents.
5
+ * Uses Redocly to bundle external refs into a single document,
6
+ * then uses the core ref-resolver to dereference internal $refs
7
+ * (which handles circular references safely).
6
8
  */
9
+ import { resolveRefs } from '@contractual/differs.core';
7
10
  /**
8
11
  * Resolve an OpenAPI spec file to a fully dereferenced object
9
12
  *
@@ -22,8 +25,13 @@ export async function resolveOpenApiSpec(specPath) {
22
25
  throw new Error('OpenAPI diffing requires @redocly/openapi-core. ' +
23
26
  'Install it with: npm install @redocly/openapi-core');
24
27
  }
28
+ // Bundle only (no dereference) — resolves external refs into one document
29
+ // but keeps internal $refs intact to avoid circular object references
25
30
  const config = await loadConfig();
26
- const result = await bundle({ ref: specPath, config, dereference: true });
27
- return result.bundle.parsed;
31
+ const result = await bundle({ ref: specPath, config });
32
+ const bundled = result.bundle.parsed;
33
+ // Use our own ref-resolver which handles circular refs safely
34
+ const resolved = resolveRefs(bundled);
35
+ return resolved.schema;
28
36
  }
29
37
  //# sourceMappingURL=resolver.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAgB;IACvD,IAAI,MAAqD,CAAC;IAC1D,IAAI,UAA6D,CAAC;IAElE,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACtD,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACxB,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,kDAAkD;YAChD,oDAAoD,CACvD,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1E,OAAO,MAAM,CAAC,MAAM,CAAC,MAAiC,CAAC;AACzD,CAAC"}
1
+ {"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,QAAgB;IACvD,IAAI,MAAqD,CAAC;IAC1D,IAAI,UAA6D,CAAC;IAElE,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,uBAAuB,CAAC,CAAC;QACtD,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QACxB,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CACb,kDAAkD;YAChD,oDAAoD,CACvD,CAAC;IACJ,CAAC;IAED,0EAA0E;IAC1E,sEAAsE;IACtE,MAAM,MAAM,GAAG,MAAM,UAAU,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;IACvD,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,MAAiC,CAAC;IAEhE,8DAA8D;IAC9D,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO,QAAQ,CAAC,MAAiC,CAAC;AACpD,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@contractual/differs.openapi",
3
3
  "private": false,
4
- "version": "0.1.0-dev.1",
4
+ "version": "0.1.0-dev.3",
5
5
  "description": "OpenAPI 3.0/3.1 breaking change detection for Contractual",
6
6
  "license": "MIT",
7
7
  "type": "module",
@@ -30,24 +30,16 @@
30
30
  "README.md"
31
31
  ],
32
32
  "dependencies": {
33
- "@contractual/differs.core": "0.1.0-dev.1",
34
- "@contractual/types": "0.1.0-dev.1"
35
- },
36
- "peerDependencies": {
33
+ "@contractual/differs.core": "0.1.0-dev.3",
34
+ "@contractual/types": "0.1.0-dev.3",
37
35
  "@redocly/openapi-core": "^1.0.0"
38
36
  },
39
- "peerDependenciesMeta": {
40
- "@redocly/openapi-core": {
41
- "optional": true
42
- }
43
- },
44
37
  "devDependencies": {
45
- "@redocly/openapi-core": "^1.0.0",
46
38
  "rimraf": "^5.0.5"
47
39
  },
48
40
  "publishConfig": {
49
41
  "access": "public",
50
42
  "provenance": true
51
43
  },
52
- "gitHead": "9370397e0aa15062baf62aa5ce07d93329339165"
44
+ "gitHead": "6a8c46482574388069e19a8fee69c097c8a5ec47"
53
45
  }