Skip to content

Commit 595518d

Browse files
committed
fix(schemas): align importDesign with oneOf[File|URL] shape, bump 0.19.1
meshery/schemas commit b08a4f62 tightened MesheryPatternImportRequestBody from a flat properties object to `oneOf: [MesheryPatternImportFilePayload, MesheryPatternImportURLPayload]`. That contract shipped in @meshery/schemas@1.1.0 and is re-exposed here via the bundled DesignDefinitionV1Beta1OpenApiSchema. The form schema in importDesign/schema.tsx still walked `.properties.name`, `.properties.file`, `.properties.url` at the root of the request body. With the new shape those paths resolve to undefined and module evaluation throws TypeError: Cannot read properties of undefined (reading 'name') the moment any consumer imports from `@sistent/sistent`. Because Sistent bundles @meshery/schemas inline (tsup `noExternal`), every downstream Next.js SSR build ships the same crash at `Collecting page data` — notably meshery-cloud staging on @sistent/sistent@0.19.0. Resolve the field shapes from the explicit `MesheryPatternImportFilePayload` and `MesheryPatternImportURLPayload` components so the UI schema continues to be driven by the API contract rather than duplicating it. `name` and `file` come from the File variant, `url` from the URL variant; the top-level description is still sourced from the wrapper. Bump to 0.19.1 so consumers pinned `^0.19.0` pick up the fix on next install with no version-bump on their side. Signed-off-by: Lee Calcote <lee.calcote@layer5.io>
1 parent ad11628 commit 595518d

3 files changed

Lines changed: 30 additions & 13 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@sistent/sistent",
3-
"version": "0.19.0",
3+
"version": "0.19.1",
44
"description": "Reusable React Components and SVG Icons library",
55
"repository": {
66
"type": "git",

src/schemas/importDesign/schema.tsx

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,40 @@ import { DesignDefinitionV1Beta1OpenApiSchema } from '@meshery/schemas';
33
// eslint-disable-next-line @typescript-eslint/no-explicit-any
44
const DesignSchema = (DesignDefinitionV1Beta1OpenApiSchema as any).components.schemas;
55

6+
// In @meshery/schemas >= 1.1.0, MesheryPatternImportRequestBody is a
7+
// `oneOf` union of a File-import variant and a URL-import variant rather than
8+
// a flat properties object. Resolve the individual field shapes from the
9+
// dedicated payload components so the form schema remains driven by the
10+
// upstream API contract.
11+
// See meshery/schemas commit b08a4f62 "fix(design): tighten
12+
// MesheryPatternImportRequestBody to oneOf[File|URL]".
13+
const ImportBody = DesignSchema.MesheryPatternImportRequestBody;
14+
const FilePayload = DesignSchema.MesheryPatternImportFilePayload;
15+
const URLPayload = DesignSchema.MesheryPatternImportURLPayload;
16+
17+
// `name` is a common field present on both variants; File is used as the
18+
// canonical source.
19+
const nameField = FilePayload.properties.name;
20+
const fileField = FilePayload.properties.file;
21+
const urlField = URLPayload.properties.url;
22+
623
const importDesignSchema = {
724
type: 'object',
825
properties: {
926
name: {
10-
type: DesignSchema.MesheryPatternImportRequestBody.properties.name.type,
27+
type: nameField.type,
1128
title: 'Design file name',
12-
default: DesignSchema.MesheryPatternImportRequestBody.properties.name.default,
29+
default: nameField.default,
1330
'x-rjsf-grid-area': '12',
14-
description: DesignSchema.MesheryPatternImportRequestBody.properties.name.description
31+
description: nameField.description
1532
},
1633

1734
uploadType: {
1835
title: 'Upload method',
1936
enum: ['File Upload', 'URL Import'],
2037
default: 'URL Import',
2138
'x-rjsf-grid-area': '12',
22-
description: DesignSchema.MesheryPatternImportRequestBody.description
39+
description: ImportBody.description
2340
}
2441
},
2542

@@ -35,9 +52,9 @@ const importDesignSchema = {
3552
then: {
3653
properties: {
3754
file: {
38-
type: DesignSchema.MesheryPatternImportRequestBody.properties.file.type,
39-
format: DesignSchema.MesheryPatternImportRequestBody.properties.file.format,
40-
description: DesignSchema.MesheryPatternImportRequestBody.properties.file.description,
55+
type: fileField.type,
56+
format: fileField.format,
57+
description: fileField.description,
4158
'x-rjsf-grid-area': '12'
4259
}
4360
},
@@ -55,10 +72,10 @@ const importDesignSchema = {
5572
then: {
5673
properties: {
5774
url: {
58-
type: DesignSchema.MesheryPatternImportRequestBody.properties.url.type,
59-
format: DesignSchema.MesheryPatternImportRequestBody.properties.url.format,
75+
type: urlField.type,
76+
format: urlField.format,
6077
title: 'URL',
61-
description: DesignSchema.MesheryPatternImportRequestBody.properties.url.description,
78+
description: urlField.description,
6279
'x-rjsf-grid-area': '12'
6380
}
6481
},

0 commit comments

Comments
 (0)