prismagraphql/gcl

Name: gcl

Owner: Prisma

Description: ? Type-safe configuration format (similar to JSON/YAML) based on GraphQL with auto-completion and validation

Created: 2017-07-29 16:26:36.0

Updated: 2018-04-23 15:50:14.0

Pushed: 2017-10-01 19:02:19.0

Homepage:

Size: 16

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

GCL: GraphQL Configuration Language

GCL is intended to be a type-safe alternative to JSON, YAML (…) based on the input type syntax of GraphQL

Advantages
Example (Demo)

This example shows a configuration DSL for Docker images

Config File

Config files have the .gcl file extension

e: "node:6.10"
s: ["80"]
orks: ["frontend"]
oy: {
plicas: 2
date_config: {
parallelism: 2

start_policy: {
condition: OnFailure


Schema

The schema is specified by input types. The Root type is the “root” of the configuration schema.

t Root {
age: String
rts: [String!]
tworks: [String!]
pends_on: [String!]
lumes: [String!]
ploy: Deploy


t Deploy {
plicas: Int
date_config: DeployUpdateConfig
start_policy: DeployRestartPolicy


t DeployUpdateConfig {
rallelism: Int


 DeployRestartPolicyCondition {
Failure


t DeployRestartPolicy {
ndition: DeployRestartPolicyCondition

TODO
GraphQL changes that would enhance GCL
Library Usage
rt fs from 'fs'
rt gclToJson from 'gcl-lib'

c function run() {
nst schema = fs.readFileSync('schema.graphql', 'utf-8')
nst config = fs.readFileSync('config.gcl', 'utf-8')

nst json = await gclToJson(config, schema)

nsole.log(JSON.stringify(json, null, 2))


)
CLI Usage
m install -g gcl-lib
l-json -s schema.graphql -c config.gcl

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.