Skip to content

Commit 46f039b

Browse files
committed
add test for optional pointer field.
1 parent 72c1c0d commit 46f039b

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pkg/generators/openapi_test.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,6 +1635,8 @@ type Blah struct {
16351635
// Value is the value.
16361636
Value EnumType
16371637
NoCommentEnum EnumType
1638+
// +optional
1639+
OptionalEnum *EnumType
16381640
}`)
16391641
if callErr != nil {
16401642
t.Fatal(callErr)
@@ -1666,6 +1668,13 @@ Type: []string{"string"},
16661668
Format: "",
16671669
Enum: []interface{}{"a", "b"}},
16681670
},
1671+
"OptionalEnum": {
1672+
SchemaProps: spec.SchemaProps{`+"\n"+
1673+
"Description: \"Possible enum values:\\n - `\\\"a\\\"` is a.\\n - `\\\"b\\\"` is b.\","+`
1674+
Type: []string{"string"},
1675+
Format: "",
1676+
Enum: []interface{}{"a", "b"}},
1677+
},
16691678
},
16701679
Required: []string{"Value","NoCommentEnum"},
16711680
},

0 commit comments

Comments
 (0)