@@ -16,12 +16,14 @@ Use `make install-dev` to install the necessary dependencies for this applicatio
1616## Generating Models
1717
1818In order for this tool to function, you must first build the JSON schemas for
19- the Digital Letters events. The simplest way to build these schemas is to run
20- the ` npm run generate-dependencies ` command from the root of this repository.
19+ the Digital Letters events. This is done automatically when the ` make config `
20+ command is run, but if you need to rebuild them for some reason the simplest
21+ approach is to run the ` make generate ` command from the root of this repository.
2122
2223### Using the Generator
2324
24- Once the JSON schemas have been built, Pydantic models can be generated by running:
25+ Once the JSON schemas have been built, Pydantic models can be generated by
26+ running the following from this directory:
2527
2628``` bash
2729make generate
@@ -31,15 +33,7 @@ This will:
3133
3234- Read all JSON event schemas from ` schemas/digital-letters/2025-10-draft/events/ `
3335- Generate Pydantic v2 models using ` datamodel-code-generator `
34- - Output the models to ` ../digital-letters-events/models/ `
35-
36- ### Configuration
37-
38- The generator can be configured through:
39-
40- - Command-line arguments
41- - Environment variables
42- - Configuration file (if needed)
36+ - Output the models to ` ../digital-letters-events/digital_letters_events/models/ `
4337
4438### Output Structure
4539
@@ -50,8 +44,8 @@ Generated models are placed in the
5044<!-- vale Vale.Terms = YES -->
5145<!-- vale Vale.Avoid = YES -->
5246
53- - ` ../digital-letters-events/models/ ` - Individual Pydantic model files
54- - ` ../digital-letters-events/models/__init__.py ` - Combined index for easy imports
47+ - ` ../digital-letters-events/digital_letters_events/ models/ ` - Individual Pydantic model files
48+ - ` ../digital-letters-events/digital_letters_events/ models/__init__.py ` - Combined index for easy imports
5549
5650## Testing
5751
@@ -85,26 +79,3 @@ make install-dev
8579``` bash
8680make test
8781```
88-
89- ## Usage
90-
91- Once generated, the models can be used in your code as follows:
92-
93- ``` python
94- from digital_letters_event_python import PrintLetterAvailable, CloudEventEnvelope
95-
96- # Validate incoming event
97- event_data = CloudEventEnvelope(** raw_event)
98- if event_data.type == " uk.nhs.notify.digital.letters.letter.available.v1" :
99- letter_available = PrintLetterAvailable(** raw_event)
100- # Process the validated event
101- ```
102-
103- ## Architecture
104-
105- The generator consists of:
106-
107- - ` src/generate_models.py ` - Main CLI script
108- - ` src/schema_processor.py ` - Schema loading and processing
109- - ` src/model_generator.py ` - Pydantic model generation logic
110- - ` src/file_utils.py ` - File system utilities
0 commit comments