awslabs / awslabs/aws-mobile-appsync-sdk-android

Mapping AWS built-in scalar types

Open
#77 0 comments 0 reactions 0 assignees View on GitHub
feature-request
Dominant language
Java
Stars
106
Forks
56
PR merge metrics
No merged PRs in 30d

Description

**Question**

How does one map an AWS built-in scalar type? Currently, using AWS scalar types results in generated models with "stringly typed" fields, which are bad practise and undesirable for a variety of well understood reasons.

If the schema defines:

```graphql
type Todo {
id: ID!
name: String!
description: String
created: AWSDateTime
}
```

How can we configure the code generator to output `created` with a date/time type of our choosing? Eg `ZonedDateTime`?

Since Apollo provides support for this functionality, I'd expect it to be available to AWS AppSync SDK users as well.

**Environment**

AppSync SDK `2.7.0`
Kotlin `1.3.10`
Android Studio 3.3 RC 1
Build #AI-182.5107.16.33.5138683, built on November 19, 2018
JRE: 1.8.0_152-release-1248-b01 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6

**Sample project**

Attached is a sample project demonstrating how I'd expect this to work, based on the Apollo documentation:

[AppSyncCustomTypes.zip](https://github.com/awslabs/aws-mobile-appsync-sdk-android/files/2646696/AppSyncCustomTypes.zip)

It does not compile, because the generated type is always a `String`.

Contributor guide

Open the contributing guide

Research direction

Start with the attached AppSyncCustomTypes.zip sample project and the generated model for the AWSDateTime field. Trace the code-generation configuration that turns AWS scalar types into String fields. Done means the generator supports a configurable date/time type such as ZonedDateTime and the sample project compiles with the generated field using that type.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, aws, kotlin
Domain
mobile-dev, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.