Update field's fieldset returns error

Just like the title says, I’m trying to update a Field’s fieldset property and I get the following error back:

#/data: failed schema #/definitions/field/links/1/schema/properties/data: "attributes" wasn't supplied.

The request is being made like this:

await client.fields.update(remoteFieldApiKey, { fieldset: { type: "fieldset", id: remoteFieldset.id }});

I’ve checked that the field exists with the following code and all good, it does exist.

const field = await client.fields.find(remoteFieldApiKey);

Hey @admin_datocms

Can you send us the exact request thats failing together with the URL of your Dato project so we can take a look at it?

The value of the variable remoteFieldApiKey would also be necessary

restore-2569 is the name of the project and content_page::comments is the value of the remoteFieldApiKey

Thank you @admin_datocms
Just one last question what Datocms client package version are you using? And can i try to run that request on our end to trace it back?

I’m using the following client package: "@datocms/cma-client-node": "^2.0.0", and sure, go ahead.

Hello @admin_datocms

The issue is that if you are adding to a field set you must also specify the position of that field on the fieldset

await client.fields.update(remoteFieldApiKey, {
    fieldset: { id: fieldset.id, type: 'fieldset' },
    position: 0,
  });

I can see how that is not documented on our end, and I’ll update the documentation to reflect this need right away.

Thank you so much for letting us know!
Best,

1 Like

Awesome, it works. Thanks a lot and thanks for updating the documentation. Maybe for the future you could update the error returned by the api as well, if it was explicit it wouldn’t be necessary to reach out to the support :wink:

Cheers!