Socket
Book a DemoInstallSign in
Socket

gcl-lib

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gcl-lib

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

latest
npmnpm
Version
0.0.2
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
Source

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)

FAQs

Package last updated on 15 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts