Skip to content

API response models are misleading for nullish values #25

@sevrai

Description

@sevrai

Problem

Aftership tracking API return null when a property is not defined. However, the typescript response model is defined with an optional value, but not nullable.

I tested it with getTrackingById API, looking for latest_estimated_delivery property for example. The model says

export interface GetTrackingByIdResponse {
    // ...
    latest_estimated_delivery?: LatestEstimatedDeliveryGetTrackingByIdResponse;
}

but It seems to be more like:

export interface GetTrackingByIdResponse {
    // ...
    latest_estimated_delivery: LatestEstimatedDeliveryGetTrackingByIdResponse | null;
}

-> value can be null and was never undefined in my tests.

Can I assume the value will always be defined (with null value when undefined in Aftership)? Is there a reason for having this response signature?

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions