gl

gcl-lib

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

Showing:

Popularity

Downloads/wk

1

Maintenance

No Maintenance Data Available

Package

Dependencies

2

Size (min+gzip)

38.8KB

License

MIT

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

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

  • Autocompletion & validation for configuration files
  • Out-of-the-box documentation for config DSLs
  • Easy schema definition through SDL for tooling authors
  • Leverages available GraphQL tooling (parsers etc) for cross-language adoption

Example (Demo)

This example shows a configuration DSL for Docker images

Config File

Config files have the .gcl file extension

image: "node:6.10"
ports: ["80"]
networks: ["frontend"]
deploy: {
  replicas: 2
  update_config: {
    parallelism: 2
  }
  restart_policy: {
    condition: OnFailure
  }
}

Schema

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

input Root {
  image: String
  ports: [String!]
  networks: [String!]
  depends_on: [String!]
  volumes: [String!]
  deploy: Deploy
}

input Deploy {
  replicas: Int
  update_config: DeployUpdateConfig
  restart_policy: DeployRestartPolicy
}

input DeployUpdateConfig {
  parallelism: Int
}

enum DeployRestartPolicyCondition {
  OnFailure
}

input DeployRestartPolicy {
  condition: DeployRestartPolicyCondition
}

TODO

  • Decide on "Add back top level curly brackets #1"
  • PoC based on GraphiQL for auto-completion (removing the top-level query)
  • Integrate with graphql-language-service

GraphQL changes that would enhance GCL

  • Multi-line strings (PR)

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100