speccy icon indicating copy to clipboard operation
speccy copied to clipboard

Feature: Support JS modules

Open elyobo opened this issue 5 years ago • 0 comments

Detailed description

Understanding a schema in a module that can be require()d would allow a more standard way of specifying the schema.

Context

YAML is an odd format to use for JS projects, and JSON is annoying for its lack of comment support, and trailing commas (which makes diffs a mess), and the ability to compose schemas (which requires refs / oneOf / allOf etc, which have their own limitations). Supporting a definition exported from a JS file is preferable to either for many.

module.exports = {
  // definition goes here
}

Possible implementation

Infer the appropriate type from file extensions when loading a file, or via a command line flag when accepting stdin.

Your environment

Not relevant

elyobo avatar May 28 '19 22:05 elyobo