File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -155,16 +155,19 @@ def register_channel_operation(
155
155
_operation_message_refs = []
156
156
for message in messages :
157
157
# TODO: Check for overlapping model schemas, if they are different log a warning!
158
- _components_schemas [ message . __name__ ] = message .model_json_schema (
158
+ _message_json_schema = message .model_json_schema (
159
159
mode = "validation" if operation_type == "receive" else "serialization" ,
160
160
ref_template = "#/components/schemas/{model}" ,
161
161
)
162
- _components_schemas .update (
163
- message .model_json_schema (mode = "serialization" , ref_template = "#/components/schemas/{model}" )["$defs" ]
164
- )
162
+
163
+ _components_schemas [message .__name__ ] = _message_json_schema
164
+
165
+ if _message_json_schema .get ("$defs" ):
166
+ _components_schemas .update (_message_json_schema ["$defs" ])
165
167
_channels [channel_id ].messages [message .__name__ ] = pa .Message ( # type: ignore
166
168
payload = pa .Reference (ref = f"#/components/schemas/{ message .__name__ } " )
167
169
)
170
+
168
171
# Cannot point to the /components path
169
172
_operation_message_refs .append (pa .Reference (ref = f"#/channels/{ channel_id } /messages/{ message .__name__ } " ))
170
173
You can’t perform that action at this time.
0 commit comments