schema-markdown 1.2.11 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -78,22 +78,58 @@ try {
78
78
  ~~~
79
79
 
80
80
 
81
- ## Document a Schema
82
-
83
- To document the schema, download the
84
- [documentation application](https://github.com/craigahobbs/schema-markdown-doc#the-schema-markdown-documentation-viewer)
85
- stub and save the type model as JSON:
86
-
87
- ~~~
88
- curl -O https://craigahobbs.github.io/schema-markdown-doc/extra/index.html
89
- node --input-type=module \
90
- -e 'import {modelTypes} from "model.js"; console.log(JSON.stringify(modelTypes))' \
91
- > model.json
81
+ ## Schema Documentation
82
+
83
+ You can document a schema with BareScript's
84
+ [schemaDoc application](https://craigahobbs.github.io/bare-script/library/#var.vGroup='schemaDoc.bare')
85
+ running on the
86
+ [MarkdownUp application](https://craigahobbs.github.io/markdown-up/).
87
+
88
+ If your
89
+ [type model JSON file](https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types')
90
+ or
91
+ [Schema Markdown file](https://craigahobbs.github.io/schema-markdown-js/language/)
92
+ is publicly visible, you can use the BareScript model application with the `var.vURL` query argument:
93
+
94
+ <https://craigahobbs.github.io/bare-script/model/#var.vURL='https://craigahobbs.github.io/bare-script/library/model.json'>
95
+
96
+ **Note:** Schema Markdown files use the `.smd` file extension.
97
+
98
+
99
+ ### Self-Hosting Schema Documentation
100
+
101
+ You can host the schemaDoc application yourself by adding a schemaDoc HTML stub:
102
+
103
+ ``` html
104
+ <!DOCTYPE html>
105
+ <html lang="en">
106
+ <head>
107
+ <title>MarkdownUp</title>
108
+ <meta charset="utf-8">
109
+ <meta name="viewport" content="width=device-width, initial-scale=1">
110
+ <link rel="stylesheet" href="https://craigahobbs.github.io/markdown-up/app.css">
111
+ <link rel="preload" href="https://craigahobbs.github.io/markdown-up/bare-script/static/markdown.css" as="style">
112
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/appImports.js" as="script">
113
+ </head>
114
+ <script type="module">
115
+ import {MarkdownUp} from 'https://craigahobbs.github.io/markdown-up/lib/appImports.js';
116
+ const app = new MarkdownUp(window, {
117
+ 'markdownText': `\
118
+ ~~~markdown-script
119
+ include <schemaDoc.bare>
120
+
121
+ schemaDocMain('model.json', 'My Model')
92
122
  ~~~
123
+ `
124
+ });
125
+ app.run();
126
+ </script>
127
+ </html>
128
+ ```
93
129
 
94
- To host locally, start a local static web server:
130
+ To view locally, start a local static web server:
95
131
 
96
- ~~~
132
+ ~~~ sh
97
133
  python3 -m http.server
98
134
  ~~~
99
135
 
package/lib/parser.js CHANGED
@@ -56,10 +56,11 @@ const rLineSplit = /\r?\n/;
56
56
  *
57
57
  * @param {string|string[]} text - The Schema Markdown text
58
58
  * @param {Object} [options = {}] - The options object
59
- * @param {Object} [options.types={}] - The [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
59
+ * @param {Object} [options.types={}] - The
60
+ * [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
60
61
  * @param {string} [options.filename=''] - The name of file being parsed (for error messages)
61
62
  * @param {boolean} [options.validate=true] - If true, validate after parsing
62
- * @returns {Object} The [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
63
+ * @returns {Object} The [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
63
64
  * @throws [SchemaMarkdownParserError]{@link module:lib/parser.SchemaMarkdownParserError}
64
65
  */
65
66
  export function parseSchemaMarkdown(text, {types = {}, filename = '', validate = true} = {}) {
package/lib/schema.js CHANGED
@@ -10,10 +10,10 @@ import {validateTypeModelErrors} from './schemaUtil.js';
10
10
  /**
11
11
  * Get a user type's referenced type model
12
12
  *
13
- * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
13
+ * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
14
14
  * @param {string} typeName - The type name
15
15
  * @param {Object} [referencedTypes=null] - Optional map of referenced user type name to user type model
16
- * @returns {Object} The referenced [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
16
+ * @returns {Object} The referenced [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
17
17
  */
18
18
  export function getReferencedTypes(types, typeName, referencedTypes = {}) {
19
19
  return getReferencedTypesHelper(types, {'user': typeName}, referencedTypes);
@@ -120,7 +120,7 @@ export class ValidationError extends Error {
120
120
  * Type-validate a value using a user type model. Container values are duplicated since some member types are
121
121
  * transformed during validation.
122
122
  *
123
- * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
123
+ * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
124
124
  * @param {string} typeName - The type name
125
125
  * @param {Object} value - The value object to validate
126
126
  * @param {?string} [memberFqn=null] - The fully-qualified member name
@@ -455,10 +455,10 @@ function validateAttr(type, attr, value, memberFqn) {
455
455
  /**
456
456
  * Get the struct's members (inherited members first)
457
457
  *
458
- * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
459
- * @param {Object} struct - The [struct model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Struct'}
458
+ * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
459
+ * @param {Object} struct - The [struct model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Struct'}
460
460
  * @returns {Array<Object>} The array of
461
- * [struct member models]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='StructMember'}
461
+ * [struct member models]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='StructMember'}
462
462
  */
463
463
  export function getStructMembers(types, struct) {
464
464
  // No base structs?
@@ -488,10 +488,10 @@ export function getStructMembers(types, struct) {
488
488
  /**
489
489
  * Get the enum's values (inherited values first)
490
490
  *
491
- * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
492
- * @param {Object} enum_ - The [enum model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Enum'}
491
+ * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
492
+ * @param {Object} enum_ - The [enum model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Enum'}
493
493
  * @returns {Array<Object>} The array of
494
- * [enum value models]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='EnumValue'}
494
+ * [enum value models]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='EnumValue'}
495
495
  */
496
496
  export function getEnumValues(types, enum_) {
497
497
  // No base enums?
@@ -521,8 +521,8 @@ export function getEnumValues(types, enum_) {
521
521
  /**
522
522
  * Validate a type model's types object
523
523
  *
524
- * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
525
- * @returns {Object} The validated [type model]{@link https://craigahobbs.github.io/schema-markdown-doc/doc/#var.vName='Types'}
524
+ * @param {Object} types - The [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
525
+ * @returns {Object} The validated [type model]{@link https://craigahobbs.github.io/bare-script/model/#var.vURL=''&var.vName='Types'}
526
526
  * @throws [ValidationError]{@link module:lib/schema.ValidationError}
527
527
  */
528
528
  export function validateTypeModel(types) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "schema-markdown",
4
- "version": "1.2.11",
4
+ "version": "1.2.13",
5
5
  "description": "A schema definition and validation library",
6
6
  "keywords": [
7
7
  "schema",
@@ -24,8 +24,10 @@
24
24
  "test": "node --test test/"
25
25
  },
26
26
  "devDependencies": {
27
- "c8": "~10.1",
28
- "eslint": "~9.14",
27
+ "@eslint/js": "~10.0",
28
+ "c8": "~11.0",
29
+ "eslint": "~10.1",
30
+ "globals": "~17.4",
29
31
  "jsdoc": "~4.0"
30
32
  }
31
33
  }