1750 extensibility twenty sdk v2 use twenty sdk to define an object (#15230)

We maintain jsonc object definition but will deprecate them pretty soon

## Before
<img width="1512" height="575" alt="image"
src="https://github.com/user-attachments/assets/d2fa6ca4-c456-4aa9-a1e3-845b61839718"
/>

## After
<img width="1260" height="555" alt="image"
src="https://github.com/user-attachments/assets/ba72f4cf-d443-4967-913c-029bc71f3f48"
/>
This commit is contained in:
martmull
2025-10-22 15:18:23 +02:00
committed by GitHub
parent 32558673c6
commit 033c28a3d5
25 changed files with 440 additions and 25 deletions
@@ -0,0 +1,21 @@
import { getDecoratedClass } from '../../utils/get-decorated-class';
describe('getDecoratedClass', () => {
it('should return properly formatted class', () => {
const result = getDecoratedClass({
data: { nameSingular: 'Name', namePlural: 'Names' },
name: 'MyNewObject',
});
const expectedResult = `import { ObjectMetadata } from 'twenty-sdk';
@ObjectMetadata({
nameSingular: 'Name',
namePlural: 'Names',
})
export class MyNewObject {}
`;
expect(result).toEqual(expectedResult);
});
});