Code Monkey home page Code Monkey logo

json-schema-tools's Introduction

JSON Schema Tools

This is a monorepo of packages for working with JSON Schema and JSON Hyper-Schema, built using Lerna and Yarn Workspaces.

The repo includes everything from generic utilities to small applications built on these and other packages.

The packages are intended for general use, so while they may support some Cloudflare extensions to JSON Schema, they should all be usable with schemas that rely only on the standard keywords and features.

Note that these packages have not yet reached a stable interface

Interfaces will change and packages will be refactored until each package reaches a 1.0 status. This will likely occur once JSON Schema draft-08, which will have some very significant new features, is finalized. In particular, the concept of a Schema Vocabulary appears in several locations but is neither well nor consistently managed in the current code. Draft-08 will formalize that concept.

If you are interested in building on these packages, please file an issue indicating what you need to use and we will work to ensure reasonable levels of support as we finalize the interfaces.

The packages

Packages fall into a few categories. Currently, the packages in this repository focus on static manipulation and processing of schemas, in particular for generating API documentation. The following diagram gives an overview of how this and potentially other kinds of static processing work:

A possible json-schema-tools data flow for static schema processing would likely involve the walker and transform packages, which can produce schemas suitable for use in applications such as the Doca API documentation system.

Additional packages will likely add runtime functionality, including automated API testing support based on JSON Hyper-Schema.

@cloudflare/json-schema-walker

json-schema-walker is the most fundamental static schema processing package: it is aware of subschema applicators and uses that knowledge to walk over a schema and make callbacks before and/or after visiting any subschemas.

Most schema transformations work by changing a schema object after its subschemas have been visited, so that all transformations are guaranteed to have already been applied to any subschemas.

There are variants for visiting all schemas including the root, as well as for only visiting subschemas.

@cloudflare/json-schema-transform

json-schema-transform is a collection of utility functions, most of which are either callbacks intended for use with json-schema -walker, or make use of json-schema-walker internally. This package will eventually include transforms for converting one draft to another.

Among other things, this makes replacements for the internals of the deprecated json-schema-example-loader package available outside of Webpack. See json-schema-apidoc-loader for use with Webpack.

@cloudflare/json-hyper-schema

json-hyper-schema is an implementation of the JSON Hyper-Schema specification, supporting both static (currently) and dynamic (in the future) use of Hyper-Schemas. Eventually, we hope to build a fully-featured hyperclient based on this package.

Currently, this just includes some utilities for looking up link description objects and resolving URI Templates from an instance. Some of these utilities are replacements for internals of the deprecated json-schema-example-loader.

@cloudflare/json-schema-test

This package has not yet been created.

Applies schema validation to API requests and responses. This will primarily leverage JSON Hyper-Schema but other utilities such as a Jest matcher for regular schema validation will be included.

Applications and application support

Currently, the only application provided is an API documentation system known as "Doca". This is a refactored and re-designed version of our existing Doca suite

@cloudflare/doca

Scaffolding system to generate API documentation apps.

Replaces the existing doca package, which is now deprecated.

@cloudflare/doca-default-theme

The default UI for documentation apps scaffolded by @cloudflare/doca.

Will eventually fully replace doca-bootstrap-theme, but currently this is a bare-bones display of the processed JSON Schemas. It is provided mainly for debugging purposes and as a starting point for 3rd-party UI themes.

@cloudflare/json-schema-ref-loader

Webpack loader that uses json-schema-transform and other packages to load schemas written in JSON, JSON5, YAML, or JavaScript formats and dereference all $ref occurrences. All referenced schemas are added as dependencies.

Currently this loader can only be used with schemas that do not have any cyclic references as dereferencing is the only option for loading.

Replaces json-schema-loader

@cloudflare/json-schema-apidoc-loader

Webpack loader that uses json-schema-transform and other packages to convert de-referenced (no $refs) into a form suitable for generating documentation, including examples.

Replaces json-schema-example-loader

Installation

Installing and using a single package

Find the package in the workspaces/ directory and open its README.md for documentation.

Installing the monorepo

Please use recent versions of lerna (2+), node (6+) and yarn (v1+). Simply clone the repository and run lerna bootstrap, which will use yarn. A known good version of yarn is included in the scripts directory and configured in this repository's .yarnrc.

json-schema-tools's People

Contributors

0xflotus avatar dbemiller avatar handrews avatar jackwilsdon avatar manatarms avatar tajo avatar zackproser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

json-schema-tools's Issues

Module build failed: LoaderRunnerError: Module: '<path>/json-schema-apidoc-loader/lib/loader.js' is not a loader (must have normal or pitch function)

When accessing doca's generated index endpoint, it fails with the error
Module build failed: LoaderRunnerError: Module: '<path>/json-schema-apidoc-loader/lib/loader.js' is not a loader (must have normal or pitch function) (already mentioned in #15).

As far as I can tell, the loader definition inside the config.${ENV}.babel.js for json-schema-apidoc-loader seems to be no longer working because Webpack changed it's expected format. Please correct me, if I am wrong - I am no Webpack expert.

Support "examples" (plural) from draft-06

@cloudflare/json-schema-transform currently only understands singular example (a Doca-specific keyword), but in draft-06 examples was adopted into the standard. Rolling up arrays of examples is more complicated, but some sort of predictable roll-up behavior should be defined and implemented.

Clearly document config.js (base URI and headers)

Equivalent of cloudflare/doca#5

baseUri is used for the base when resolving href for examples. With draft-04 it is the only way to do so. draft-06+ have base, so this isn't really needed

globalHrefSchema is more or less what it says, corresponding to the draft-07 headerSchema. Need to explain its behavior (it's overridden by headerSchema, not allOf'd) and perhaps direct people to more flexible uses of headerSchema even with older drafts.

Webpack process only picks up some of the css files in a theme

As filed by @Relequestual as cloudflare/doca#40

When creating a theme with multiple css files in the styles folder, not all of them are always pick up and included.

Noted at cloudflare/doca#39 (comment)

I think I found the cause of this problem!
I had installed bootstrap, but removed the font files.
The CSS loader had a problem when it couldn't find the fonts, and died, without saying a word.
I only noticed this when I restarted the server in development mode and saw it in the console while it was trying to reload modules.
Added the fonts back, no problem.

I still came across a load order issue, but because they are loaded in alphabetical order (it seems), that's easy to fix.

Added another CSS file. Still have the problem where it's not picked up at...
require.context('doca-bootstrap-theme/styles', true, /\.css$/gi);
main.js

Help with inline import json-schema-ref-loader

Hi,

I have an issue when importing json using json-schema-ref-loader, this is most likely NOT json-schema-ref-loader issue but will appreciate if anyone can see what I'm missing...

So my import is like
import MySchema from '@cloudflare/json-schema-ref-loader!./my-schema.json';

And I get the following error when running webpack:

Module parse failed: Unexpected token m in JSON at position 0 while parsing near 'module.exports ...

I assumed this is because there is some other loader who tries to parse the json after json-schema-ref-loader loaded it, so I prefixed the loader with !! which should disable all configured loaders:
import MySchema from '!!@cloudflare/json-schema-ref-loader!./my-schema.json';
But still no luck :(

If I change the file extension from json -> jjj the following works:
import MySchema from '@cloudflare/json-schema-ref-loader!./my-schema.jjj';

Any ideas how I can resolve this?
Thx!

Support project folder outside of working directory

As filed by @TexKiller as cloudflare/doca#77

If the project_folder is specified outside of the current directory, such as with doca init -i ../schemas -o ../documentation, the json schemas paths are messed up, ending up like ../../../schemas/schema.json.

The path to the schemas should be either absolute or relative to the project_folder, and not relative to the working directory.

Windows support

The new @cloudflare/doca probably doesn't work any better on Windows than the old.

  • require paths in schema.js use forward slashes
  • when generating form data file upload curl examples, the syntax is different on Windows
  • commands in build and build:nojsare not Windows-friendly, per @wiggisser in @cloudflare/doca#25:

You must set an environment variable by set SOMEVAR=value. Further more this is a separete command so you'll have to add an additional && before the call to webpack like for instance

"cleanwin": "rmdir /S /Q build",
"buildwin": "npm run cleanwin && set NODE_ENV=production && webpack --config webpack/config.prod.withjs.babel.js && del build\\static-*", 
"buildwin:nojs": "npm run cleanwin set && NODE_ENV=production && webpack --config webpack/config.prod.nojs.babel.js && del build\\static-* && del build\\app-*.js"

From @aphilaja in cloudflare/doca#26:

I don't think Windows build has to be a special case:

use rimraf module instead of del and rm -rf.
use webpack -p instead of NODE_ENV=production
Then it should works equally in win & *nix.

Edit: Hmm.. not sure if -p sets NODE_ENV to production. If that's not the case and the env var is needed, I think there is Webpack plugin for it.

Order of properties

JavaScript does not reliably preserve object field ordering, and it is not trivial to hook JSON.parse() to produce a data structure that does. There are several possible solutions.

The JSON Schema UI vocabulary, if it gets off the ground, is likely to have keywords for managing display order. But there may be other options to explore. This issue tracks ideas for solving this problem.

The new implementation here tries to minimize changes to the parsed objects, so the problem may not be as bad, particularly when allOf is not heavily used to combine property sets.

The forthcoming UI should respect the required array for ordering those fields, but there is no corresponding way to order non-required fields. Also, if allOf and required are used together, the results may not be as expected.

Also paging @tajo @zackproser @Relequestual @Codelica
This replaces cloudflare/doca#28

Error: Cannot find module '@cloudflare/json-hyper-schema' and other start-up bumps...

hi there 👋

i'm trying to get up and running using doca. i was able to init a local docs app:

doca init -i path/to/my/project/files/ -o ./docs
Folder docs has been created.
Importing these schemas from path/to/my/project/files/:
- manifest.json
- manifest.schema.json
Doca project files has been copied!
Customizing doca project files:
docs/schemas.js
Trying to yarn add @cloudflare/doca-default-theme for project docs...
Theme @cloudflare/doca-default-theme at docs has been successfully installed!
Setting docs theme to @cloudflare/doca-default-theme. Files changed:
docs/src/client/main.js
docs/src/server/html.js
docs/webpack/build.js

i then cd ./docs && npm i which runs fine but when i try to run the resulting app, i get Error: Cannot find module '@cloudflare/json-hyper-schema'

if i install that dependency via npm i @cloudflare/json-hyper-schema --save, i'm able to run npm run build:nojs but then the resulting app is empty - open build/index.html shows what looks like empty boilerplate.

looking at the schemas.js and getting-started.json files, i see:

>>cat ./schemas.js 
import { fromJS } from 'immutable';

export default fromJS([
  // The "getting started" schema, which is automatically added to this
  // list by the scaffolding process, provides table-of-contents links
  // for the sections in src/client/introduction.js.  You are free
  // to customize or remove both the schema and the introduction component.
  require('./getting-started.json'),

]);

and

>>cat ./getting-started.json 
{
  "id": "/getting/started",
  "title": "Getting started",
  "cfHidden": true,
  "links": [
    {
      "title": "Endpoints",
      "href": "about:endpoints"
    },
    {
      "title": "Requests",
      "href": "about:requests"
    },
    {
      "title": "Responses",
      "href": "about:responses"
    },
    {
      "title": "Resource Identifiers",
      "href": "about:identifiers"
    }
  ]
}

not sure where i went wrong but fwiw, i'm doing perhaps two things that are unexpected / not handled: 1) i'm running npm (not yarn) and 2) my data and schema are located in the same directory (manifest.json and manifest.schema.json where the former is my actual data and the later is the schema file using $schema: "http://json-schema.org/draft-07/schema#")

any pointers you could provide would be much appreciated 🙏

Getting yarn errors

It seems these tools are what I need to document my json schema: https://github.com/andrejellema/GlobalCoffeeDataStandard/blob/master/global-coffee-data-standard.schema.json

But I'm having major problems installing it. I'm getting a lot of yarn errors.

I'm using Win10 and I'm not familiar with yarn.
I also installed lerna, which is new to me too.

In my dev-folder everything seems to be ok:

D:\dev>yarn --version
1.13.0
D:\dev>lerna --version
3.10.7
D:\dev>node --version
v10.15.0

In the folder that holds my schema as well:

D:\dev\GlobalCoffeeDataStandard>yarn --version
1.13.0

But in the freshly cloned json-schema-tools schema I get this:

D:\dev\json-schema-tools>yarn --version
D:\dev\json-schema-tools\scripts\yarn\bin\yarn:2
argv0=$(echo "$0" | sed -e 's,\\,/,g')
        ^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)

The documentation says I should start with lerna bootstrap. That is giving these errors:

D:\dev\json-schema-tools>lerna bootstrap
lerna notice cli v3.10.7
lerna info versioning independent
lerna info bootstrap root only
D:\dev\json-schema-tools\scripts\yarn\bin\yarn:2
argv0=$(echo "$0" | sed -e 's,\\,/,g')
        ^^^^

SyntaxError: missing ) after argument list
    at new Script (vm.js:79:7)
    at createScript (vm.js:251:10)
    at Object.runInThisContext (vm.js:303:10)
    at Module._compile (internal/modules/cjs/loader.js:657:28)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
    at startup (internal/bootstrap/node.js:283:19)
lerna ERR! yarn install --mutex network:42424 --non-interactive exited 1 in '@cloudflare/json-schema-tools'
lerna ERR! yarn install --mutex network:42424 --non-interactive exited 1 in '@cloudflare/json-schema-tools'

When I remove the .yarnrc-file it seems to work:

D:\dev\json-schema-tools>lerna bootstrap
lerna notice cli v3.10.7
lerna info versioning independent
lerna info bootstrap root only
yarn install v1.13.0
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "workspace-aggregator-cc28e7f7-5fbb-42d4-b547-a3fafb988fd4 > @cloudflare/json-schema-apidoc-loader > [email protected]" has unmet peer dependency "webpack@^2.0.0 || ^3.0.0 || ^4.0.0".
[4/4] Building fresh packages...
Done in 11.82s.

I also can run doca init in my schema folder and the documentation folder is created and it contains several files.

I can also run

D:\dev\GlobalCoffeeDataStandard\git\documentation>yarn install
yarn install v1.13.0
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
Done in 0.35s.

But yarn start failes:

D:\dev\GlobalCoffeeDataStandard\git\documentation>yarn start
yarn run v1.13.0
$ node webpack/index | NODE_ENV=development node src/server
'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 255.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

D:\dev\GlobalCoffeeDataStandard\git\documentation>× 「wdm」: Hash: 1528029a029c0dd52815
Version: webpack 3.12.0
Time: 1417ms
 Asset    Size  Chunks                    Chunk Names
app.js  3.7 MB       0  [emitted]  [big]  app
  [14] ./node_modules/react/react.js 56 bytes {0} [built]
  [33] (webpack)/buildin/module.js 517 bytes {0} [built]
  [92] ./node_modules/react-dom/index.js 59 bytes {0} [built]
 [118] ./node_modules/react-redux/es/index.js 229 bytes {0} [built]
 [158] multi webpack-hot-middleware/client?path=http://192.168.1.149:8080/__webpack_hmr ./src/client/index.js 40 bytes {0} [built]
 [159] (webpack)-hot-middleware/client.js?path=http://192.168.1.149:8080/__webpack_hmr 7.77 kB {0} [built]
 [160] ./node_modules/querystring-es3/index.js 127 bytes {0} [built]
 [163] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
 [165] (webpack)-hot-middleware/client-overlay.js 2.21 kB {0} [built]
 [170] (webpack)-hot-middleware/process-update.js 4.37 kB {0} [built]
 [171] ./src/client/index.js 710 bytes {0} [built]
 [271] ./node_modules/react-redux/es/components/Provider.js 2.17 kB {0} [built]
 [299] ./src/client/main.js 1.27 kB {0} [built]
 [425] ./node_modules/@cloudflare/doca-default-theme/styles \.less$/ 160 bytes {0} [optional] [built]
 [427] ./src/client/store.js 1.42 kB {0} [built]
    + 416 hidden modules

ERROR in ./getting-started.json
Module build failed: Error: Cannot find module '@cloudflare/json-hyper-schema'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (D:\dev\GlobalCoffeeDataStandard\git\documentation\node_modules\@cloudflare\json-schema-transform\lib\example.js:2:18)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Object.require.extensions.(anonymous function) [as .js] (D:\dev\GlobalCoffeeDataStandard\git\documentation\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
 @ ./schemas.js 14:0-33
 @ ./src/client/store.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://192.168.1.149:8080/__webpack_hmr ./src/client/index.js

After hours of trying I give up. Please assist me on how to run doca.

Webpack warning when running examples

I am trying to run the doca examples using the following commands:

lerna -v
node -v
git clone https://github.com/cloudflare/json-schema-tools.git
cd json-schema-tools
lerna bootstrap
cd workspaces/doca/example-schemas/draft-04
doca init
cd documentation
../../../../../scripts/yarn/bin/yarn install
../../../../../scripts/yarn/bin/yarn start

But I get warnings from webpack and the resulting webpage is only very minimally styled. The output from the above is:

2.11.0
v8.9.1
Cloning into 'json-schema-tools'...
remote: Counting objects: 883, done.
remote: Compressing objects: 100% (390/390), done.
remote: Total 883 (delta 471), reused 862 (delta 451), pack-reused 0
Receiving objects: 100% (883/883), 1.26 MiB | 1.98 MiB/s, done.
Resolving deltas: 100% (471/471), done.
lerna info version 2.11.0
lerna info versioning independent
lerna info Bootstrapping 7 packages
lerna info hoist Finished installing in root
lerna success Bootstrapped 7 packages
Folder documentation has been created.
Importing these schemas from .:
- common/collection.json
- common/identifier.json
- solarsystem/definitions/measurements.json
- solarsystem/definitions/orbit.json
- solarsystem/definitions/planet.json
- solarsystem/dwarfplanet.json
- solarsystem/planet.json
- solarsystem/probe.json
- solarsystem/sun.json
Doca project files has been copied!
Customizing doca project files:
documentation/schemas.js
Trying to yarn add @cloudflare/doca-default-theme for project documentation...
Theme @cloudflare/doca-default-theme at documentation has been successfully installed!
Setting documentation theme to @cloudflare/doca-default-theme. Files changed:
documentation/src/client/main.js
documentation/src/server/html.js
documentation/webpack/build.js
yarn install v1.3.2
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.50s.
yarn run v1.3.2
$ node webpack/index | NODE_ENV=development node src/server
Server started on port 8000
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/planet.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/dwarfplanet.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/probe.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/solarsystem/sun.json
/Users/rich/code/json-schema-tools/workspaces/doca/example-schemas/draft-04/documentation/getting-started.json
⚠ 「wdm」: Hash: c48508533cd4cb5aaf7c
Version: webpack 3.12.0
Time: 1817ms
 Asset     Size  Chunks                    Chunk Names
app.js  4.04 MB       0  [emitted]  [big]  app
  [14] ./node_modules/react/react.js 56 bytes {0} [built]
  [33] (webpack)/buildin/module.js 517 bytes {0} [built]
  [81] ./schemas.js 635 bytes {0} [built]
  [91] ./node_modules/react-dom/index.js 59 bytes {0} [built]
 [117] ./node_modules/react-redux/es/index.js 230 bytes {0} [built]
 [154] multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js 40 bytes {0} [built]
 [155] (webpack)-hot-middleware/client.js?path=http://198.18.0.254:8080/__webpack_hmr 7.77 kB {0} [built]
 [156] ./node_modules/querystring-es3/index.js 127 bytes {0} [built]
 [159] ./node_modules/strip-ansi/index.js 161 bytes {0} [built]
 [161] (webpack)-hot-middleware/client-overlay.js 2.21 kB {0} [built]
 [166] (webpack)-hot-middleware/process-update.js 4.33 kB {0} [built]
 [167] ./src/client/index.js 710 bytes {0} [built]
 [292] ./src/client/main.js 1.27 kB {0} [built]
 [293] ./node_modules/@cloudflare/doca-default-theme/index.js 100 bytes {0} [built]
 [413] ./src/client/store.js 1.42 kB {0} [built]
    + 406 hidden modules

WARNING in ./src/client/main.js
23:15-89 Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.
 @ ./src/client/main.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js

WARNING in ./src/client/main.js
25:16-91 Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.
 @ ./src/client/main.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js

WARNING in ./src/client/main.js
27:16-91 Critical dependency: Contexts can't use RegExps with the 'g' or 'y' flags.
 @ ./src/client/main.js
 @ ./src/client/index.js
 @ multi webpack-hot-middleware/client?path=http://198.18.0.254:8080/__webpack_hmr ./src/client/index.js

This is using macOS 10.13.1

Is it something I'm doing wrong?

json-schema-ref-loader can't handle circular references

A simple JSON schema:

{
    "$schema": "http://json-schema.org/draft-04/schema#",

    "definitions": {
        "node": {
            "title": "a node",
            "type": "object",
            "properties": {
                "children": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/node"
                    }
                }
            }
        }
    }
}

causes json-schema-loader to fail with the following error:

ERROR in ../src/schema/node.json
Module build failed: TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at Object.handleResolveSuccess (/Users/fabian/projects/node-lib-spec/schema-doc/node_modules/json-schema-loader/lib/loader.js:19:21)
    at <anonymous>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.