If the only problem is with Java and not any other popular languages, I
would say we go for Option (2).

If not, supporting both is a good idea.

Regards,
Kaxil

On Fri, May 29, 2020 at 12:19 AM QP Hou <q...@scribd.com> wrote:

> While I understand the difficulty of dealing with nested json without
> predefined schemas, I feel like returning it as a string only delays
> the problem to a later stage since the user will still need to parse
> that string into a strongly typed data structure in order to read the
> values.
>
> I don't have much experience in Java so I can't really comment on
> that. But I can confirm that it's pretty straightforward to deal with
> this in C/C++, Rust and Go.
>
> On Thu, May 28, 2020 at 2:57 PM Ash Berlin-Taylor <a...@apache.org> wrote:
> >
> > Hi everyone,
> >
> > We're really close to getting the OpenAPI spec merged, just one last
> > question that's come up around how we should handle/represent
> > dagrun.conf to triggerDagRun.
> >
> > Which of the these two do people prefer?
> >
> >
> > POST /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}
> > Content-Type: application/json
> >
> > {
> >   "dag_run_id": "manual_2020-05-28T21:42:36Z",
> >   "execution_date": "2020-05-28T21:42:36Z",
> >   "conf": "{\"key\": \"value\" }"
> > }
> >
> > OR
> >
> >
> > POST /api/v1/dags/{dag_id}/dagRuns/{dag_run_id}
> > Content-Type: application/json
> >
> > {
> >   "dag_run_id": "manual_2020-05-28T21:42:36Z",
> >   "execution_date": "2020-05-28T21:42:36Z",
> >   "conf": {"key": "value"}
> > }
> >
> > i.e. should the schema/type of conf be a (JSON-encoded) string, or an
> object.
> >
> > I favour the later, Kamil the former. His point is that staticly typed
> > languages, and Java in particular, would be hard to represent this.
> > (Please correct me if I've over-simplified or misunderstood your
> > argument Kamil)
> >
> > Mine was that it's easy enough in Go, for example trigger(dagRunId str,
> > executionDate *time.Time, conf interface{})`, and double json encoding
> > is always messy/a pain to drive manually on cURL etc.
> >
> >
> > (Using dagRun.conf is quite rare right now, doubly so via the API, so I
> > don't think we have any precendent to follow.)
> >
> > Or does anyone feel strongly that we should support both, and have this
> > in the python side
> >
> >     if conf:
> >         if isinstance(conf, dict):
> >             run_conf = conf
> >         else:
> >             run_conf = json.loads(conf)
> >
> >
> > -ash
>

Reply via email to