Skip to content

Commit ecfbd72

Browse files
wrogempvl
authored andcommitted
encoding/openapi: date-time & string format
There is no ```string``` format and the date-format in OpenAPI is ```date-time```. https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types Closes #426 cuelang/cue#426 GitOrigin-RevId: f8270d4c331537d23eb41a936d663dff84ad4d18 Change-Id: I5b09ace4d4ca9170df368710fea135da68f38b37 Reviewed-on: https://cue-review.googlesource.com/c/cue/+/6420 Reviewed-by: Marcel van Lohuizen <[email protected]>
1 parent 2a8b4ed commit ecfbd72

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

encoding/openapi/types.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,22 @@ import (
2727
"cuelang.org/go/cue/token"
2828
)
2929

30-
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#format
30+
// See https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types
3131
var cueToOpenAPI = map[string]string{
3232
"int32": "int32",
3333
"int64": "int64",
3434

3535
"float64": "double",
3636
"float32": "float",
3737

38-
"string": "string",
39-
"bytes": "binary",
38+
"bytes": "binary",
4039

41-
"time.Time": "dateTime",
40+
"time.Time": "date-time",
4241
`time.Format ("2006-01-02")`: "date",
4342

4443
// TODO: if a format is more strict (e.g. using zeros instead of nines
4544
// for fractional seconds), we could still use this as an approximation.
46-
`time.Format ("2006-01-02T15:04:05.999999999Z07:00")`: "dateTime",
45+
`time.Format ("2006-01-02T15:04:05.999999999Z07:00")`: "date-time",
4746

4847
// TODO: password.
4948
}

0 commit comments

Comments
 (0)