Synchronous API For JSON Schema $Ref ParserBigstickCarpet's JSON Schema $Ref Parser is very useful, but at present has no synchronous API -- despite multiple requests for one.
This tiny package uses a hideous hack to present a simple synchronous API to $Ref Parser's
const $SyncRefParser = require('json-schema-ref-parser-sync'); expandedSchema = $SyncRefParser.dereference(schema, options);
$SyncRefParser.dereferenceexpands the provided JSON Schema's
$refreferences, infuenced by the
optionif they are provided, and returns the expanded version of the schema. If an error occurs, it throws an
This code, such as it is, was inspired by a comment by willfarrell on JSON Schema $Ref Parser's as-yet unresolved issue 24: Syncronous API.
I hope this will go away some time soon, when JSON Schema $Ref Parser gains a synchronous API of its own.