We are just using Java here as a proxy for "all statically typed languages" -- hearing how this would work (or not!) in other languages is useful for the discussion, I think.
On May 29 2020, at 10:47 pm, QP Hou <q...@scribd.com> wrote: > On Fri, May 29, 2020 at 1:27 PM Kamil Breguła > <kamil.breg...@polidea.com> wrote: >> >> We move the problem to a place where we have enough data to handle it. >> The user has information about whether he can indicate a better type >> based on many parameters e.g. dag_id or execution_date. I imagine that >> the user may want to convert the conf to type field depending on >> dag_id and choose the solution that best suits his situation. >> >> https://pastebin.com/UpUKYEvg >> >> It is the user who specified the input data (e.g. in Web UI), so the >> user can best choose how to process this data. > > The example you pasted is what I would imagine how users will interact > with the API client as well. > > I would like to point out that in statically typed language, a string > containing serialized json is not that much different from a generic > typed object. For example, in go, you can convert an interface{} to > any specific struct type you want based on dag_id or execution_date as > well. The only difference would be calling json parse function to > parse a string into a specific struct or doing runtime type cast using > runtime reflection. With generic typed objects, the compiler can at > least make sure a json serializable object is being passed to the > client. With string, it could be anything including invalid JOSN. This > also applies to other static typed languages I am familiar with like > C/C++ and Rust. Again, not a Java expert, so I can't comment on Java > side of things. >