json-machete 0.9.3-alpha-e2a116370.0 → 0.10.0

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.
@@ -1,2 +1,4 @@
1
1
  import { JSONSchema } from './types';
2
- export declare function healJSONSchema(schema: JSONSchema): Promise<any>;
2
+ export declare function healJSONSchema(schema: JSONSchema, options?: {
3
+ noDeduplication?: boolean;
4
+ }): Promise<JSONSchema>;
package/index.js CHANGED
@@ -563,8 +563,8 @@ async function getDeduplicatedTitles(schema) {
563
563
  });
564
564
  return duplicatedTypeNames;
565
565
  }
566
- async function healJSONSchema(schema) {
567
- const deduplicatedSchema = deduplicateJSONSchema(schema);
566
+ async function healJSONSchema(schema, options = {}) {
567
+ const deduplicatedSchema = (options === null || options === void 0 ? void 0 : options.noDeduplication) ? schema : deduplicateJSONSchema(schema);
568
568
  const duplicatedTypeNames = await getDeduplicatedTitles(deduplicatedSchema);
569
569
  return visitJSONSchema(deduplicatedSchema, async function healSubschema(subSchema, { path }) {
570
570
  if (typeof subSchema === 'object') {
@@ -691,7 +691,7 @@ async function healJSONSchema(schema) {
691
691
  mode: 'first',
692
692
  },
693
693
  });
694
- const healedGeneratedSchema = await healJSONSchema(generatedSchema);
694
+ const healedGeneratedSchema = await healJSONSchema(generatedSchema, options);
695
695
  subSchema.type = asArray(healedGeneratedSchema.type)[0];
696
696
  subSchema.properties = healedGeneratedSchema.properties;
697
697
  // If type for properties is already given, use it
package/index.mjs CHANGED
@@ -558,8 +558,8 @@ async function getDeduplicatedTitles(schema) {
558
558
  });
559
559
  return duplicatedTypeNames;
560
560
  }
561
- async function healJSONSchema(schema) {
562
- const deduplicatedSchema = deduplicateJSONSchema(schema);
561
+ async function healJSONSchema(schema, options = {}) {
562
+ const deduplicatedSchema = (options === null || options === void 0 ? void 0 : options.noDeduplication) ? schema : deduplicateJSONSchema(schema);
563
563
  const duplicatedTypeNames = await getDeduplicatedTitles(deduplicatedSchema);
564
564
  return visitJSONSchema(deduplicatedSchema, async function healSubschema(subSchema, { path }) {
565
565
  if (typeof subSchema === 'object') {
@@ -686,7 +686,7 @@ async function healJSONSchema(schema) {
686
686
  mode: 'first',
687
687
  },
688
688
  });
689
- const healedGeneratedSchema = await healJSONSchema(generatedSchema);
689
+ const healedGeneratedSchema = await healJSONSchema(generatedSchema, options);
690
690
  subSchema.type = asArray(healedGeneratedSchema.type)[0];
691
691
  subSchema.properties = healedGeneratedSchema.properties;
692
692
  // If type for properties is already given, use it
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "json-machete",
3
- "version": "0.9.3-alpha-e2a116370.0",
3
+ "version": "0.10.0",
4
4
  "sideEffects": false,
5
5
  "dependencies": {
6
6
  "@graphql-mesh/cross-helpers": "0.2.0",
7
- "@graphql-mesh/utils": "0.37.1-alpha-e2a116370.0",
7
+ "@graphql-mesh/utils": "0.37.1",
8
8
  "@graphql-tools/utils": "8.8.0",
9
9
  "@json-schema-tools/meta-schema": "1.6.19",
10
10
  "cross-undici-fetch": "^0.4.0",