Skip to content

Commit

Permalink
Fix: term Validation.AllowedValues can be applied to all primitive ty…
Browse files Browse the repository at this point in the history
…pes (#315)

* AllowedValues on all types

* 0.28.2

* Update CHANGELOG.md

* Bump dependencies

* Bump indirect dependencies
  • Loading branch information
ralfhandl authored Oct 30, 2024
1 parent 81c4b01 commit 2dcaa9a
Show file tree
Hide file tree
Showing 5 changed files with 272 additions and 234 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.28.2 - 2024-10-30

### Fixed

- Term `Validation.AllowedValues` can be applied to all (primitive) types

## 0.28.1 - 2024-08-29

### Fixed
Expand Down
3 changes: 2 additions & 1 deletion lib/csdl2openapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -2649,7 +2649,6 @@ module.exports.csdl2openapi = function (
case undefined:
s.type = "string";
if (element.$MaxLength) s.maxLength = element.$MaxLength;
allowedValues(s, element);
pattern(s, element);
break;
case "Edm.Time":
Expand Down Expand Up @@ -2692,6 +2691,8 @@ module.exports.csdl2openapi = function (
}
}

allowedValues(s, element);

if (element.$Nullable) {
if (oas31) {
if (s.$ref) s = { anyOf: [s, { type: "null" }] };
Expand Down
Loading

0 comments on commit 2dcaa9a

Please sign in to comment.