Skip to content

Commit

Permalink
Resolving "format" bug for parameters (#44)
Browse files Browse the repository at this point in the history
* Update csdl2openapi.js

* Update csdl-16.1.openapi3.json

* Update CHANGELOG.md

---------

Co-authored-by: Ram Prasad GS <[email protected]>
  • Loading branch information
RoshniNaveenaS and RamIndia authored Oct 8, 2024
1 parent 83dbcb6 commit 32f1cc7
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 0 additions & 3 deletions lib/compile/csdl2openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -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|");
Expand Down
4 changes: 2 additions & 2 deletions test/lib/compile/data/csdl-16.1.openapi3.json
Original file line number Diff line number Diff line change
Expand Up @@ -1430,8 +1430,8 @@
"in": "query",
"name": "Rating",
"schema": {
"type": "string",
"format": "int32,null",
"type": "integer",
"format": "int32",
"nullable": true,
"default": "null"
}
Expand Down

0 comments on commit 32f1cc7

Please sign in to comment.