docusaurus-plugin-generate-schema-docs 1.1.0 → 1.1.1

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.
Files changed (2) hide show
  1. package/README.md +75 -0
  2. package/package.json +10 -2
package/README.md ADDED
@@ -0,0 +1,75 @@
1
+ # Docusaurus Plugin: Generate Schema Docs
2
+
3
+ This Docusaurus v2 plugin generates documentation from JSON schemas. It provides a set of tools to automatically create and validate documentation for your event schemas.
4
+
5
+ ## Features
6
+
7
+ - **Automatic Documentation Generation**: Generates MDX documentation from your JSON schemas.
8
+ - **Schema Validation**: Validates your schemas against the examples provided within them.
9
+ - **CLI Commands**: Provides CLI commands to generate and validate schema documentation.
10
+ - **Custom Components**: Includes React components to beautifully render your schema documentation.
11
+
12
+ ## Installation
13
+
14
+ ```bash
15
+ npm install --save docusaurus-plugin-generate-schema-docs
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ 1. Configure the plugin in your `docusaurus.config.js`:
21
+
22
+ ```javascript
23
+ // docusaurus.config.js
24
+
25
+ module.exports = {
26
+ // ...
27
+ plugins: [
28
+ [
29
+ 'docusaurus-plugin-generate-schema-docs',
30
+ {
31
+ // Options if any
32
+ },
33
+ ],
34
+ ],
35
+ // ...
36
+ };
37
+ ```
38
+
39
+ 2. Place your JSON schemas in the `schemas` directory at the root of your project.
40
+
41
+ ## CLI Commands
42
+
43
+ ### Generate Documentation
44
+
45
+ To generate the documentation from your schemas, run the following command:
46
+
47
+ ```bash
48
+ npx docusaurus generate schema-docs
49
+ ```
50
+
51
+ This will generate MDX files in the `docs/events` directory.
52
+
53
+ ### Validate Schemas
54
+
55
+ To validate your schemas, run the following command:
56
+
57
+ ```bash
58
+ npx docusaurus validate-schemas
59
+ ```
60
+
61
+ This will validate the schemas in the `schemas` directory.
62
+
63
+ ## How it Works
64
+
65
+ The plugin reads your JSON schemas, dereferences any `$ref` properties, and merges `allOf` properties. It then generates an MDX file for each schema, which uses custom React components to render the schema details.
66
+
67
+ The validation script builds an example from each schema and validates it against the schema itself, ensuring your examples are always in sync with your schemas.
68
+
69
+ ## Contributing
70
+
71
+ Contributions are welcome! Please open an issue or submit a pull request if you have any ideas or improvements.
72
+
73
+ ## License
74
+
75
+ This project is licensed under the MIT License.
package/package.json CHANGED
@@ -1,12 +1,20 @@
1
1
  {
2
2
  "name": "docusaurus-plugin-generate-schema-docs",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Docusaurus plugin to generate documentation from JSON schemas.",
5
5
  "main": "index.js",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/benedikt-buchert/tracking_docs.git"
10
+ },
7
11
  "dependencies": {
8
12
  "@apidevtools/json-schema-ref-parser": "^15.1.3",
9
13
  "fs-extra": "^11.2.0",
10
14
  "json-schema-merge-allof": "^0.8.1"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public",
18
+ "provenance": true
11
19
  }
12
- }
20
+ }