Skip to main content

appsync-scalars

Validates the AWS AppSync date and time scalars (AWSDate, AWSTime, AWSDateTime and AWSTimestamp) with one Rust implementation, available in Rust, Python, JavaScript and Go.

The rules come from results recorded from a live AppSync API, which differ from AWS's written descriptions. See What AppSync accepts.

Usage

Rust

use appsync_scalars::{is_aws_date, validate_aws_datetime};

assert!(is_aws_date("1970-01-01+05:30"));

// Err: invalid AWSDateTime: time zone offset is required
validate_aws_datetime("2021-01-11T12:30:24").unwrap_err();

Python

from appsync_scalars import is_aws_date, validate_aws_datetime

is_aws_date("1970-01-01+05:30")  # True
validate_aws_datetime("2021-01-11T12:30:24")  # raises ValueError

The core package has no dependencies. Pydantic field types are an optional extra, installed with pip install "appsync-scalars[pydantic]":

from pydantic import BaseModel
from appsync_scalars.pydantic import AWSDate, AWSDateTime, AWSTimestamp

class Event(BaseModel):
    day: AWSDate
    starts_at: AWSDateTime
    created: AWSTimestamp

Fields keep the exact str or int they were given, because Python's datetime cannot hold negative years and keeps only microseconds. They are also strict, so "123" is not converted to an integer for AWSTimestamp.

JavaScript and TypeScript

import { isAWSDate, validateAWSDateTime } from "appsync-scalars";

isAWSDate("1970-01-01+05:30"); // true
validateAWSDateTime("2021-01-11T12:30:24"); // throws AppSyncScalarError

Go

import appsyncscalars "github.com/wbgoodwin/appsync-scalars/bindings/go"

appsyncscalars.IsAWSDate("1970-01-01+05:30") // true
err := appsyncscalars.ValidateAWSDateTime("2021-01-11T12:30:24") // *appsyncscalars.Error

AWSTimestamp functions take the integer's text in Go and Rust, and an integer in Python and JavaScript.

What AppSync accepts

AppSync's descriptions of these scalars are accurate for ordinary values. It also accepts and rejects some values they don't mention, and this library follows AppSync:

Value Example AppSync's behavior
Lowercase z and t 2021-01-11t12:30:24z Accepted
Empty fraction 12:00:34. Accepted
Signed years of 5 to 10 digits +12021-01-11, -12021-01-11 Accepted, up to 999,999,999 either way
+ with a 4-digit year +2021-01-11 Rejected
Negative year zero -0000-01-11 Rejected
Hours-only offset +05 Accepted by AWSDateTime, rejected by AWSDate and AWSTime
Offset beyond 18 hours +18:01 Rejected by AWSDateTime, accepted by AWSDate and AWSTime up to +23:59:59

AWSTimestamp follows its documented limits, -31557014167219200 to 31556889864403199.

AppSync gave the same verdict for a GraphQL variable and for resolver output on every recorded value. Inline literals differ in one way: AppSync wraps oversized integers, so 18446744073709551616 written in a query reaches the resolver as 0. This library calls that value invalid, as AppSync does for variables and output.

How it fits together

Path Purpose
crates/appsync-scalars The validator: Rust with no dependencies
crates/appsync-scalars-wasm The WebAssembly module, about 4 KB, shared by JavaScript and Go
bindings/python Native extension built with PyO3 and maturin, plus the Pydantic types
bindings/js npm package that embeds the module, so it has no install step or platform-specific builds
bindings/go Go module that runs the embedded module through wazero, with no cgo
conformance/smoke.json Test cases every language runs
conformance/ The live AppSync test suite

Other languages with a WebAssembly runtime can load the same module. Its interface is described in crates/appsync-scalars-wasm/src/lib.rs.

Development

You need rustup, which installs the pinned Rust version, plus uv, Node.js 20 or later, and Go 1.25 or later.

Run every language's tests:

scripts/test-all.sh

After changing the validator, rebuild the WebAssembly module and commit the Go copy, because go get only sees files in the repository:

scripts/build-wasm.sh

Releasing

GitHub Actions runs the tests, and builds and tests a wheel on Linux, macOS and Windows, for every pull request and push to main.

To release, set the new version in crates/appsync-scalars/Cargo.toml, bindings/python/pyproject.toml and bindings/js/package.json, merge to main, then push a tag:

git tag v1.2.3 && git push origin v1.2.3

The workflow repeats every check, publishes to crates.io, PyPI and npm, and adds the bindings/go/v1.2.3 tag Go needs. It skips anything already on a registry, so rerunning a partly failed release is safe.

Publishing stores no tokens. Each registry needs a trusted publisher for this repository, with the workflow ci.yml and the environment release. PyPI can set one up before the first release. crates.io and npm need the first version published by hand, and npm's publisher must allow npm publish.

Metadata

Release files for appsync-scalars 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for appsync-scalars 0.1.0
File Size Uploaded Provenance Actions
appsync_scalars-0.1.0.tar.gz 42.1 kB With provenance Details for appsync_scalars-0.1.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for appsync-scalars 0.1.0
File Actions
appsync_scalars-0.1.0-cp310-abi3-win_amd64.whl CPython 3.10 abi3 Windows x86-64 Details for appsync_scalars-0.1.0-cp310-abi3-win_amd64.whl
appsync_scalars-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 abi3 Linux glibc 2.17+ x86-64 Details for appsync_scalars-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
appsync_scalars-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl CPython 3.10 abi3 Linux glibc 2.17+ ARM64 Details for appsync_scalars-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
appsync_scalars-0.1.0-cp310-abi3-macosx_11_0_arm64.whl CPython 3.10 abi3 macOS 11.0+ ARM64 Details for appsync_scalars-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
appsync_scalars-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl CPython 3.10 abi3 macOS 10.12+ x86-64 Details for appsync_scalars-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Total release size: 965.5 kB

Release files / appsync_scalars-0.1.0.tar.gz

Download URL appsync_scalars-0.1.0.tar.gz
Size 42.1 kB
Tags Source
SHA-256 checksum
How to use checksums
942817efc2922633bd9829f5d1d41a1f800ee9a5326c1e9bfe94130ef1cf9059
BLAKE2b-256 checksum
How to use checksums
ca1e3b790e0035c559a0b2857fe322e31ac94b88c33e7159b4f8179ca79e7673
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / appsync_scalars-0.1.0-cp310-abi3-win_amd64.whl

Download URL appsync_scalars-0.1.0-cp310-abi3-win_amd64.whl
Size 109.1 kB
Tags CPython 3.10 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
b0d698464c90b57d220384c49e74302108053f853c330f58a9a5d2e0ced1ad4e
BLAKE2b-256 checksum
How to use checksums
1b56a0dc3c13f1a97662e52663579b39b0e03e9f367cff3697925462ff5e0e9e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / appsync_scalars-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL appsync_scalars-0.1.0-cp310-abi3-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 222.1 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64 abi3
SHA-256 checksum
How to use checksums
b7580877d063eb86eac737ae7263e98e42f45d711bd84daa941ecdac501d1e42
BLAKE2b-256 checksum
How to use checksums
1a61f806a05fc1e28ce2cddd131334ef3b09b5d8ba85c44dcf096484944cb8ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / appsync_scalars-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl

Download URL appsync_scalars-0.1.0-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.whl
Size 216.5 kB
Tags CPython 3.10 Linux glibc 2.17+ ARM64 abi3
SHA-256 checksum
How to use checksums
9e3ffca56abc6e9a4f482e62a331d9b87ec1bc738b63ad57d1f7a108b865bb76
BLAKE2b-256 checksum
How to use checksums
385945f959882a34a50c8cfa0a276487ee65e0c5ae02e75363b8c0f8c5002a16
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / appsync_scalars-0.1.0-cp310-abi3-macosx_11_0_arm64.whl

Download URL appsync_scalars-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Size 186.5 kB
Tags CPython 3.10 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
42093ce3339a05905d5eae36218326de60a1c63ce4ade743ae2fc63213934f59
BLAKE2b-256 checksum
How to use checksums
e9dda0014fb3b71336d06621b8f71f5a7ff8765886b9f567103190fab9250f32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Release files / appsync_scalars-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl

Download URL appsync_scalars-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Size 189.1 kB
Tags CPython 3.10 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
ad7b095f83af980e26c2f93c96482e3f4e08a1b41d9c3ae25d6b6eec0728fe48
BLAKE2b-256 checksum
How to use checksums
6c687dd63e640fd2a2fb1b83f484ac46164a5836a75781692c922636b7a4034b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

Security for appsync-scalars 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for appsync_scalars-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 4, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page