Skip to content

Conversation

@demeyerthom
Copy link
Member

This pull request adds support for array default values to the DefaultValue structure for Contentful content type fields. It updates validation logic, schema definitions, import/export methods, and tests to handle array default values alongside string and boolean types. This enables fields to have localized array defaults, such as {"en-US": ["green", "blue"]}.

Array default value support:

  • The DefaultValue struct now includes an Array field, allowing array default values to be stored and processed. (internal/resources/contenttype/model.go, internal/resources/contenttype/model.goR43)
  • The resource schema for content types has been updated to support array default values by locale, with validation logic extended to handle arrays. (internal/resources/contenttype/resource.go, [1]; internal/customvalidator/defaultvaluestructurevalidator.go, [2] [3] [4]

Import/export and utility enhancements:

  • The Draft and HasContent methods for DefaultValue now correctly process array values, and the import logic in Field.Import can handle array default values from the SDK. (internal/resources/contenttype/model.go, [1] [2] [3]
  • The getTypeOfMap utility function recognizes array types, improving type detection for default values. (internal/resources/contenttype/model.go, internal/resources/contenttype/model.goR653-R657)

Testing improvements:

@demeyerthom demeyerthom requested a review from a team as a code owner October 7, 2025 11:37
@demeyerthom demeyerthom linked an issue Oct 7, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Array support for default_value during resource import

1 participant