Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING when using non-object withItems #7

Closed
crenshaw-dev opened this issue Apr 22, 2020 · 0 comments

Comments

@crenshaw-dev
Copy link
Contributor

To reproduce:

# Submit a workflow where withItems is an array of strings.
argo submit https://raw.githubusercontent.com/argoproj/argo/master/examples/loops-dag.yaml

# Grab my branch with the test modified to just list workflows.
git clone https://github.com/mac9416/argo-client-gen
cd argo-client-gen
git checkout withitems-bug

# Build and test.
make java
make test-java

You should receive the following error:

com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Expected BEGIN_OBJECT but was STRING at line 1 column 758 path $.items[0].spec.templates[0].dag.tasks[1].withItems[0]
        at io.argoproj.workflow.SmokeIT.testArgoServerAPI(SmokeIT.java:39)

Ideally fixing argoproj/argo-workflows#2790 would fix this. But I suspect that bug will require using Swagger's oneOf feature, which it looks like openapi-generator does not yet support.

Assuming we can't find a swagger spec that satisfies openapi-generator, maybe the next best solution is to override withItems to be simply a list of objects. That would allow proper posting of workflows. It may even permit proper retrieval, assuming the client can cast to a known type.

To go that route, we'd probably want to create a named, synthetic type in swagger.json to represent the type of withItems. That would allow easily overriding the type by name in openapi-generator. If the type info were embedded directly in the withItems block, I'm not sure it could be overridden so easily.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants