vovk-cli 0.0.1-draft.261 → 0.0.1-draft.263

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,5 +1,5 @@
1
1
  import { compile } from 'json-schema-to-typescript';
2
- function replaceUnresolvedRefs(schema, components = {}) {
2
+ function replaceUnresolvedRefs(schema, components) {
3
3
  if (schema === null || typeof schema !== 'object') {
4
4
  return schema;
5
5
  }
@@ -13,12 +13,12 @@ function replaceUnresolvedRefs(schema, components = {}) {
13
13
  }
14
14
  }
15
15
  if (Array.isArray(schema)) {
16
- return schema.map((item) => replaceUnresolvedRefs(item));
16
+ return schema.map((item) => replaceUnresolvedRefs(item, components));
17
17
  }
18
18
  else {
19
19
  const result = {};
20
20
  for (const [key, value] of Object.entries(schema)) {
21
- result[key] = replaceUnresolvedRefs(value);
21
+ result[key] = replaceUnresolvedRefs(value, components);
22
22
  }
23
23
  return result;
24
24
  }
@@ -26,7 +26,8 @@ function replaceUnresolvedRefs(schema, components = {}) {
26
26
  export async function compileJSONSchemaToTypeScriptType(schema, typeName, components = {}) {
27
27
  if (!schema)
28
28
  return '';
29
- schema = replaceUnresolvedRefs(schema);
29
+ schema = replaceUnresolvedRefs(schema, components);
30
+ components = replaceUnresolvedRefs(components, components);
30
31
  // tsType attribute isn't working with objects that use $ref, so we need to handle it separately
31
32
  if ('tsType' in schema && typeof schema.tsType === 'string')
32
33
  return `export type ${typeName} = ${schema.tsType};\n`;
@@ -40,6 +41,7 @@ export async function compileJSONSchemaToTypeScriptType(schema, typeName, compon
40
41
  tabWidth: 2,
41
42
  useTabs: false,
42
43
  trailingComma: 'all',
44
+ ignoreMinAndMaxItems: true,
43
45
  unreachableDefinitions: false,
44
46
  declareExternallyReferenced: false,
45
47
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.261",
3
+ "version": "0.0.1-draft.263",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },