Skip to content

Commit e071a48

Browse files
committed
allow json extension, schema tweaks
1 parent a93d7ff commit e071a48

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/routes/catalog/update.js

+3
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ export default async function update(ctx) {
2525
if (config.sku === '*') {
2626
return errorResponse(501, 'not implemented');
2727
}
28+
if (config.sku.endsWith('.json')) {
29+
config.sku = config.sku.slice(0, -5);
30+
}
2831

2932
assertValidProduct(data);
3033

src/schemas/ProductBus.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ const ProductBusVariant = {
6464
gtin: { type: 'string' },
6565
availability: SchemaOrgAvailability,
6666
},
67-
required: ['sku', 'title', 'url', 'image', 'availability'],
67+
required: ['sku', 'title', 'url', 'image'],
6868
};
6969

7070
/** @type {import("../utils/validation.js").AnySchema} */
7171
const ProductBusEntry = {
7272
type: 'object',
7373
properties: {
74-
sku: { type: 'string', 'not.pattern': /^[A-Z\s]+$/ },
75-
urlKey: { type: 'string' },
74+
sku: { type: 'string' },
75+
urlKey: { type: 'string', 'not.pattern': /^[A-Z\s]+$/ },
7676
description: { type: 'string' },
7777
title: { type: 'string' },
7878
metaTitle: { type: 'string' },

0 commit comments

Comments
 (0)