nl_tokens: Converts a group of specifications into JSON Schema .
pl_tokens: function exportToJSONSchema ( expSpecifications , baseSchemaURL , baseTypeURL , flat = <mask> ) { const namespaceResults = { } ; const endOfTypeURL = baseTypeURL [ baseTypeURL . length - 1 ] ; if ( endOfTypeURL !== '#' && endOfTypeURL !== '/' ) { baseTypeURL += '/' ; } for ( const ns of expSpecifications . namespaces . all ) { const lastLogger = logger ; logger = logger . child ( { shrId : ns . namespace } ) ; try { logger . debug ( 'Exporting namespace.' ) ; if ( flat ) { const { schemaId , schema } = flatNamespaceToSchema ( ns , expSpecifications . dataElements , baseSchemaURL , baseTypeURL ) ; namespaceResults [ schemaId ] = schema ; } else { const { schemaId , schema } = namespaceToSchema ( ns , expSpecifications . dataElements , baseSchemaURL , baseTypeURL ) ; namespaceResults [ schemaId ] = schema ; } logger . debug ( 'Finished exporting namespace.' ) ; } finally { logger = lastLogger ; } } return namespaceResults ; }