dotansimha / dotansimha/graphql-code-generator

Mappers break when using deeply nested types

Open
#5,836 0 comments 0 reactions 0 assignees View on GitHub
core kind/bug stage/1-reproduction stage/2-failing-test
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

First off - thanks for all the great work!

## Description

Mapper types don't work when using deeply nested types (e.g.`aws-sdk#DynamoDB.DocumentClient.Key`)

## Reproduction

Here is a [codesandbox reproduction](https://codesandbox.io/s/wonderful-cloud-4dyhi?file=/codegen.yml:168-245).

```
scalars:
MyScalar: aws-sdk#DynamoDB.DocumentClient.Key
```

### Expected result

Generated type file

```
import { DynamoDB } from 'aws-sdk';
// ...

export type Scalars = {
// ...
MyScalar: DynamoDB.DocumentClient.Key;
};
```

### Actual result

Generated type file

```
import { DynamoDB } from 'aws-sdk';
// ...

export type Scalars = {
// ...
MyScalar: DynamoDB.DocumentClient;
};
```

**Additional context**

For this specific use case, I've used this workaround - `aws-sdk/clients/dynamodb#DocumentClient.Key`.

I'm assuming there will be use cases where a workaround isn't feasible.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.