aoelvp94 commented on code in PR #77249:
URL: https://github.com/apache/airflow/pull/77249#discussion_r4659830962


##########
java-sdk/sdk/src/main/kotlin/org/apache/airflow/sdk/execution/JsonValue.kt:
##########
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.airflow.sdk.execution
+
+/**
+ * Checks that [value] can be stored as an XCom or task-state value, and 
returns
+ * it unchanged so later encoding matches the previous Jackson behaviour.
+ *
+ * [Frame] encodes a request by converting the message object to a map with
+ * Jackson. A Scala collection, `Option` or case class (none of which are
+ * `java.util.Map` / `java.util.Collection`) was stored as that object's bean
+ * properties, or as `{}` when it had none, and the task succeeded. This
+ * inspects the original value first, and rejects those Scala types and any
+ * other object Jackson would encode as `{}`. Java types that already encoded
+ * usefully (POJOs and Kotlin data classes with properties, records, enums,
+ * `java.time`, `Date`, `Optional`, and so on) still pass through.
+ *
+ * Nested values in a `Map`, `Collection` or array are checked the same way.
+ */
+internal fun jsonValue(value: Any?): Any? {
+  rejectUnsupportedXComValue(value)
+  return value
+}

Review Comment:
   The validator is gone. Its replacement, `Frame.encodeUserValue`, does 
convert: it turns the value into the JSON-shaped data that goes on the wire, so 
returning the result fits the name this time.



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