Skip to content

fix: deserialize empty array FileInfo.fields as null - #436

Merged
andrii-bodnar merged 1 commit into
crowdin:masterfrom
Mithilbatra:fix/fileinfo-fields-empty-array
Nov 11, 2026
Merged

andrii-bodnar merged 1 commit into
crowdin:masterfrom
Mithilbatra:fix/fileinfo-fields-empty-array

Conversation

@Mithilbatra

Copy link
Copy Markdown
Contributor

Fixes #435

When a file has no custom fields, the Crowdin Enterprise API returns "fields": []. Deserializing that into FileInfo.fields (Map<String, Object>) threw a MismatchedInputException.

This reuses the existing EmptyArrayToNullDeserializer on the field, like the other Map fields that get [] from the API (Webhook.headers, ExternalQaCheck.config, ProjectSettings.assignedTms, ...). File extends FileInfo, so both response shapes are covered.

Testing

  • Added "fields": [] to the listFileInfos.json fixture and an assertion in SourceFilesApiTest.listFileInfosTest. The test fails with the exception from the issue before the fix and passes after it.
  • ./gradlew build passes.

The Enterprise API returns "fields": [] for files without custom fields, which failed to deserialize into Map<String, Object>. Reuse EmptyArrayToNullDeserializer, as other Map fields already do.

Fixes crowdin#435

@andrii-bodnar andrii-bodnar left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Mithilbatra thank you!

@andrii-bodnar
andrii-bodnar merged commit c22568a into crowdin:master Nov 11, 2026
2 checks passed
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.

FileInfo.fields fails to deserialize when API returns an empty array

2 participants