@takeshape/schema 8.182.1 → 8.183.2
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.
- package/dist/get-is-leaf.js +1 -1
- package/dist/types/utils.d.ts +1 -2
- package/dist/types/utils.d.ts.map +1 -1
- package/dist/types/utils.js +0 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +6 -19
- package/es/get-is-leaf.js +1 -1
- package/es/types/utils.js +1 -2
- package/es/validate.js +7 -20
- package/package.json +4 -4
package/dist/get-is-leaf.js
CHANGED
|
@@ -20,7 +20,7 @@ function isLeafTypeV3(projectSchema, propertySchema) {
|
|
|
20
20
|
return Boolean( // Must have key
|
|
21
21
|
(0, _schemaUtil.getKey)(propertySchema) && ( // If is not a structure, then is a leaf
|
|
22
22
|
!['object', 'array'].includes(type) || // If is relationship, then is a leaf
|
|
23
|
-
(0, _types.isPropertySchemaWithRelationship)(propertySchema) || propertySchema['@tag'] && scalarTags.has(propertySchema['@tag']) || // If is array, then should not be a synchronized structure
|
|
23
|
+
(0, _types.isPropertySchemaWithRelationship)(propertySchema['@output'] ?? propertySchema) || propertySchema['@tag'] && scalarTags.has(propertySchema['@tag']) || // If is array, then should not be a synchronized structure
|
|
24
24
|
type === 'array' && !propertySchema['@syncLocaleStructure'] || (0, _schemaUtil.isBuiltinType)(projectSchema, propertySchema)));
|
|
25
25
|
}
|
|
26
26
|
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { ProjectSchema, DirectiveMappingArray, DirectiveMappingMap, DirectiveConfig, ParameterSerializeOptions, ParameterSerializeContentOptions, ParameterSerializeStyleOptions, BasicResolver, ComposeResolver, GraphqlResolver, TakeshapeResolver, RestResolver, AwsLambdaResolver, UtilResolver, ObjectSchema, ReturnShapeArraySchema, ShapeSchemaEnum, RefSchema, RefSchemaLegacy, PropertySchema, AnyServiceConfig, ServiceAuthentication, BearerAuthentication, BasicAuthentication, OAuth2Authentication, OAuth2BearerAuthentication, SearchParamsAuthentication, CustomAuthentication, ParameterOp, ParameterOpNested, ParameterOpMapping, ParameterOpValue, ParameterOpOp, ParameterSerializeStyleOptionsForSearchParams, ParameterSerializeStyleOptionsForPathParams, OneOfSchema, AllOfSchema, ExtendsSchema } from '../project-schema';
|
|
2
2
|
import type { Maybe } from '@takeshape/util';
|
|
3
|
-
import type { ShopifyServiceConfig, RESTServiceConfig, GraphQLServiceConfig, OpenAPIServiceConfig, EncryptedServiceConfig, SchemaWithArgs, SchemaWithRef, ServiceConfigWithOAuth2Authentication, ServiceConfigWithCustomAuthentication, LatestProjectSchemaWithServices, ProjectSchemaV3X } from './types';
|
|
3
|
+
import type { ShopifyServiceConfig, RESTServiceConfig, GraphQLServiceConfig, OpenAPIServiceConfig, EncryptedServiceConfig, SchemaWithArgs, SchemaWithRef, ServiceConfigWithOAuth2Authentication, ServiceConfigWithCustomAuthentication, LatestProjectSchemaWithServices, ProjectSchemaV3X, PropertySchemaWithRelationship } from './types';
|
|
4
4
|
import { ArgsType, RefType } from './types';
|
|
5
|
-
import { PropertySchemaWithRelationship } from '.';
|
|
6
5
|
/** Resolver Type Utils **/
|
|
7
6
|
/**
|
|
8
7
|
* Only tests that the shape is right, not that the name is correct. That's a job for the validator.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,gCAAgC,EAChC,8BAA8B,EAC9B,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,6CAA6C,EAC7C,2CAA2C,EAC3C,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb,qCAAqC,EACrC,qCAAqC,EACrC,+BAA+B,EAC/B,gBAAgB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/types/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,eAAe,EACf,yBAAyB,EACzB,gCAAgC,EAChC,8BAA8B,EAC9B,aAAa,EACb,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,SAAS,EACT,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,0BAA0B,EAC1B,0BAA0B,EAC1B,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,6CAA6C,EAC7C,2CAA2C,EAC3C,WAAW,EACX,WAAW,EACX,aAAa,EACd,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAE3C,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,aAAa,EACb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B,CAElH;AAED,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,qBAAqB,GACpC,cAAc,IAAI,0BAA0B,CAE9C;AAED,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,qBAAqB,GAAG,cAAc,IAAI,oBAAoB,CAEpH;AAED,wBAAgB,4BAA4B,CAC1C,cAAc,EAAE,qBAAqB,GACpC,cAAc,IAAI,0BAA0B,CAE9C;AAED,wBAAgB,sBAAsB,CAAC,cAAc,EAAE,qBAAqB,GAAG,cAAc,IAAI,oBAAoB,CAEpH;AAED,2BAA2B;AAE3B;;;;GAIG;AACH,eAAO,MAAM,WAAW,eAAgB,cAAc,KAAG,MAAM,QAAQ,CAQtE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,cAAe,aAAa,KAAG,MAAM,OAAO,CAQlE,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,cAAc,GAAG,MAAM,IAAI,8BAA8B,CAEjH"}
|
package/dist/types/utils.js
CHANGED
|
@@ -381,6 +381,5 @@ exports.getRefType = getRefType;
|
|
|
381
381
|
function isPropertySchemaWithRelationship(schema) {
|
|
382
382
|
var _schema$Resolver;
|
|
383
383
|
|
|
384
|
-
schema = schema['@output'] ?? schema;
|
|
385
384
|
return ((_schema$Resolver = schema['@resolver']) === null || _schema$Resolver === void 0 ? void 0 : _schema$Resolver.name) === 'takeshape:getRelated';
|
|
386
385
|
}
|
package/dist/validate.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/validate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,WAAW,EAAC,MAAM,KAAK,CAAC;AACvD,OAAO,KAAK,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC1D,OAAO,KAAK,EAAmB,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACzE,OAAO,KAAK,EAEV,gBAAgB,EAChB,aAAa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AY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,iBAAiB,GAAG,SAAS,CAAC;CACnE;AAqKD;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,sBAAsB,CAqB9F;AAED,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,aAAa,CAgBnE;AAgBD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,cAAc,EAAE,OAAO,GAAG,SAAS,CAQpE;AAgBD;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,OAAO,GAAG,UAAU,CAQlE;AAqBD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,WAAW,EAAE,OAAO,GAAG,mBAAmB,CAarF"}
|
package/dist/validate.js
CHANGED
|
@@ -472,25 +472,12 @@ function validateOneOfs(projectSchema) {
|
|
|
472
472
|
const relationship = (0, _relationships.getRelationship)(property);
|
|
473
473
|
const schema = property.items ? property.items : property;
|
|
474
474
|
|
|
475
|
-
if (schema.oneOf && !relationship) {
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
errors.push({
|
|
482
|
-
type: 'json',
|
|
483
|
-
path: propertyPath.concat(oneOfPath),
|
|
484
|
-
message: `Invalid refs to ${shapeNames}. oneOf unions cannot reference model shapes. Use @relationship instead`
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
} else if (!(0, _enum.isEnumLikeSchema)(schema)) {
|
|
488
|
-
errors.push({
|
|
489
|
-
type: 'json',
|
|
490
|
-
path: propertyPath.concat(oneOfPath),
|
|
491
|
-
message: `Invalid oneOf must contain only @ref or title + enum/const schemas`
|
|
492
|
-
});
|
|
493
|
-
}
|
|
475
|
+
if (schema.oneOf && !relationship && !(0, _unions.isUnionSchema)(schema) && !(0, _enum.isEnumLikeSchema)(schema)) {
|
|
476
|
+
errors.push({
|
|
477
|
+
type: 'json',
|
|
478
|
+
path: propertyPath.concat(oneOfPath),
|
|
479
|
+
message: `Invalid oneOf must contain only @ref or title + enum/const schemas`
|
|
480
|
+
});
|
|
494
481
|
}
|
|
495
482
|
});
|
|
496
483
|
return errors;
|
package/es/get-is-leaf.js
CHANGED
|
@@ -9,7 +9,7 @@ function isLeafTypeV3(projectSchema, propertySchema) {
|
|
|
9
9
|
return Boolean( // Must have key
|
|
10
10
|
getKey(propertySchema) && ( // If is not a structure, then is a leaf
|
|
11
11
|
!['object', 'array'].includes(type) || // If is relationship, then is a leaf
|
|
12
|
-
isPropertySchemaWithRelationship(propertySchema) || propertySchema['@tag'] && scalarTags.has(propertySchema['@tag']) || // If is array, then should not be a synchronized structure
|
|
12
|
+
isPropertySchemaWithRelationship(propertySchema['@output'] ?? propertySchema) || propertySchema['@tag'] && scalarTags.has(propertySchema['@tag']) || // If is array, then should not be a synchronized structure
|
|
13
13
|
type === 'array' && !propertySchema['@syncLocaleStructure'] || isBuiltinType(projectSchema, propertySchema)));
|
|
14
14
|
}
|
|
15
15
|
|
package/es/types/utils.js
CHANGED
|
@@ -7,12 +7,12 @@ import isArray from 'lodash/isArray';
|
|
|
7
7
|
import has from 'lodash/has';
|
|
8
8
|
import { latestSchemaJson } from '../schemas';
|
|
9
9
|
import satisfies from 'semver/functions/satisfies';
|
|
10
|
-
|
|
11
10
|
/** Resolver Type Utils **/
|
|
12
11
|
|
|
13
12
|
/**
|
|
14
13
|
* Only tests that the shape is right, not that the name is correct. That's a job for the validator.
|
|
15
14
|
*/
|
|
15
|
+
|
|
16
16
|
export function isBasicResolver(resolver) {
|
|
17
17
|
return isString(resolver === null || resolver === void 0 ? void 0 : resolver.name) && isString(resolver.service);
|
|
18
18
|
}
|
|
@@ -267,6 +267,5 @@ export const getRefType = refSchema => {
|
|
|
267
267
|
export function isPropertySchemaWithRelationship(schema) {
|
|
268
268
|
var _schema$Resolver;
|
|
269
269
|
|
|
270
|
-
schema = schema['@output'] ?? schema;
|
|
271
270
|
return ((_schema$Resolver = schema['@resolver']) === null || _schema$Resolver === void 0 ? void 0 : _schema$Resolver.name) === 'takeshape:getRelated';
|
|
272
271
|
}
|
package/es/validate.js
CHANGED
|
@@ -18,7 +18,7 @@ import { isValidTemplate } from './template-shapes';
|
|
|
18
18
|
import { isBasicResolver, isComposeResolver } from './types/utils';
|
|
19
19
|
import { refItemToAtRef, refItemToShapeName, parseReturnShape } from './refs';
|
|
20
20
|
import { scalars } from './scalars';
|
|
21
|
-
import {
|
|
21
|
+
import { isUnionSchema } from './unions';
|
|
22
22
|
import { isEnumLikeSchema } from './enum';
|
|
23
23
|
import metaSchemaV3_9_0 from './schemas/project-schema/meta-schema-v3.9.0.json';
|
|
24
24
|
import { isIntegerLike } from '@takeshape/util';
|
|
@@ -433,25 +433,12 @@ function validateOneOfs(projectSchema) {
|
|
|
433
433
|
const relationship = getRelationship(property);
|
|
434
434
|
const schema = property.items ? property.items : property;
|
|
435
435
|
|
|
436
|
-
if (schema.oneOf && !relationship) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
errors.push({
|
|
443
|
-
type: 'json',
|
|
444
|
-
path: propertyPath.concat(oneOfPath),
|
|
445
|
-
message: `Invalid refs to ${shapeNames}. oneOf unions cannot reference model shapes. Use @relationship instead`
|
|
446
|
-
});
|
|
447
|
-
}
|
|
448
|
-
} else if (!isEnumLikeSchema(schema)) {
|
|
449
|
-
errors.push({
|
|
450
|
-
type: 'json',
|
|
451
|
-
path: propertyPath.concat(oneOfPath),
|
|
452
|
-
message: `Invalid oneOf must contain only @ref or title + enum/const schemas`
|
|
453
|
-
});
|
|
454
|
-
}
|
|
436
|
+
if (schema.oneOf && !relationship && !isUnionSchema(schema) && !isEnumLikeSchema(schema)) {
|
|
437
|
+
errors.push({
|
|
438
|
+
type: 'json',
|
|
439
|
+
path: propertyPath.concat(oneOfPath),
|
|
440
|
+
message: `Invalid oneOf must contain only @ref or title + enum/const schemas`
|
|
441
|
+
});
|
|
455
442
|
}
|
|
456
443
|
});
|
|
457
444
|
return errors;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@takeshape/schema",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.183.2",
|
|
4
4
|
"description": "TakeShape Schema",
|
|
5
5
|
"homepage": "https://www.takeshape.io",
|
|
6
6
|
"repository": {
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"examples"
|
|
22
22
|
],
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@takeshape/errors": "8.
|
|
25
|
-
"@takeshape/json-schema": "8.
|
|
26
|
-
"@takeshape/util": "8.
|
|
24
|
+
"@takeshape/errors": "8.183.2",
|
|
25
|
+
"@takeshape/json-schema": "8.183.2",
|
|
26
|
+
"@takeshape/util": "8.183.2",
|
|
27
27
|
"ajv": "^8.10.0",
|
|
28
28
|
"ajv-formats": "^2.1.1",
|
|
29
29
|
"blueimp-md5": "^2.10.0",
|