Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withItems isn't accurately described in swagger.json #2790

Closed
3 of 4 tasks
crenshaw-dev opened this issue Apr 22, 2020 · 2 comments
Closed
3 of 4 tasks

withItems isn't accurately described in swagger.json #2790

crenshaw-dev opened this issue Apr 22, 2020 · 2 comments
Assignees
Labels

Comments

@crenshaw-dev
Copy link
Member

crenshaw-dev commented Apr 22, 2020

Checklist:

  • I've included the version.
  • I've included reproduction steps.
  • I've included the workflow YAML.
  • I've included the logs.

What happened:

swagger.json didn't match API output for spec.templates[0].dag.tasks[1].withItems. The swagger spec describes withItems as an array of Item, but instead the array items can be numbers, booleans, strings, arbitrary objects, or arrays of these same types (except the nested arrays may contain any values, including nulls, if I'm reading the code correctly).

Aside: Downstream, this causes issues for at least the Java client. I've written an issue for argo-client-gen. Unfortunately, I don't think fixing swagger.json will fix the client (at least not if the fix relies on Swagger's oneOf feature, which I think it probably will).

How to reproduce it (as minimally and precisely as possible):

argo submit https://raw.githubusercontent.com/argoproj/argo/master/examples/loops-dag.yaml -n argo

Then hit /api/v1/workflows/argo on your Argo server.

Search for "withItems", and you'll find that the array contains strings.

Anything else we need to know?:

Item has a custom marshaller/unmarshaller, which is why swagger.json doesn't match the API output.

Item, when expressed as an array, may contain elements of type ItemValue. That type also has a custom marshaller/unmarshaller, so it should probably be modified in swagger.json as well.

I think withItems should be overridden in _primary.swagger.json to use Swagger's oneOf to express the possible types. One of the oneOf types would probably be "array of ItemValues", so ItemValue should probably also be overridden. I suspect Item will simply be orphaned.

If the argo-client-gen solution involves simply overriding withItem's type in the openapi-generator arguments, the type info should probably be in a synthetic, named type rather than directly in the withItem block.

Environment:

  • Argo version:
$ argo version
argo: v2.8.0-rc1+4a73f45.dirty
  BuildDate: 2020-04-21T05:30:01Z
  GitCommit: 4a73f45c38a07e9e517c39ed5611d386bcf518bd
  GitTreeState: dirty
  GitTag: v2.8.0-rc1
  GoVersion: go1.13.4
  Compiler: gc
  Platform: linux/amd64
  • Kubernetes version :
$ kubectl version -o yaml
clientVersion:
  buildDate: "2019-12-11T12:47:40Z"
  compiler: gc
  gitCommit: 224be7bdce5a9dd0c2fd0d46b83865648e2fe0ba
  gitTreeState: clean
  gitVersion: v1.16.4
  goVersion: go1.12.12
  major: "1"
  minor: "16"
  platform: linux/amd64
serverVersion:
  buildDate: "2020-01-27T18:09:26Z"
  compiler: gc
  gitCommit: cdab19b09a84389ffbf57bebd33871c60b1d6b28
  gitTreeState: clean
  gitVersion: v1.17.2+k3s1
  goVersion: go1.13.6
  major: "1"
  minor: "17"
  platform: linux/amd64

Message from the maintainers:

If you are impacted by this bug please add a 👍 reaction to this issue! We often sort issues this way to know what to prioritize.

@stale
Copy link

stale bot commented Jul 1, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Jul 1, 2020
@alexec alexec self-assigned this Jul 1, 2020
@stale stale bot removed the wontfix label Jul 1, 2020
@alexec
Copy link
Contributor

alexec commented Jul 5, 2020

Recently we changed the swagger. Item is arbitrary JSON, and swagger should reflect that.

@alexec alexec closed this as completed Jul 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants