---
source: crates/graphql-composition/tests/composition_tests.rs
expression: Federated SDL
input_file: crates/graphql-composition/tests/composition/entity_composite_key_basic/test.md
---
schema
@link(url: "https://specs.apollo.dev/link/v1.0")
@link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION)
@link(url: "https://specs.apollo.dev/inaccessible/v0.2", for: SECURITY)
{
query: Query
}
directive @join__unionMember(graph: join__Graph!, member: String!) on UNION
directive @join__implements(graph: join__Graph!, interface: String!) on OBJECT | INTERFACE
directive @join__graph(name: String!, url: String) on ENUM_VALUE
directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, overrideLabel: String) on FIELD_DEFINITION | INPUT_FIELD_DEFINITION
directive @join__type(graph: join__Graph, key: join__FieldSet, extension: Boolean = false, resolvable: Boolean = true, isInterfaceObject: Boolean = false) on SCALAR | OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT
directive @join__owner(graph: join__Graph!) on OBJECT
scalar join__FieldSet
type Course
@join__type(graph: COURSES, key: "id")
@join__type(graph: STUDENTS, key: "id")
{
description: String @join__field(graph: COURSES)
enrolledStudents: [Student] @join__field(graph: STUDENTS, requires: "id")
id: ID!
name: String @join__field(graph: COURSES)
}
type Enrollment
@join__type(graph: COURSES, key: "studentId courseId")
@join__type(graph: RATINGS, key: "studentId courseId")
@join__type(graph: STUDENTS, key: "studentId courseId")
{
course: Course @join__field(graph: STUDENTS)
courseId: ID!
enrollmentDate: String @join__field(graph: STUDENTS)
enrollmentDetails: Enrollment @join__field(graph: COURSES, requires: "studentId courseId")
rating: CourseRating @join__field(graph: RATINGS)
studentId: ID!
}
type CourseRating
@join__type(graph: RATINGS, key: "courseId")
{
comments: String
courseId: ID!
rating: Float
}
type Student
@join__type(graph: STUDENTS, key: "id")
{
enrollments: [Enrollment]
id: ID!
name: String
}
type Query
{
course(id: ID!): Course @join__field(graph: COURSES)
courseRating(courseId: ID!): [CourseRating] @join__field(graph: RATINGS)
courses: [Course] @join__field(graph: COURSES)
student(id: ID!): Student @join__field(graph: STUDENTS)
students: [Student] @join__field(graph: STUDENTS)
}
enum join__Graph
{
COURSES @join__graph(name: "courses", url: "http://example.com/courses")
RATINGS @join__graph(name: "ratings", url: "http://example.com/ratings")
STUDENTS @join__graph(name: "students", url: "http://example.com/students")
}