Skip to content

[#173200347] fix integer inclusive maximum #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
10.14.1
2 changes: 1 addition & 1 deletion src/__tests__/__snapshots__/gen-api-models.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ import { WithinRangeInteger } from \\"italia-ts-commons/lib/numbers\\";
import * as t from \\"io-ts\\";

export type WithinRangeIntegerTest = t.TypeOf<typeof WithinRangeIntegerTest>;
export const WithinRangeIntegerTest = WithinRangeInteger(0, 10);
export const WithinRangeIntegerTest = WithinRangeInteger(0, 11);
"
`;

Expand Down
2 changes: 1 addition & 1 deletion templates/macros.njk
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
{% macro defineInteger(definitionName, definition, inline = false) -%}
{% if definition.minimum != undefined and definition.maximum != undefined %}
{{- 'import { WithinRangeInteger } from "italia-ts-commons/lib/numbers";' | addImport -}}
{% set typedef %}WithinRangeInteger({{ definition.minimum }}, {{ definition.maximum }}){% endset %}
{% set typedef %}WithinRangeInteger({{ definition.minimum }}, {{ definition.maximum + 1 }}){% endset %}
{% elif definition.minimum == "0" %}
{{- 'import { NonNegativeInteger } from "italia-ts-commons/lib/numbers";' | addImport -}}
{% set typedef %}NonNegativeInteger{% endset %}
Expand Down