Figma Support Forum

Constraints are being outputted incorrectly

Greetings, I have been using the Figma API for a while now and started experimenting with more specific things. In doing so, I found a potential bug relating to how constraints are represented in the Figma design file to what is coming out from the API.

For example, take the following “Colleges Group.”

The constraints seem to be:
Horizontal.Right and Vertical.Top;
However, this is what I am presented with when doing an HTTP command using cURL:

I am presented with:
Horizontal.LEFT and Vertical.TOP

Thank you in advance!

Groups don’t have constraints, in the properties panel they show constraints of the nested items. Therefore it’s an error that constraints are present here at all. However, the default value is top left, and since there is no way to change it in the file, this value is shown in the REST API output.

1 Like

Awesome! Thanks for the fast reply Gleb!

Actually, Gleb, to make sure I understand it correctly. The group would reflect the constraints from the nested elements? If so, wouldn’t it become one of the following constraints? Or am I missing something? :face_with_monocle::

Nested Elements:
image

The simplePaperIcon:
with constrains: V.Scale | H.Scale
image

Colleges:
with constrains: V.Bottom | H.LeftAndRight
image

and Background:
with constrains: V.Scale | H.Scale
image

Again, Thanks for your help!

You have a group called “Group 2 Copy 2” and inside of it you don’t have the objects you mentioned, you have one frame object called “Group”, and frames can have constraints so “Group 2 Copy 2” reflects constraints set on that frame.

1 Like

Ah, I think I got it! I think the only thing that confused me was the difference between what comes out in the JSON to that of the editor. In the editor, the “Group 2 Copy 2” does inherit the constraints of the “Group” frame; however, in the JSON “Group 2 Copy 2” does present the default values and does not inherit that of “Group” :thinking:

That’s correct. The group in the editor (and in code) doesn’t actually inherit any properties from its children. It simply shows them in the properties panel when possible (e.g. constraints, color, etc.).

1 Like

Got it! Thank you, Gleb! :smiley: