graphql-hive / graphql-hive/gateway

feat: `JWTExtendContextFields` should receive generics

Open
#302 1 comment 0 reactions 1 assignee Claimed by @enisdenjo View on GitHub
enhancement
Dominant language
TypeScript
Stars
118
Forks
46
Avg merge
3d 2h
Merged PRs (30d)
27

Description

Hi!

I have a yoga subgraph.
I decode JWT payload from the gateway, and the subgraph consumes it as context.

```ts
import { YogaInitialContext } from 'graphql-yoga'
import { JWTExtendContextFields } from '@graphql-hive/gateway'

export interface GraphQLContext extends YogaInitialContext {
jwt: JWTExtendContextFields
}
```

And `JWTExtendContextFields` is declared like this.

```ts
export type JWTExtendContextFields = {
payload: JwtPayload;
token: {
value: string;
prefix?: string;
};
};
```

The problem is that `JwtPayload` is fixed.
So I cannot extend it to contain my own payload properties.
It should be conceptually like this.

```ts
export type JWTExtendContextFields = {
payload: JwtPayload;
token: {
value: string;
prefix?: string;
};
};
```

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.