diff --git a/CHANGELOG.md b/CHANGELOG.md index b616620..2126d09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ### Fixed - Multiple protocols for a service now renders multiple openapi documents. +- Format and type are now preserved for function parameters. ### Added diff --git a/lib/compile/csdl2openapi.js b/lib/compile/csdl2openapi.js index e1f7545..f1d7145 100644 --- a/lib/compile/csdl2openapi.js +++ b/lib/compile/csdl2openapi.js @@ -2273,9 +2273,6 @@ see [Expand](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-prot s.pattern = "^'([^']|'')*'$"; } if (element.$Nullable) { - if (!s.anyOf && !s.allOf) s.type = "string"; - if (s.format) s.format += ",null"; - if (s.anyOf && s.anyOf[0].format) s.anyOf[0].format += ",null"; s.default = "null"; if (s.pattern) { s.pattern = s.pattern.replace(/^\^/, "^(null|"); diff --git a/test/lib/compile/data/csdl-16.1.openapi3.json b/test/lib/compile/data/csdl-16.1.openapi3.json index d971421..f1733b5 100644 --- a/test/lib/compile/data/csdl-16.1.openapi3.json +++ b/test/lib/compile/data/csdl-16.1.openapi3.json @@ -1430,8 +1430,8 @@ "in": "query", "name": "Rating", "schema": { - "type": "string", - "format": "int32,null", + "type": "integer", + "format": "int32", "nullable": true, "default": "null" }