Skip to content

Commit

Permalink
Update ariadne with new schema (#209)
Browse files Browse the repository at this point in the history
Updates Ariadne's schema to match the latest schema, as mentioned here #166

I've moved the schema definition to a new file to make it easier to update in future, we could split the files more if needed 😊

Closes #180
  • Loading branch information
patrick91 committed Aug 23, 2022
1 parent 34d6830 commit 16d453b
Show file tree
Hide file tree
Showing 4 changed files with 252 additions and 83 deletions.
2 changes: 1 addition & 1 deletion implementations/ariadne/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ FROM python:3.9-alpine
WORKDIR /web
COPY requirements.txt ./
RUN pip install -r requirements.txt
COPY server.py ./
COPY server.py schema.graphql ./
EXPOSE 4001
CMD python server.py
2 changes: 1 addition & 1 deletion implementations/ariadne/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ariadne==0.15.1
ariadne==0.16.0b1
certifi==2020.12.5
click==7.1.2
graphql-core==3.2.1
Expand Down
70 changes: 70 additions & 0 deletions implementations/ariadne/schema.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
extend schema
@link(
url: "https://specs.apollo.dev/federation/v2.0",
import: [
"@extends",
"@external",
"@key",
"@inaccessible",
"@override",
"@provides",
"@requires",
"@shareable",
"@tag"
]
)

type Product
@key(fields: "id")
@key(fields: "sku package")
@key(fields: "sku variation { id }") {
id: ID!
sku: String
package: String
variation: ProductVariation
dimensions: ProductDimension
createdBy: User @provides(fields: "totalProductsCreated")
notes: String @tag(name: "internal")
research: [ProductResearch!]!
}

type DeprecatedProduct @key(fields: "sku package") {
sku: String!
package: String!
reason: String
createdBy: User
}

type ProductVariation {
id: ID!
}

type ProductResearch @key(fields: "study { caseNumber }") {
study: CaseStudy!
outcome: String
}

type CaseStudy {
caseNumber: ID!
description: String
}

type ProductDimension @shareable {
size: String
weight: Float
unit: String @inaccessible
}

extend type Query {
product(id: ID!): Product
deprecatedProduct(sku: String!, package: String!): DeprecatedProduct @deprecated(reason: "Use product query instead")
}


type User @key(fields: "email") @extends {
averageProductsCreatedPerYear: Int @requires(fields: "totalProductsCreated yearsOfEmployment")
email: ID! @external
name: String @override(from: "users")
totalProductsCreated: Int @external
yearsOfEmployment: Int! @external
}

0 comments on commit 16d453b

Please sign in to comment.