bossenti commented on code in PR #1286:
URL: https://github.com/apache/streampipes/pull/1286#discussion_r1106700973


##########
streampipes-client-python/streampipes/model/common.py:
##########
@@ -115,37 +131,41 @@ class TopicDefinition(BasicModel):
     Data model of a `TopicDefinition` in compliance to the StreamPipes Backend.
     """
 
-    class_name: Optional[StrictStr] = Field(alias="@class")
-    actual_topic_name: StrictStr
+    class_name: Optional[StrictStr] = Field(
+        alias="@class", default_factory=lambda: 
"org.apache.streampipes.model.grounding.SimpleTopicDefinition"
+    )
+    actual_topic_name: StrictStr = Field(default_factory=lambda: 
f"org.apache.streampipes.connect.{uuid4()}")
 
 
 class TransportProtocol(BasicModel):
     """
     Data model of a `TransportProtocol` in compliance to the StreamPipes 
Backend.
     """
 
-    class_name: StrictStr = Field(alias="@class")
-    element_id: Optional[StrictStr]
-    broker_hostname: StrictStr
-    topic_definition: TopicDefinition
-    port: StrictInt = Field(alias="kafkaPort")
+    class_name: StrictStr = Field(
+        alias="@class", default_factory=lambda: 
"org.apache.streampipes.model.grounding.NatsTransportProtocol"
+    )
+    element_id: StrictStr = Field(default_factory=lambda: 
f"sp:transportprotocol:{random_letters(6)}")
+    broker_hostname: StrictStr = "nats"
+    topic_definition: TopicDefinition = Field(default_factory=TopicDefinition)
+    port: StrictInt = Field(alias="kafkaPort", default_factory=lambda: 4222)

Review Comment:
   Is `4222` the default port for all protocols?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to