Skip to content

Commit acd3218

Browse files
committed
add ability to include event documentation in events schema
Signed-off-by: Lance-Drane <Lance-Drane@users.noreply.github.com>
1 parent 1460e98 commit acd3218

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/intersect_sdk/_internal/schema.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,8 @@ def _add_events(
308308
'serialization',
309309
)
310310
_ensure_title_in_schema(event_schema, event_key)
311+
if event_definition.event_documentation:
312+
event_schema['description'] = event_definition.event_documentation
311313
event_schemas[event_key] = event_schema
312314
event_metadatas[event_key] = EventMetadata(
313315
type=event_definition.event_type,

tests/fixtures/example_schema.json

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -846,26 +846,31 @@
846846
"type": "string"
847847
}
848848
],
849-
"title": "union"
849+
"title": "union",
850+
"description": "Generic example of how to do a union event"
850851
},
851852
"int": {
852853
"type": "integer",
853-
"title": "int"
854+
"title": "int",
855+
"description": "Generic integer event"
854856
},
855857
"str": {
856858
"type": "string",
857-
"title": "str"
859+
"title": "str",
860+
"description": "Generic string event"
858861
},
859862
"float": {
860863
"type": "number",
861-
"title": "float"
864+
"title": "float",
865+
"description": "Generic float event"
862866
},
863867
"list_float": {
864868
"items": {
865869
"type": "number"
866870
},
867871
"type": "array",
868-
"title": "list_float"
872+
"title": "list_float",
873+
"description": "generic list of floats event"
869874
}
870875
},
871876
"status": {

0 commit comments

Comments
 (0)