|
1 | 1 |   |
2 | 2 |
|
| 3 | +> If you are currently using version 2, check out [migration guideline to version 3](./migrations/Migrate%20to%20version%203.md). You might be able to update it without any change. |
3 | 4 | # AsyncAPI |
4 | 5 |
|
5 | | -This package provides all the versions of the AsyncAPI schema. |
| 6 | +This is a mono repository, which provides all the JSON Schema documents for validating AsyncAPI documents. |
6 | 7 |
|
7 | 8 | ## Installation |
8 | 9 |
|
@@ -37,3 +38,28 @@ const asyncapi = versions['1.1.0']; |
37 | 38 |
|
38 | 39 | // Do something with the schema. |
39 | 40 | ``` |
| 41 | + |
| 42 | +## Repository structure |
| 43 | +This is the current project structure explained. |
| 44 | +- [./definitions](./definitions) - contain all the individual schemas that will automatically be bundled together to provide the schemas in [./schemas](./schemas). |
| 45 | +- [./tools/bundler](./tools/bundler) - is the tool that bundles all the individual schemas together. |
| 46 | +- [./schemas](./schemas) - contain all automatically bundled and complete schemas for each AsyncAPI version. These schemas should **NOT** be manually changed as they are automatically generated. Any changes should be done in [./definitions](./definitions). |
| 47 | + |
| 48 | +## Schema Bundling |
| 49 | +Changes should not be done manually to the schemas in [./schemas](./schemas), but instead be done in their individual definitions located in [./definitions](./definitions). |
| 50 | + |
| 51 | +These definitions are automatically bundled together on new releases through the npm script `prepublishOnly`, which ensures the project is build. This is where the [bundler](./tools/bundler) is called. |
| 52 | + |
| 53 | +For example, for [2.2.0](./definitions/2.2.0), the [bundler](./tools/bundler/index.js) starts with the [asyncapi.json](definitions/2.2.0/asyncapi.json) file and recursively goes through all references (`$ref`) to create the [appropriate bundled version](./schemas/2.2.0.json). |
| 54 | + |
| 55 | +### Creating a new version |
| 56 | +To create a new version, simply run the following command: |
| 57 | +``` |
| 58 | +npm run startNewVersion --new-version=x.x.x |
| 59 | +``` |
| 60 | +Where `x.x.x` is the new version you want to create. |
| 61 | + |
| 62 | +The manual process of creating a new version is to: |
| 63 | +1. Duplicate the latest version (`y.y.y`) under definitions (so we have the correct base to make changes from). |
| 64 | +2. Rename the folder to the new version (`x.x.x`). |
| 65 | +3. Search and replace in the new duplicated folder for `y.y.y` and replace it with `x.x.x`. |
0 commit comments