Dev-iL commented on code in PR #77113:
URL: https://github.com/apache/airflow/pull/77113#discussion_r4640240634


##########
airflow-core/src/airflow/api_fastapi/common/types.py:
##########
@@ -71,6 +74,27 @@ class TimeDelta(BaseModel):
 TimeDeltaWithValidation = Annotated[TimeDelta, 
BeforeValidator(_validate_timedelta_field)]
 
 
+class _SkipJsonValueWalk:
+    def __get_pydantic_core_schema__(
+        self, source_type: Any, handler: GetCoreSchemaHandler
+    ) -> core_schema.CoreSchema:
+        return core_schema.no_info_wrap_validator_function(
+            lambda value, _validate: value,
+            handler(source_type),
+            
serialization=core_schema.plain_serializer_function_ser_schema(lambda value: 
value),
+        )
+
+
+DecodedJsonValue = Annotated[JsonValue, _SkipJsonValueWalk()]

Review Comment:
   Indeed, upon further investigation, it seems that `WrapValidator` + 
`SerializeAsAny` can express the same approach using pydantic’s public 
annotations. A local test shows this works correctly, but I'll let CI have the 
final word.
   
   PR updated.



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