Contentful logo

Contentful Community

Content type validations

#1

I just noticed that you don’t get the validation-field on fields when fetching a content type. If you “JSON preview” a content type in the ui a field may look like:

{ "id": "category", "name": "Category", "type": "Symbol", "localized": false, "required": true, "validations": [ { "in": [ "Category 1", "Category 2", "Category 3" ] } ], "disabled": false, "omitted": false } ]

so in my system I want to pick from the available validation options “Category 1”, “Category 2” or “Category 3”, however it seems the entire “validations”-field is omitted with this SDK.
Am I wrong? If not, is this something that may be added within a foreseeable future?

Edit: I don’t want to add a content type for this simple categorization. That seems a bit overkill for a single line of text

0 Likes

#2

Hi @gustaf.eriksson,
The SDK does not omit anything from the payload it is just that the validation is not available using the CDN for single reference. However, if you want to access all the validation you can use the CMA SDK.

Best,
Khaled

0 Likes

#3

Aah, okay! Thanks a bunch

0 Likes