Skip to content

Commit

Permalink
feat: Export segments limited info (#3109)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwasniew committed Feb 14, 2023
1 parent f071922 commit b1728c5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 10 deletions.
Expand Up @@ -156,10 +156,8 @@ export const ValidationStage: FC<{
show={
<ErrorContainer>
<ErrorHeader>
<strong>Conflict!</strong> There are some
configurations that don't exist in the current
instance and need to be created before importing
this configuration
<strong>Conflict!</strong> There are some errors
that need to be fixed before the import.
</ErrorHeader>
{validationResult.errors.map(error => (
<Box key={error.message} sx={{ p: 2 }}>
Expand Down
14 changes: 11 additions & 3 deletions src/lib/openapi/spec/export-result-schema.ts
Expand Up @@ -4,7 +4,6 @@ import { featureStrategySchema } from './feature-strategy-schema';
import { featureEnvironmentSchema } from './feature-environment-schema';
import { contextFieldSchema } from './context-field-schema';
import { featureTagSchema } from './feature-tag-schema';
import { segmentSchema } from './segment-schema';
import { parametersSchema } from './parameters-schema';
import { legalValueSchema } from './legal-value-schema';
import { variantSchema } from './variant-schema';
Expand Down Expand Up @@ -52,7 +51,17 @@ export const exportResultSchema = {
segments: {
type: 'array',
items: {
$ref: '#/components/schemas/segmentSchema',
type: 'object',
additionalProperties: false,
required: ['id'],
properties: {
id: {
type: 'number',
},
name: {
type: 'string',
},
},
},
},
tagTypes: {
Expand All @@ -69,7 +78,6 @@ export const exportResultSchema = {
featureEnvironmentSchema,
contextFieldSchema,
featureTagSchema,
segmentSchema,
variantsSchema,
variantSchema,
overrideSchema,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/services/export-import-service.ts
Expand Up @@ -150,8 +150,8 @@ export default class ExportImportService {
}),
featureTags,
segments: filteredSegments.map((item) => {
const { createdAt, createdBy, ...rest } = item;
return rest;
const { id, name } = item;
return { id, name };
}),
tagTypes: filteredTagTypes,
};
Expand Down
14 changes: 13 additions & 1 deletion src/test/e2e/api/openapi/__snapshots__/openapi.e2e.test.ts.snap
Expand Up @@ -1107,7 +1107,19 @@ exports[`should serve the OpenAPI spec 1`] = `
},
"segments": {
"items": {
"$ref": "#/components/schemas/segmentSchema",
"additionalProperties": false,
"properties": {
"id": {
"type": "number",
},
"name": {
"type": "string",
},
},
"required": [
"id",
],
"type": "object",
},
"type": "array",
},
Expand Down

0 comments on commit b1728c5

Please sign in to comment.