Skip to content

Commit

Permalink
fix(swagger): Correct item type. Fixes #3926 (#3932)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexec committed Sep 8, 2020
1 parent 1e46176 commit 354733e
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
8 changes: 1 addition & 7 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2740,13 +2740,7 @@
}
},
"io.argoproj.workflow.v1alpha1.Item": {
"description": "Item expands a single workflow step into multiple parallel steps The value of Item can be a map, string, bool, or number",
"type": [
"boolean",
"number",
"string",
"object"
]
"description": "Item expands a single workflow step into multiple parallel steps The value of Item can be a map, string, bool, or number"
},
"io.argoproj.workflow.v1alpha1.Link": {
"description": "A link to another app.",
Expand Down
2 changes: 1 addition & 1 deletion api/openapi-spec/swagger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func TestSwagger(t *testing.T) {
})
t.Run("io.argoproj.workflow.v1alpha1.Item", func(t *testing.T) {
definition := definitions["io.argoproj.workflow.v1alpha1.Item"].(obj)
assert.ElementsMatch(t, []string{"boolean", "number", "object", "string"}, definition["type"])
assert.Empty(t, definition["type"])
})
t.Run("io.argoproj.workflow.v1alpha1.ParallelSteps", func(t *testing.T) {
definition := definitions["io.argoproj.workflow.v1alpha1.ParallelSteps"].(obj)
Expand Down
2 changes: 1 addition & 1 deletion docs/swagger.md
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ Item expands a single workflow step into multiple parallel steps The value of It

| Name | Type | Description | Required |
| ---- | ---- | ----------- | -------- |
| io.argoproj.workflow.v1alpha1.Item | boolean,number,string,object | Item expands a single workflow step into multiple parallel steps The value of Item can be a map, string, bool, or number | |
| io.argoproj.workflow.v1alpha1.Item | | Item expands a single workflow step into multiple parallel steps The value of Item can be a map, string, bool, or number | |

#### io.argoproj.workflow.v1alpha1.Link

Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/workflow/v1alpha1/item.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ func (i *Item) DeepCopyInto(out *Item) {
}
}

// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
func (i Item) OpenAPISchemaType() []string {
// this list should also contain `array`, but that requires `items` and that did not appear to be easy
return []string{"boolean", "number", "string", "object"}
return nil
}

func (i Item) OpenAPISchemaFormat() string { return "" }
Expand Down
6 changes: 4 additions & 2 deletions test/e2e/argo_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -793,8 +793,10 @@ func (s *ArgoServerSuite) TestWorkflowService() {
Expect().
Status(200)

// sleep in a test is bad practice
time.Sleep(3 * time.Second)
s.Given().
WorkflowName(name).
When().
WaitForWorkflow()

s.e().GET("/api/v1/workflows/argo/" + name).
Expect().
Expand Down

0 comments on commit 354733e

Please sign in to comment.