Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(federation): Handle ObjectTypeExtension #958

Merged
merged 1 commit into from
Jun 23, 2020
Merged

fix(federation): Handle ObjectTypeExtension #958

merged 1 commit into from
Jun 23, 2020

Conversation

timhall
Copy link
Contributor

@timhall timhall commented Jun 12, 2020

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

From the federation example, the following invalid typings are generated:

type Post @key(fields: "id") {
  id: ID!
  title: String!
  body: String!
  user: User
}

extend type User @key(fields: "id") {
  id: ID! @external
  posts: [Post]
}

extend type Query {
  getPosts: [Post]
}
export class Post {
  id: string;
  title: string;
  body: string;
  user?: User
}

Where a User class/interface is not generated

Issue Number: N/A

What is the new behavior?

This PR handles ObjectTypeExtension the same was as ObjectTypeDefinition when generating Typescript definitions.

export class Post {
  id: string;
  title: string;
  body: string;
  user?: User
}

export abstract class IQuery {
    abstract getPosts(): Post[] | Promise<Post[]>;
}

export class User {
    id: string;
    posts?: Post[];
}

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@kamilmysliwiec kamilmysliwiec merged commit 9f7b973 into nestjs:master Jun 23, 2020
@kamilmysliwiec
Copy link
Member

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants