diff --git a/packages/elements-core/src/components/Docs/Model/Model.spec.tsx b/packages/elements-core/src/components/Docs/Model/Model.spec.tsx index 6c3a39c5e..15596fab0 100644 --- a/packages/elements-core/src/components/Docs/Model/Model.spec.tsx +++ b/packages/elements-core/src/components/Docs/Model/Model.spec.tsx @@ -31,6 +31,54 @@ const exampleStringSchema: JSONSchema7 = { description: 'example schema description that should only show once :)', }; +const model_data: JSONSchema7 = { + title: 'operator_reference', + description: 'description from allOf Operator', + allOf: [ + { + $ref: '#/%24defs/bird', + }, + { + $ref: '#/%24defs/animal', + }, + ], + + $defs: { + bird: { + type: 'object', + title: 'bird', + description: 'this is bird model', + properties: { + id: { + type: 'string', + }, + bird_type: { + type: 'string', + }, + }, + }, + animal: { + $ref: '#/%24defs/bird', + title: 'animal', + description: 'This is from Animal model', + }, + }, +}; +const props = { + nodeTitle: 'operator_reference', + layoutOptions: { + hideExport: false, + }, + exportProps: { + original: { + href: 'https://stoplight-local.com:8443/api/v1/projects/venkat/stop-95/nodes/models/operator_reference.yaml?fromExportButton=true&snapshotType=model', + }, + bundled: { + href: 'https://api.stoplight-local.com:8443/projects/cHJqOjE2NA/branches/main/export/models/operator_reference.yaml', + }, + }, +}; + describe('Model', () => { it('displays examples', async () => { const { container } = render(); @@ -237,5 +285,14 @@ describe('Model', () => { unmount(); }); + it('CombineSchema must have description', () => { + render(); + // const elem = screen.getByRole('paragraph', { name: /This is from Operaror_reference/ }); + const elem = screen.getAllByText(/description from allOf Operator/); + + // expect('This is from Operaror_reference').toBeInTheDocument(); + // expect(elem).toBeInTheDocument(); + expect(elem[0]).toBeInTheDocument(); + }); }); }); diff --git a/packages/elements-core/src/components/Docs/Model/Model.tsx b/packages/elements-core/src/components/Docs/Model/Model.tsx index b919c83dd..35ad860fc 100644 --- a/packages/elements-core/src/components/Docs/Model/Model.tsx +++ b/packages/elements-core/src/components/Docs/Model/Model.tsx @@ -71,7 +71,7 @@ const ModelComponent: React.FC = ({ const descriptionChanged = nodeHasChanged?.({ nodeId, attr: 'description' }); const description = ( - {data.description && data.type === 'object' && ( + {data.description && (