---
source: crates/graphql-composition/tests/composition_tests.rs
expression: "A test with three extensions, used in different subgraphs with different imports. We expect to see the `extension__Link` enum and `extension__directive` instances in the right places.\n\nAlso note we have a facebook linked schema, that should not appear in the federated graph."
input_file: crates/graphql-composition/tests/composition/grafbase_extensions/extensions_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
mutation: Mutation
subscription: Subscription
}
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__enumValue(graph: join__Graph!) on ENUM_VALUE
directive @join__owner(graph: join__Graph!) on OBJECT
scalar join__FieldSet
type Appointment
@join__type(graph: APPOINTMENTS, key: "id")
@join__type(graph: DOCTORS, key: "id")
@join__type(graph: PATIENTS, key: "id")
{
datetime: String! @join__field(graph: APPOINTMENTS)
doctor: Doctor! @join__field(graph: APPOINTMENTS)
id: ID!
notes: String @join__field(graph: APPOINTMENTS)
patient: Patient! @join__field(graph: APPOINTMENTS)
status: AppointmentStatus! @join__field(graph: APPOINTMENTS)
}
type Patient
@join__type(graph: APPOINTMENTS, key: "id")
@join__type(graph: PATIENTS, key: "id")
{
appointments: [Appointment!]! @join__field(graph: PATIENTS)
dateOfBirth: String! @join__field(graph: PATIENTS)
email: String! @join__field(graph: PATIENTS)
firstName: String! @join__field(graph: PATIENTS)
id: ID!
lastName: String! @join__field(graph: PATIENTS)
phone: String @join__field(graph: PATIENTS)
}
type Doctor
@join__type(graph: APPOINTMENTS, key: "id")
@join__type(graph: DOCTORS, key: "id")
{
appointments: [Appointment!]! @join__field(graph: APPOINTMENTS)
email: String! @join__field(graph: DOCTORS)
firstName: String! @join__field(graph: DOCTORS)
id: ID!
lastName: String! @join__field(graph: DOCTORS)
phone: String @extension__directive(graph: DOCTORS, extension: REST, name: "call", arguments: {method: GET, url: "https://my-phone_registry/doctors/{id}"}) @join__field(graph: DOCTORS)
specialty: String! @join__field(graph: DOCTORS)
type: DoctorType @join__field(graph: DOCTORS)
}
type Query
{
appointment(id: ID!): Appointment @join__field(graph: APPOINTMENTS)
appointments: [Appointment!]! @join__field(graph: APPOINTMENTS)
doctor(id: ID!): Doctor @join__field(graph: DOCTORS)
doctors: [Doctor!]! @join__field(graph: DOCTORS)
patient(id: ID!): Patient @join__field(graph: PATIENTS)
patients: [Patient!]! @join__field(graph: PATIENTS)
}
type Mutation
{
cancelAppointment(id: ID!): Boolean! @extension__directive(graph: APPOINTMENTS, extension: QUEUE, name: "post", arguments: {topic: "cancellations", value: "{\"id\":$id}"}) @join__field(graph: APPOINTMENTS)
createDoctor(input: DoctorInput!): Doctor! @extension__directive(graph: DOCTORS, extension: ORACLE, name: "execute_sql", arguments: {sql: "INSERT INTO doctors (first_name, last_name, specialty, email, phone) VALUES ($input.firstName, $input.lastName, $input.specialty, $input.email, $input.phone) RETURNING *"}) @join__field(graph: DOCTORS)
createPatient(input: PatientInput!): Patient! @extension__directive(graph: PATIENTS, extension: QUEUE, name: "post", arguments: {topic: "newPatients"}) @join__field(graph: PATIENTS)
scheduleAppointment(input: AppointmentInput!): Appointment! @join__field(graph: APPOINTMENTS)
updateDoctor(id: ID!, input: DoctorInput!): Doctor! @extension__directive(graph: DOCTORS, extension: ORACLE, name: "execute", arguments: {procedure: "update_doctor"}) @extension__directive(graph: DOCTORS, extension: QUEUE, name: "post", arguments: {topic: "doctorUpdates"}) @join__field(graph: DOCTORS)
updatePatient(id: ID!, input: PatientInput!): Patient! @join__field(graph: PATIENTS)
}
type Subscription
{
newAppointments(doctorId: ID!): Appointment! @extension__directive(graph: APPOINTMENTS, extension: QUEUE, name: "tail", arguments: {topic: "appointments", filter: "doctorId = $doctorId"}) @join__field(graph: APPOINTMENTS)
}
enum AppointmentStatus
@extension__directive(graph: APPOINTMENTS, extension: QUEUE, name: "message", arguments: {topic: "appointments"})
@join__type(graph: APPOINTMENTS)
{
SCHEDULED @join__enumValue(graph: APPOINTMENTS)
COMPLETED @join__enumValue(graph: APPOINTMENTS)
CANCELLED @join__enumValue(graph: APPOINTMENTS)
}
enum DoctorType
@extension__directive(graph: DOCTORS, extension: ORACLE, name: "databaseEnum", arguments: {name: "dr_type"})
@join__type(graph: DOCTORS)
{
CARDIOLOGIST @extension__directive(graph: DOCTORS, extension: ORACLE, name: "databaseEnumValue", arguments: {value: "cardiologist_t"}) @join__enumValue(graph: DOCTORS)
PEDIATRICIAN @extension__directive(graph: DOCTORS, extension: ORACLE, name: "databaseEnumValue", arguments: {value: "pediatrician_t"}) @join__enumValue(graph: DOCTORS)
SURGEON @join__enumValue(graph: DOCTORS)
}
enum join__Graph
{
APPOINTMENTS @join__graph(name: "appointments", url: "http://example.com/appointments")
DOCTORS @join__graph(name: "doctors", url: "http://example.com/doctors")
PATIENTS @join__graph(name: "patients", url: "http://example.com/patients")
}
enum extension__Link
{
ORACLE @extension__link(url: "file:///home/lellison/src/oracle-grafbase-extension/dist")
REST @extension__link(url: "https://grafbase.com/extensions/rest")
QUEUE @extension__link(url: "https://grafbase.com/extensions/kafka/v1.0.0")
}
input AppointmentInput
@join__type(graph: APPOINTMENTS)
{
doctorId: ID!
datetime: String!
notes: String
patientId: ID!
}
input DoctorInput
@join__type(graph: DOCTORS)
{
firstName: String!
lastName: String!
specialty: String!
email: String!
phone: String
}
input PatientInput
@join__type(graph: PATIENTS)
{
firstName: String!
lastName: String!
email: String!
phone: String
dateOfBirth: String!
}