We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Generated schema with either this guide https://docs.nestjs.com/graphql/generating-sdl or
GraphQLModule.forRoot<ApolloFederationDriverConfig>({ driver: ApolloFederationDriver, autoSchemaFile: { federation: 2, path: "schema-auto.graphql" }, }),
is missing federated directives (like @key).
@key
# ------------------------------------------------------ # THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY) # ------------------------------------------------------ type User { id: ID! } type Query { users: [User!]! user(id: Int!): User! } type Mutation { createUser(createUserInput: CreateUserInput!): User! updateUser(updateUserInput: UpdateUserInput!): User! removeUser(id: Int!): User! } input CreateUserInput { """Example field (placeholder)""" exampleField: Int! } input UpdateUserInput { """Example field (placeholder)""" exampleField: Int id: Int! }
https://github.com/maxkomarychev/nest-federated-schema?tab=readme-ov-file
The repository contains README with detailed explanation of how to run the test
I want to be able to generate schema compatible with federation in a reliable way without going through internal functions of underlying frameworks:
schema @link(url: "https://specs.apollo.dev/link/v1.0") { query: Query mutation: Mutation } extend schema @link(url: "https://specs.apollo.dev/federation/v2.3", import: ["@composeDirective", "@extends", "@external", "@inaccessible", "@interfaceObject", "@key", "@override", "@provides", "@requires", "@shareable", "@tag"]) directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA directive @key(fields: federation__FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE directive @requires(fields: federation__FieldSet!) on FIELD_DEFINITION directive @provides(fields: federation__FieldSet!) on FIELD_DEFINITION directive @external(reason: String) on OBJECT | FIELD_DEFINITION directive @tag(name: String!) repeatable on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION | SCHEMA directive @extends on OBJECT | INTERFACE directive @shareable repeatable on OBJECT | FIELD_DEFINITION directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION directive @override(from: String!) on FIELD_DEFINITION directive @composeDirective(name: String) repeatable on SCHEMA directive @interfaceObject on OBJECT type User @key(fields: "id") { id: ID! } type Query { users: [User!]! user(id: Int!): User! _entities(representations: [_Any!]!): [_Entity]! _service: _Service! } type Mutation { createUser(createUserInput: CreateUserInput!): User! updateUser(updateUserInput: UpdateUserInput!): User! removeUser(id: Int!): User! } input CreateUserInput { """Example field (placeholder)""" exampleField: Int! } input UpdateUserInput { """Example field (placeholder)""" exampleField: Int id: Int! } enum link__Purpose { """ `SECURITY` features provide metadata necessary to securely resolve fields. """ SECURITY """ `EXECUTION` features provide metadata necessary for operation execution. """ EXECUTION } scalar link__Import scalar federation__FieldSet scalar _Any type _Service { sdl: String } union _Entity = User
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
No response
^10.0.0
"dependencies": { "@apollo/server": "^4.10.4", "@apollo/subgraph": "^2.8.0", "@nestjs/apollo": "^12.1.0", "@nestjs/common": "^10.0.0", "@nestjs/core": "^10.0.0", "@nestjs/graphql": "^12.1.1", "@nestjs/platform-express": "^10.0.0", "graphql": "^16.8.1", "reflect-metadata": "^0.2.0", "rxjs": "^7.8.1" }, "devDependencies": { "@nestjs/cli": "^10.0.0", "@nestjs/schematics": "^10.0.0", "@nestjs/testing": "^10.0.0", "@types/express": "^4.17.17", "@types/jest": "^29.5.2", "@types/node": "^20.3.1", "@types/supertest": "^6.0.0", "@typescript-eslint/eslint-plugin": "^6.0.0", "@typescript-eslint/parser": "^6.0.0", "eslint": "^8.42.0", "eslint-config-prettier": "^9.0.0", "eslint-plugin-prettier": "^5.0.0", "jest": "^29.5.0", "prettier": "^3.0.0", "source-map-support": "^0.5.21", "supertest": "^6.3.3", "ts-jest": "^29.1.0", "ts-loader": "^9.4.3", "ts-node": "^10.9.1", "tsconfig-paths": "^4.2.0", "typescript": "^5.1.3" },
v20.12.2
The text was updated successfully, but these errors were encountered:
#2059
Sorry, something went wrong.
No branches or pull requests
Is there an existing issue for this?
Current behavior
Generated schema with either this guide https://docs.nestjs.com/graphql/generating-sdl or
is missing federated directives (like
@key
).Minimum reproduction code
https://github.com/maxkomarychev/nest-federated-schema?tab=readme-ov-file
Steps to reproduce
The repository contains README with detailed explanation of how to run the test
Expected behavior
I want to be able to generate schema compatible with federation in a reliable way without going through internal functions of underlying frameworks:
Package
@nestjs/common
@nestjs/core
@nestjs/microservices
@nestjs/platform-express
@nestjs/platform-fastify
@nestjs/platform-socket.io
@nestjs/platform-ws
@nestjs/testing
@nestjs/websockets
Other package
No response
NestJS version
^10.0.0
Packages versions
Node.js version
v20.12.2
In which operating systems have you tested?
Other
No response
The text was updated successfully, but these errors were encountered: