Skip to content

fix: accept empty arrays as null in Jackson deserialization#8

Closed
pheizx wants to merge 1 commit into
FacturAPI:mainfrom
pheizx:main
Closed

fix: accept empty arrays as null in Jackson deserialization#8
pheizx wants to merge 1 commit into
FacturAPI:mainfrom
pheizx:main

Conversation

@pheizx

@pheizx pheizx commented Jul 7, 2026

Copy link
Copy Markdown

Issue:

Cannot deserialize value of type `java.lang.String` from Array value (token `JsonToken.START_ARRAY`) at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: io.facturapi.models.SearchResult["data"]->java.util.ArrayList[0]->io.facturapi.models.Invoice["items"]->java.util.ArrayList[0]->io.facturapi.models.InvoiceItem["property_tax_account"])

Fix:

This change handles an API response inconsistency where a field expected as a String can arrive as an empty array ([]).
Without this setting, Jackson throws a deserialization error for paths like InvoiceItem.property_tax_account.
By enabling DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT, empty arrays are treated as null, preventing runtime parsing failures.

@javorosas

Copy link
Copy Markdown
Member

Gracias por reportar el problema. La causa es que property_tax_account es un arreglo en V2; lo corregimos tipándolo como List en #10, con cobertura para arreglos vacíos y no vacíos. Cerramos este PR para evitar habilitar una tolerancia global de Jackson que ocultaría otros contratos inválidos.

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.

2 participants