Skip to content

Commit a4609ca

Browse files
committed
fix: update import model schema to use definitions from ModelDefinitionV1Beta1OpenApiSchema
Signed-off-by: amitamrutiya <[email protected]>
1 parent 7eaebfb commit a4609ca

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/schemas/importModel/schema.tsx

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
1+
import { ModelDefinitionV1Beta1OpenApiSchema } from '@layer5/schemas';
2+
3+
const ModelSchema = ModelDefinitionV1Beta1OpenApiSchema.components.schemas;
14
const importModelSchema = {
25
type: 'object',
36
required: ['uploadType'],
47
properties: {
58
uploadType: {
6-
type: 'string',
9+
type: ModelSchema.ImportRequest.properties.uploadType.type,
710
title: 'Upload method',
811
enum: ['File Import', 'URL Import', 'CSV Import'],
9-
enumDescriptions: [
10-
'Upload a model file (.tar, .tar.gz, .tgz) from your local system',
11-
'Import a model file using a direct URL to the source',
12-
'Upload separate CSV files for model definitions, components, and their relationships'
13-
],
12+
enumDescriptions: ModelSchema.ImportRequest.properties.uploadType.enumDescriptions,
1413
default: 'Select the Upload Method',
1514
'x-rjsf-grid-area': '12',
16-
description:
17-
"Choose the method you prefer to upload your model file. Select 'File Import' or 'CSV Import' if you have the file on your local system or 'URL Import' if you have the file hosted online."
15+
description: ModelSchema.ImportRequest.properties.uploadType.description
1816
}
1917
},
2018
allOf: [
@@ -29,10 +27,9 @@ const importModelSchema = {
2927
then: {
3028
properties: {
3129
file: {
32-
type: 'string',
33-
format: 'file',
34-
description:
35-
'Supported model file formats are: .tar, .tar.gz, and .tgz. See [Import Models Documentation](https://docs.meshery.io/guides/configuration-management/importing-models#import-models-using-meshery-ui) for details',
30+
type: ModelSchema.ImportBody.oneOf[0].properties.modelFile?.type,
31+
format: ModelSchema.ImportBody.oneOf[0].properties.modelFile?.format,
32+
description: ModelSchema.ImportBody.oneOf[0].properties.modelFile?.description,
3633
'x-rjsf-grid-area': '12'
3734
}
3835
},
@@ -50,11 +47,10 @@ const importModelSchema = {
5047
then: {
5148
properties: {
5249
url: {
53-
type: 'string',
54-
format: 'uri',
50+
type: ModelSchema.ImportBody.oneOf[1].properties.url?.type,
51+
format: ModelSchema.ImportBody.oneOf[1].properties.url?.format,
5552
title: 'URL',
56-
description:
57-
'A direct URL to a single model file, for example: https://raw.github.com/your-model-file.tar. Supported model file formats are: .tar, .tar.gz, and .tgz. \n\nFor bulk import of your model use the GitHub connection or CSV files. See [Import Models Documentation](https://docs.meshery.io/guides/configuration-management/importing-models#import-models-using-meshery-ui) for details',
53+
description: ModelSchema.ImportBody.oneOf[1].properties.url?.description,
5854
'x-rjsf-grid-area': '12',
5955
disabled: true
6056
}

0 commit comments

Comments
 (0)