Skip to content

Commit c4477a1

Browse files
authored
dhall-openapi: use Integer in IntOrString instead of Natural (#2137)
The Kubernetes OpenAPI definition describes this type as: > IntOrString is a type that can hold an int32 or a string. > When used in JSON or YAML marshalling and unmarshalling, it > produces or consumes the inner type. This allows you to have, > for example, a JSON field that can accept a name or number. Which implies it should be an Integer rather than a Natural. This should have been done as part of bb3c4c9, but I missed this case.
1 parent dc4a412 commit c4477a1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

dhall-openapi/src/Dhall/Kubernetes/Convert.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ toTypes' prefixMap typeSplitter definitions toMerge
186186
kvList = Dhall.App Dhall.List $ Dhall.Record $ Dhall.Map.fromList
187187
[ ("mapKey", Dhall.makeRecordField Dhall.Text), ("mapValue", Dhall.makeRecordField Dhall.Text) ]
188188
intOrStringType = Dhall.Union $ Dhall.Map.fromList $ fmap (second Just)
189-
[ ("Int", Dhall.Natural), ("String", Dhall.Text) ]
189+
[ ("Int", Dhall.Integer), ("String", Dhall.Text) ]
190190

191191
-- | Convert a single Definition to a Dhall Type, yielding any definitions to be split
192192
-- Note: model hierarchy contains the modelName of of the current definition as the last entry

0 commit comments

Comments
 (0)