pierrejeambrun commented on code in PR #43102:
URL: https://github.com/apache/airflow/pull/43102#discussion_r1808447157


##########
airflow/api_fastapi/core_api/serializers/connections.py:
##########
@@ -24,19 +24,24 @@
 from airflow.utils.log.secrets_masker import redact
 
 
-class ConnectionResponse(BaseModel):
+class ConnectionBase(BaseModel):
     """Connection serializer for responses."""
 
-    connection_id: str = Field(serialization_alias="connection_id", 
validation_alias="conn_id")
     conn_type: str
-    description: str | None
-    host: str | None
-    login: str | None
-    schema_: str | None = Field(alias="schema")
-    port: int | None
-    extra: str | None
-
-    @field_validator("extra", mode="before")
+    description: str | None = Field(default=None)
+    host: str | None = Field(default=None)
+    login: str | None = Field(default=None)
+    schema_: str | None = Field(None, alias="schema")
+    port: int | None = Field(default=None)
+    extra: str | None = Field(default=None)
+
+
+class ConnectionResponse(ConnectionBase):

Review Comment:
   Hello @bugraoz93,
   
   
   TLDR: Yes fastapi use the `exploded=True` way for passing list, and we 
should use that and not try to pass comma separated value as before 
`q=item1,item2`. That's a breaking change and we can document it.
   
   Indeed fastapi use the `exploded=True` form where the legacy one does not. 
You can take a look at the other tests on the `update_mask` in fastapi. You can 
either pass an object with a list to the `params` parameters of the starlette 
test client, and let him handle the formatting and encoding of query 
parameters. (what we are doing). i.e `client.get(..., params={"q": [item1, 
item2]})`.
   
   Or you can do that manually (don't recommend) by doing "`?q=item1&q=item2`".
   
   More info on the spec here:
   https://swagger.io/docs/specification/v3_0/serialization/
   
   I can add a `significant` newsfragment to warn users that this changed.



-- 
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