Skip to content

Commit f1605f2

Browse files
committed
improving docs
1 parent 5943c84 commit f1605f2

1 file changed

Lines changed: 28 additions & 8 deletions

File tree

schema/README.md

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,35 @@
22

33
This directory contains the templates and code that _generate_ the official JSON schemas for the Mobility Data Specification. However, the official schema documents live inside the `provider`, `agency` or appropriate folder.
44

5-
## Updating the Schemas
5+
## Regenerating the Schemas
66

7-
1. Edit the appropriate file(s) inside the the `templates` directory.
7+
At a command prompt within this `schema` directory run:
88

9-
1. At a command prompt within this `schema` directory run:
9+
```bash
10+
python generate_schemas.py [--agency] [--provider]
11+
```
1012

11-
```bash
12-
python generate_schemas.py [--agency] [--provider]
13-
```
13+
The optional flags `--agency` and `--provider` can be used to specify which
14+
set of schemas to generate. The default is to generate all schemas.
1415

15-
The optional flags `--agency` and `--provider` can be used to specify which
16-
set of schemas to generate. The default is to generate all schemas.
16+
## Updating Schemas
17+
18+
1. Edit the appropriate file(s) inside the the [`templates/`][templates] directory.
19+
20+
1. Run the command to regenerate the schema(s).
21+
22+
## Adding New Schemas
23+
24+
1. Create a new template in the appropriate folder inside [`templates/`][templates]. See the existing templates for ideas. Remember to reference shared definitions from [`templates/common.json`][common-template].
25+
26+
1. Edit the appropriate `.py` file to add a function that creates the new schema as a `dict`. See the existing functions for ideas. The [`common` module][common-module] defines some shared functionality.
27+
28+
1. Add your schema name and generator function to the collection in the `schema_generators()` function at the top of each `.py` file.
29+
30+
1. Run the command to regenerate the schema(s).
31+
32+
[agency]: ../agency
33+
[common-module]: common.py
34+
[common-template]: templates/common.json
35+
[provider]: ../provider
36+
[templates]: templates/

0 commit comments

Comments
 (0)