Skip to content

[Apollo] Support AWS AppSync custom scalars #2978

Open
@mattcreaser

Description

Before opening, please confirm:

Language and Async Model

Kotlin, Kotlin - Coroutines

Amplify Categories

Not applicable

Gradle script dependencies

n/a

Environment information

n/a

Please include any relevant guides or documentation you're referencing

https://docs.aws.amazon.com/appsync/latest/devguide/scalars.html

Describe the feature request

By default, when using Apollo Kotlin with the Amplify Apollo Extensions, all of the custom scalars in AppSync get generated as Any type. This makes it awkward to use e.g. the createdAt field in a generated Apollo model.

In the actual returned data the Any field can be cast to a String (its actual type) and then parsed into e.g. an Instant, but this is sub-optimal for many reasons. Ideally the scalar GraphQL type AWSDateTime would already be converted into a platform-appropriate type.

This can be done in Apollo by defining adapters for Custom Scalars.

This issue covers adding support for the AWS-specific Scalars present in AppSync schemas to the extensions library.

Ideally this would include any necessary runtime classes, Apollo adapter implementations, and instructions on how to configure the Apollo Gradle Plugin.

Initialization steps (if applicable)

No response

Code Snippet

n/a

amplifyconfiguration.json

No response

GraphQL Schema

n/a

Additional information and screenshots

No response

Metadata

Assignees

No one assigned

    Labels

    apollo appsyncIssues related to the Apollo AppSync Extensionsfeature-requestRequest a new feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions