Skip to content

Commit

Permalink
Convert exclusiveMinimum/Maximum for openapi 3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
DjordyKoert committed Nov 23, 2023
1 parent 595d8b6 commit a122489
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Annotations/AbstractAnnotation.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,24 @@ public function jsonSerialize()
}
unset($data->nullable);
}

if (isset($data->minimum) && isset($data->exclusiveMinimum)) {
if (true === $data->exclusiveMinimum) {
$data->exclusiveMinimum = $data->minimum;
unset($data->minimum);
} elseif (false === $data->exclusiveMinimum) {
unset($data->exclusiveMinimum);
}
}

if (isset($data->maximum) && isset($data->exclusiveMaximum)) {
if (true === $data->exclusiveMaximum) {
$data->exclusiveMaximum = $data->maximum;
unset($data->maximum);
} elseif (false === $data->exclusiveMaximum) {
unset($data->exclusiveMaximum);
}
}
}

return $data;
Expand Down

0 comments on commit a122489

Please sign in to comment.