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(
155155 _operation_message_refs = []
156156 for message in messages :
157157 # 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 (
159159 mode = "validation" if operation_type == "receive" else "serialization" ,
160160 ref_template = "#/components/schemas/{model}" ,
161161 )
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" ])
165167 _channels [channel_id ].messages [message .__name__ ] = pa .Message ( # type: ignore
166168 payload = pa .Reference (ref = f"#/components/schemas/{ message .__name__ } " )
167169 )
170+
168171 # Cannot point to the /components path
169172 _operation_message_refs .append (pa .Reference (ref = f"#/channels/{ channel_id } /messages/{ message .__name__ } " ))
170173
You can’t perform that action at this time.
0 commit comments