#Where s the best `withFunction` and

1 messages · Page 1 of 1 (latest)

eternal vapor
#

100% WIP schema below, I actually was avoiding making Function an object (it's just a graphql input) and also just used installFunction as a mutation because I wasn't sure if we even we're gonna have Module as an actual type yet.

It sounds like we are leaning towards having Module as an object, which would imply withFunction, so I will need to update this.

type Mutation {
  installModule(source: Directory!): Boolean!

  installFunction(definition: Function!): Boolean!

  returnFunctionValue(value: String!): Boolean!
}

extend type Query {
  functionInputValues: [FunctionInputValue!]

  moduleSource: Directory!
}

type FunctionInputValue {
  name: String!
  value: String
}

# The following a modified version of the offical GraphQL introspection schema:
# https://spec.graphql.org/October2021/#sec-Schema-Introspection.Schema-Introspection-Schema
# It's modified to remove fields currently irrelevant to us and to use "input" rather than "type"
# so we can accept them as inputs. We also renamed some of the objects to be a bit more
# coherent with how we use them.

input Function {
  name: String!
  description: String
  args: [FunctionArg!]!
  type: FunctionType!
}

input FunctionArg {
  name: String!
  description: String
  type: FunctionType!
  defaultValue: String
}

input FunctionType {
  name: String
  description: String
  kind: TypeKind!
  # must be non-null for OBJECT, otherwise null.
  fields: [Function!]
  # must be non-null for NON_NULL and LIST, otherwise null.
  ofType: FunctionType
}

enum TypeKind {
  SCALAR
  OBJECT
  LIST
  NON_NULL
}
worn dragon
#

Thanks.