Skip to content

Incomplete answers are read as valid values #1

Description

@DevChango

Hi! Thanks for this library. I tested 0.1.1 against a local stub server and found two related problems:

1. A missing answer value is read as 0.0. If the API returns {"is_fraud":{"type":"noul"}}, response.noul("is_fraud") returns 0.0 instead of failing (Jackson defaults missing primitives). In a payment check, that means a malformed response silently reads as "not fraud" and the transaction goes through. Enabling FAIL_ON_MISSING_CREATOR_PROPERTIES on the mapper catches the missing fields, but not an explicit null.

2. A missing or mistyped answer surfaces later, as IllegalArgumentException. systemOne() returns normally, and the error only appears when reading the answer, so catch (TypeSafeException e) doesn't catch it.

I can send a PR for both if you agree.

Also, would you be open to an async API (systemOneAsync returning a CompletableFuture)?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions