Skip to content

expresslang/schemas

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EXPRESS Language Foundation schemas

This is the official EXPRESS Language Foundation schemas site.

This repository contains formal schema definitions for ELF-published formats and specifications.

Schemas

Manifest

The EXPRESS schema manifest is defined in ELF 5004.

Schema definitions for EXPRESS schema manifest:

Changes

The EXPRESS changes file is defined in ELF 5005.

Schema definitions for EXPRESS changes tracking:

Usage

General

These schemas are defined using JSON Schema (draft-07) and can be used to:

  • Validate EXPRESS changes YAML files

  • Generate documentation

  • Build tooling for working with EXPRESS change records

  • Ensure consistency across EXPRESS change specifications

Depending on the editor or tool you are using, the schemas can be referenced directly via their URLs.

YAML editor integration

The yaml-language-server comment line can be configured to use these schemas for YAML files.

This syntax was originally defined by RedHat for YAML schema validation, and has been adopted by Visual Studio Code and other editors that support the Language Server Protocol.

This schema can be used for validation by inserting the following comment line at the beginning of the YAML file.

Syntax:

# yaml-language-server: $schema=https://www.expresslang.org/schemas/{schema_path}

Where,

{schema_path}

is the path to the schema file relative to the root of this repository.

# yaml-language-server: $schema=https://www.expresslang.org/schemas/changes/v1/schema_changes.yaml

$schema property

The YAML root $schema property can be included directly in the YAML file to specify the schema to be used for validation.

While semantically correct, this approach is unfortunately not as widely supported by editors and tools as the comment line method.

Programmatic validation

These schemas can be used for programmatic validation of EXPRESS Changes YAML files using any JSON Schema validation library that supports draft-07.

In Ruby, the json-schema gem can be used as follows:

require 'yaml'
require 'json-schema'

schema = YAML.load_file('path/to/schema_changes.yaml')
data = YAML.load_file('path/to/changes.yaml')
JSON::Validator.validate!(schema, data)

In Python, the jsonschema package can be used as follows:

import yaml
import jsonschema

with open('path/to/schema_changes.yaml') as schema_file:
    schema = yaml.safe_load(schema_file)

with open('path/to/changes.yaml') as data_file:
    data = yaml.safe_load(data_file)

jsonschema.validate(instance=data, schema=schema)

In JavaScript, the ajv package can be used as follows:

const fs = require('fs');
const Ajv = require('ajv');

const ajv = new Ajv();
const schema = JSON.parse(fs.readFileSync('path/to/schema_changes.json'));
const data = JSON.parse(fs.readFileSync('path/to/changes.json'));

ajv.validate(schema, data);

Contributing

To contribute to these schemas, please submit a pull request to the schemas repository.

License

These schemas are maintained by the EXPRESS Language Foundation and are available under the terms specified in the repository license.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages