Skip to main content
Question

How to describe object fields in a CLI request for entity creation


I have this format for a request to create an entity 
 

{
	authorId: 3,
	entityType: 'comment',
	entityId: 711,
	message: 'Test comment message',
	date: 1734076669,
	mentioned: {
		users: [1, 3],
		groups: [4, 1, 2],
		departments: []
	},
	parent: {
		id: 711,
		entityType: 'task',
		entityId: 1070,
		authorId: 3,
		message: 'Parent message',
		date: 1734076669,
		pinned: null,
		notify: null,
		mentioned: null
	}
}

How do I describe the parent and mentioned fields that are objects? 

Of course, I can describe it like this, but I'll get an array of objects back, which is not correct. You can also see that I added a prefix, because if I have another field with the same name, the fields will not render correctly, even if these fields are described at different levels.

{
		key: 'mentioned',
		label: 'Mentioned',
		children: [
			{
				key: 'mentioned:users',
				label: 'Mentioned: Users',
				type: 'integer',
				list: true
			},
			{
				key: 'mentioned:groups',
				label: 'Mentioned: Groups',
				type: 'integer',
				list: true
			},
			{
				key: 'mentioned:departments',
				label: 'Mentioned: Departments',
				type: 'integer',
				list: true
			}
		]
	},

 

Did this topic help you find an answer to your question?

0 replies

Be the first to reply!