@trayio/tray-schema 4.64.0 → 4.65.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 +1 @@
1
- {"version":3,"file":"TJSTraySchemaGenerator.d.ts","sourceRoot":"","sources":["../../src/schema/TJSTraySchemaGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAQ,MAAM,cAAc,CAAC;AAE5C,OAAO,EACN,aAAa,EAEb,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,sBAAuB,YAAW,mBAAmB;IACjE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC;IA2C1E,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa;CA8L5D"}
1
+ {"version":3,"file":"TJSTraySchemaGenerator.d.ts","sourceRoot":"","sources":["../../src/schema/TJSTraySchemaGenerator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAQ,MAAM,cAAc,CAAC;AAE5C,OAAO,EACN,aAAa,EAEb,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,qBAAa,sBAAuB,YAAW,mBAAmB;IACjE,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC;IA4C1E,sBAAsB,CAAC,MAAM,EAAE,aAAa,GAAG,aAAa;CA8L5D"}
@@ -43,6 +43,7 @@ class TJSTraySchemaGenerator {
43
43
  'advanced',
44
44
  'dropdown',
45
45
  'dynamicSchemaReference',
46
+ 'default_jsonpath',
46
47
  ],
47
48
  // adds a required array to every entitiy in the schema which describes which children are required
48
49
  required: true,
@@ -385,6 +385,27 @@ describe('TJSTraySchemaGenerator', () => {
385
385
  };
386
386
  expect(actual).toEqual(expected);
387
387
  });
388
+ it('Generates default_jsonpath properties from JSdoc annotations', () => {
389
+ const type = 'Input';
390
+ const dirPath = __dirname;
391
+ const path = (0, path_1.join)(dirPath, 'default_jsonpath.test.data.ts');
392
+ const result = new TJSTraySchemaGenerator_1.TJSTraySchemaGenerator().generateFromType(type, path);
393
+ const actual = E.getOrElse((error) => {
394
+ console.warn(error);
395
+ throw new Error(`Failed to generate JSON schema from type`);
396
+ })(result);
397
+ const expected = {
398
+ type: 'object',
399
+ properties: {
400
+ str: { default_jsonpath: '$env.foo', type: 'string' },
401
+ },
402
+ advanced: [],
403
+ required: ['str'],
404
+ additionalProperties: false,
405
+ $schema: 'http://json-schema.org/draft-07/schema#',
406
+ };
407
+ expect(actual).toEqual(expected);
408
+ });
388
409
  it('Generates advanced fields array', () => {
389
410
  const type = 'Input';
390
411
  const dirPath = __dirname;
@@ -0,0 +1,7 @@
1
+ export type Input = {
2
+ /**
3
+ * @default_jsonpath $env.foo
4
+ */
5
+ str: string;
6
+ };
7
+ //# sourceMappingURL=default_jsonpath.test.data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default_jsonpath.test.data.d.ts","sourceRoot":"","sources":["../../src/schema/default_jsonpath.test.data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG;IACnB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;CACZ,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trayio/tray-schema",
3
- "version": "4.64.0",
3
+ "version": "4.65.0",
4
4
  "description": "Schema for Tray connectors and authentications",
5
5
  "exports": {
6
6
  "./*": "./dist/*.js"
@@ -11,7 +11,7 @@
11
11
  "access": "public"
12
12
  },
13
13
  "dependencies": {
14
- "@trayio/commons": "4.64.0",
14
+ "@trayio/commons": "4.65.0",
15
15
  "@types/node": "18.11.9",
16
16
  "lodash": "4.17.21",
17
17
  "typescript-json-schema": "0.62.0"