Package: GraphQLite.jl
Simple, fast, limited-scope implementation of GraphQL in Julia. Converts GraphQL input into a composition of arrays and Dicts.
Complex input types (i.e., not String, Int, ID, Float) are defined in the schema using the "input" keyword. Additionally, GraphQLite.jl requires an "input resolver" and a type to be defined in Julia.
...
type Mutation {
addItemToCart(input: CartItemInput): Cart
}
input CartItemInput {
cartId: Int!
itemId: Int!
quantity: Int!
}
...
function GraphQLite.resolveinput(::Val{:CartItemInput}, d::Dict)
# Some conversion from "Dict" to "CartItemInput"
CartItemInput(d)
end
@kwdef struct CartItemInput
quantity::Int = 1
cart_id::Int
item_id::Int
end
function GraphQLite.resolve(::GQLMutation, ::Val{:addItemToCart}, args)
cart_item_input = args[:vars][:input]
@assert typeof(cart_item_input) == CartItemInput
end