Skip to content

actionUser expiry field cannot be set to "infinity" (9223372036854775807) #43

Open
@ceefour

Description

@ceefour

Reference: https://fusionauth.io/docs/v1/tech/apis/actioning-users/#take-an-action-on-a-user

To cause the action to be applied indefinitely, or until the action is canceled or modified, set this value to 9223372036854775807.

Since Java API uses Long and the expiry field TypeScript definition uses number, trying to use that number literal will give TypeScript warning "Numeric literals with absolute values equal to 2^53 or greater are too large to be represented accurately as integers.ts(80008)"

And also when executing the result is:

Invalid JSON in the request body. The property was [action.expiry]. The error was [Possible conversion error]. The detailed exception was [Numeric value (9223372036854776000) out of range of long (-9223372036854775808 - 9223372036854775807)
 at [Source: (org.apache.catalina.connector.CoyoteInputStream); line: 1, column: 181] (through reference chain: io.fusionauth.domain.api.user.ActionRequest["action"]->io.fusionauth.domain.api.user.ActionRequest$ActionData["expiry"])].

Workaround

Use: '9223372036854775807' as any

Proposed Solution

If possible, change the type to number | string | undefined which is probably a good-enough compromise retaining backwards compatibility.

If not possible, then string | undefined is more flexible.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions