Skip to content

Commit

Permalink
[VAULT-5887] TypeInt64 support added to OpenApi Spec generation (#15104)
Browse files Browse the repository at this point in the history
Adding handling for TypeInt64 to OAS types
  • Loading branch information
AnPucel committed Apr 22, 2022
1 parent ca9f175 commit d569b23
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
3 changes: 3 additions & 0 deletions changelog/15104.txt
@@ -0,0 +1,3 @@
```release-note:bug
sdk: Fix OpenApi spec generator to properly convert TypeInt64 to OAS supported int64
```
3 changes: 3 additions & 0 deletions sdk/framework/openapi.go
Expand Up @@ -613,6 +613,9 @@ func convertType(t FieldType) schemaType {
ret.format = "lowercase"
case TypeInt:
ret.baseType = "integer"
case TypeInt64:
ret.baseType = "integer"
ret.format = "int64"
case TypeDurationSecond, TypeSignedDurationSecond:
ret.baseType = "integer"
ret.format = "seconds"
Expand Down
4 changes: 4 additions & 0 deletions sdk/framework/openapi_test.go
Expand Up @@ -356,6 +356,10 @@ func TestOpenAPI_Paths(t *testing.T) {
Description: "a header value",
AllowedValues: []interface{}{"a", "b", "c"},
},
"maximum": {
Type: TypeInt64,
Description: "a maximum value",
},
"format": {
Type: TypeString,
Description: "a query param",
Expand Down
5 changes: 5 additions & 0 deletions sdk/framework/testdata/operations.json
Expand Up @@ -113,6 +113,11 @@
"type": "string",
"description": "a header value",
"enum": ["a", "b", "c"]
},
"maximum" : {
"type": "integer",
"description": "a maximum value",
"format": "int64"
}
}
}
Expand Down

0 comments on commit d569b23

Please sign in to comment.