From f4216e61243de21c3b936e5838902ab1a1c4b16e Mon Sep 17 00:00:00 2001 From: Jochen Schalanda Date: Sat, 25 Feb 2023 23:33:43 +0100 Subject: [PATCH] Detect changed numeric ranges https://swagger.io/docs/specification/data-models/data-types/#range Fixes #458 --- .../core/compare/OperationDiff.java | 4 +- .../core/compare/ParametersDiff.java | 24 +-- .../openapidiff/core/compare/PathDiff.java | 14 +- .../schemadiffresult/SchemaDiffResult.java | 13 +- .../openapidiff/core/model/ChangedSchema.java | 11 ++ .../openapidiff/core/model/DiffContext.java | 8 +- .../model/schema/ChangedNumericRange.java | 165 ++++++++++++++++++ .../openapidiff/core/ParameterDiffTest.java | 82 ++++++++- .../resources/issue-458-integer-limits_1.yaml | 34 ++++ .../issue-458-integer-limits_10.yaml | 33 ++++ .../issue-458-integer-limits_11.yaml | 34 ++++ .../issue-458-integer-limits_12.yaml | 34 ++++ .../issue-458-integer-limits_13.yaml | 34 ++++ .../issue-458-integer-limits_14.yaml | 33 ++++ .../issue-458-integer-limits_15.yaml | 33 ++++ .../resources/issue-458-integer-limits_2.yaml | 34 ++++ .../resources/issue-458-integer-limits_3.yaml | 34 ++++ .../resources/issue-458-integer-limits_4.yaml | 34 ++++ .../resources/issue-458-integer-limits_5.yaml | 34 ++++ .../resources/issue-458-integer-limits_6.yaml | 34 ++++ .../resources/issue-458-integer-limits_7.yaml | 34 ++++ .../resources/issue-458-integer-limits_8.yaml | 34 ++++ .../resources/issue-458-integer-limits_9.yaml | 33 ++++ 23 files changed, 803 insertions(+), 24 deletions(-) create mode 100644 core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedNumericRange.java create mode 100644 core/src/test/resources/issue-458-integer-limits_1.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_10.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_11.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_12.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_13.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_14.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_15.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_2.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_3.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_4.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_5.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_6.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_7.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_8.yaml create mode 100644 core/src/test/resources/issue-458-integer-limits_9.yaml diff --git a/core/src/main/java/org/openapitools/openapidiff/core/compare/OperationDiff.java b/core/src/main/java/org/openapitools/openapidiff/core/compare/OperationDiff.java index e226043f3..8d960ba31 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/compare/OperationDiff.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/compare/OperationDiff.java @@ -73,7 +73,9 @@ public DeferredChanged diff( } ParametersDiffResult parametersDiffResult = - openApiDiff.getParametersDiff().diff(oldOperation.getParameters(), newOperation.getParameters(), context); + openApiDiff + .getParametersDiff() + .diff(oldOperation.getParameters(), newOperation.getParameters(), context); builder .with(parametersDiffResult.deferredChanged) .ifPresent( diff --git a/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java b/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java index c6bf420e8..d01a555b9 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/compare/ParametersDiff.java @@ -20,7 +20,8 @@ class ParametersDiffResult { protected DeferredChanged deferredChanged; protected boolean sameOperationsDiffSchema; - public ParametersDiffResult(DeferredChanged deferredChanged, boolean sameOperationsDiffSchema) { + public ParametersDiffResult( + DeferredChanged deferredChanged, boolean sameOperationsDiffSchema) { this.deferredChanged = deferredChanged; this.sameOperationsDiffSchema = sameOperationsDiffSchema; } @@ -57,7 +58,8 @@ public static boolean same(Parameter left, Parameter right) { && Objects.equals(left.getIn(), right.getIn()); } - public ParametersDiffResult diff(List left, List right, DiffContext context) { + public ParametersDiffResult diff( + List left, List right, DiffContext context) { DeferredBuilder builder = new DeferredBuilder<>(); ChangedParameters changedParameters = new ChangedParameters(left, right != null ? new ArrayList<>(right) : null, context); @@ -80,9 +82,8 @@ public ParametersDiffResult diff(List left, List right, Di } changedParameters.getIncreased().addAll(right); return new ParametersDiffResult( - builder.buildIsChanged(changedParameters), - pathUnchangedParametersChanged(changedParameters, context) - ); + builder.buildIsChanged(changedParameters), + pathUnchangedParametersChanged(changedParameters, context)); } public boolean pathUnchangedParametersChanged( @@ -93,7 +94,8 @@ public boolean pathUnchangedParametersChanged( return false; // Go through each missing Parameter and compare it to newly added Parameters for (Parameter parameter : changedParameters.getMissing()) { - // Speedy Check. Use the map already created in changedParameters to check if missing param is linked to newParam + // Speedy Check. Use the map already created in changedParameters to check if missing param is + // linked to newParam String newParameterName = context.getParameters().get(parameter.getName()); if (newParameterName.isEmpty()) return false; @@ -107,7 +109,8 @@ public boolean pathUnchangedParametersChanged( Parameter newParameterRealized = newParameter.get(); newParameterRealized.setName(parameter.getName()); // Make names similar boolean samePathDifferentParameter = !newParameterRealized.equals(parameter); - newParameterRealized.setName(newParameterName); // Important:: MUST Reset the name as this is not a copy + newParameterRealized.setName( + newParameterName); // Important:: MUST Reset the name as this is not a copy return samePathDifferentParameter; } return false; @@ -119,10 +122,11 @@ public boolean pathUnchanged(ChangedParameters changedParameters, DiffContext co String newUrl = context.getRightUrl(); ArrayList oldUrlPathParams = matchedItems(oldUrl, REGEX_PATH); ArrayList newUrlPathParams = matchedItems(newUrl, REGEX_PATH); - // Path Param count doesn't match or param-less path doesn't match or param is changed --> It's a new endpoint + // Path Param count doesn't match or param-less path doesn't match or param is changed --> It's + // a new endpoint return oldUrlPathParams.size() == newUrlPathParams.size() - && changedParameters.getChanged().isEmpty() - && oldUrl.replaceAll(REGEX_PATH, "").equals(newUrl.replaceAll(REGEX_PATH, "")); + && changedParameters.getChanged().isEmpty() + && oldUrl.replaceAll(REGEX_PATH, "").equals(newUrl.replaceAll(REGEX_PATH, "")); } public ArrayList matchedItems(String string, String regex) { diff --git a/core/src/main/java/org/openapitools/openapidiff/core/compare/PathDiff.java b/core/src/main/java/org/openapitools/openapidiff/core/compare/PathDiff.java index 7d8e8baa8..f695ef083 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/compare/PathDiff.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/compare/PathDiff.java @@ -36,13 +36,13 @@ public DeferredChanged diff(PathItem left, PathItem right, DiffCont .with( openApiDiff .getOperationDiff() - .diff(oldOperation, newOperation, - context.copyWithMethod(method).copyWithLeftRightUrls( - context.getLeftUrl(), - context.getRightUrl() - ) - ) - ).ifPresent(changedPath.getChanged()::add); + .diff( + oldOperation, + newOperation, + context + .copyWithMethod(method) + .copyWithLeftRightUrls(context.getLeftUrl(), context.getRightUrl()))) + .ifPresent(changedPath.getChanged()::add); } builder .with( diff --git a/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java b/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java index 540188ecb..6886f8c54 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/compare/schemadiffresult/SchemaDiffResult.java @@ -59,7 +59,18 @@ public , X> DeferredChanged diff( .setChangeFormat(!Objects.equals(left.getFormat(), right.getFormat())) .setReadOnly(new ChangedReadOnly(left.getReadOnly(), right.getReadOnly(), context)) .setWriteOnly(new ChangedWriteOnly(left.getWriteOnly(), right.getWriteOnly(), context)) - .setMaxLength(new ChangedMaxLength(left.getMaxLength(), right.getMaxLength(), context)); + .setMaxLength(new ChangedMaxLength(left.getMaxLength(), right.getMaxLength(), context)) + .setNumericRange( + new ChangedNumericRange( + left.getMinimum(), + right.getMinimum(), + left.getMaximum(), + right.getMaximum(), + left.getExclusiveMinimum(), + right.getExclusiveMinimum(), + left.getExclusiveMaximum(), + right.getExclusiveMaximum(), + context)); builder .with( openApiDiff diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java index 22e5a8f08..80d980079 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/ChangedSchema.java @@ -7,6 +7,7 @@ import java.util.stream.Stream; import org.openapitools.openapidiff.core.model.schema.ChangedEnum; import org.openapitools.openapidiff.core.model.schema.ChangedMaxLength; +import org.openapitools.openapidiff.core.model.schema.ChangedNumericRange; import org.openapitools.openapidiff.core.model.schema.ChangedReadOnly; import org.openapitools.openapidiff.core.model.schema.ChangedRequired; import org.openapitools.openapidiff.core.model.schema.ChangedWriteOnly; @@ -30,6 +31,7 @@ public class ChangedSchema implements ComposedChanged { protected ChangedWriteOnly writeOnly; protected boolean changedType; protected ChangedMaxLength maxLength; + protected ChangedNumericRange numericRange; protected boolean discriminatorPropertyChanged; protected ChangedSchema items; protected ChangedOneOfSchema oneOfSchema; @@ -109,6 +111,7 @@ public List getChangedElements() { enumeration, required, maxLength, + numericRange, extensions)) .collect(Collectors.toList()); } @@ -356,6 +359,12 @@ public ChangedSchema setMaxLength(final ChangedMaxLength maxLength) { return this; } + public ChangedSchema setNumericRange(final ChangedNumericRange numericRange) { + clearChangedCache(); + this.numericRange = numericRange; + return this; + } + public ChangedSchema setDiscriminatorPropertyChanged(final boolean discriminatorPropertyChanged) { clearChangedCache(); this.discriminatorPropertyChanged = discriminatorPropertyChanged; @@ -410,6 +419,7 @@ public boolean equals(Object o) { && Objects.equals(readOnly, that.readOnly) && Objects.equals(writeOnly, that.writeOnly) && Objects.equals(maxLength, that.maxLength) + && Objects.equals(numericRange, that.numericRange) && Objects.equals(items, that.items) && Objects.equals(oneOfSchema, that.oneOfSchema) && Objects.equals(addProp, that.addProp) @@ -437,6 +447,7 @@ public int hashCode() { writeOnly, changedType, maxLength, + numericRange, discriminatorPropertyChanged, items, oneOfSchema, diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/DiffContext.java b/core/src/main/java/org/openapitools/openapidiff/core/model/DiffContext.java index 718cb60f8..485c3518b 100644 --- a/core/src/main/java/org/openapitools/openapidiff/core/model/DiffContext.java +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/DiffContext.java @@ -116,9 +116,13 @@ public DiffContext setLeftAndRightUrls(String leftUrl, String rightUrl) { return this; } - public String getLeftUrl() { return this.leftUrl; } + public String getLeftUrl() { + return this.leftUrl; + } - public String getRightUrl() { return this.rightUrl; } + public String getRightUrl() { + return this.rightUrl; + } @Override public boolean equals(Object o) { diff --git a/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedNumericRange.java b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedNumericRange.java new file mode 100644 index 000000000..537496cd9 --- /dev/null +++ b/core/src/main/java/org/openapitools/openapidiff/core/model/schema/ChangedNumericRange.java @@ -0,0 +1,165 @@ +package org.openapitools.openapidiff.core.model.schema; + +import java.math.BigDecimal; +import java.util.Objects; +import org.openapitools.openapidiff.core.model.Changed; +import org.openapitools.openapidiff.core.model.DiffContext; +import org.openapitools.openapidiff.core.model.DiffResult; + +public final class ChangedNumericRange implements Changed { + private final BigDecimal oldMinimumValue; + private final BigDecimal newMinimumValue; + private final BigDecimal oldMaximumValue; + private final BigDecimal newMaximumValue; + private final Boolean oldMinimumExclusiveValue; + private final Boolean newMinimumExclusiveValue; + private final Boolean oldMaximumExclusiveValue; + private final Boolean newMaximumExclusiveValue; + private final DiffContext context; + + @Override + public DiffResult isChanged() { + if (Objects.equals(oldMinimumValue, newMinimumValue) + && Objects.equals(oldMaximumValue, newMaximumValue) + && Objects.equals(oldMinimumExclusiveValue, newMinimumExclusiveValue) + && Objects.equals(oldMaximumExclusiveValue, newMaximumExclusiveValue)) { + return DiffResult.NO_CHANGES; + } + if (context.isRequest() + && (newMinimumValue == null + || oldMinimumValue != null + && oldMinimumValue.unscaledValue().compareTo(newMinimumValue.unscaledValue()) + >= 0) + && (newMaximumValue == null + || oldMaximumValue != null + && oldMaximumValue.unscaledValue().compareTo(newMaximumValue.unscaledValue()) + <= 0) + && (newMinimumExclusiveValue == null + || oldMinimumExclusiveValue != null && newMinimumExclusiveValue == true) + && (newMaximumExclusiveValue == null + || oldMaximumExclusiveValue != null && newMaximumExclusiveValue == true) + || context.isResponse() + && (newMinimumValue == null + || oldMinimumValue != null + && oldMinimumValue.unscaledValue().compareTo(newMinimumValue.unscaledValue()) + >= 0) + && (newMaximumValue == null + || oldMaximumValue != null + && oldMaximumValue.unscaledValue().compareTo(newMaximumValue.unscaledValue()) + <= 0) + && (newMinimumExclusiveValue == null + || oldMinimumExclusiveValue != null && newMinimumExclusiveValue == true) + && (newMaximumExclusiveValue == null + || oldMaximumExclusiveValue != null && newMaximumExclusiveValue == true)) { + return DiffResult.COMPATIBLE; + } + return DiffResult.INCOMPATIBLE; + } + + public ChangedNumericRange( + final BigDecimal oldMinimumValue, + final BigDecimal newMinimumValue, + final BigDecimal oldMaximumValue, + final BigDecimal newMaximumValue, + final Boolean oldMinimumExclusiveValue, + final Boolean newMinimumExclusiveValue, + final Boolean oldMaximumExclusiveValue, + final Boolean newMaximumExclusiveValue, + final DiffContext context) { + this.oldMinimumValue = oldMinimumValue; + this.newMinimumValue = newMinimumValue; + this.oldMaximumValue = oldMaximumValue; + this.newMaximumValue = newMaximumValue; + this.oldMinimumExclusiveValue = oldMinimumExclusiveValue; + this.newMinimumExclusiveValue = newMinimumExclusiveValue; + this.oldMaximumExclusiveValue = oldMaximumExclusiveValue; + this.newMaximumExclusiveValue = newMaximumExclusiveValue; + this.context = context; + } + + public BigDecimal getOldMinimumValue() { + return oldMinimumValue; + } + + public BigDecimal getNewMinimumValue() { + return newMinimumValue; + } + + public BigDecimal getOldMaximumValue() { + return oldMaximumValue; + } + + public BigDecimal getNewMaximumValue() { + return newMaximumValue; + } + + public Boolean getOldMinimumExclusiveValue() { + return oldMinimumExclusiveValue; + } + + public Boolean getNewMinimumExclusiveValue() { + return newMinimumExclusiveValue; + } + + public Boolean getOldMaximumExclusiveValue() { + return oldMaximumExclusiveValue; + } + + public Boolean getNewMaximumExclusiveValue() { + return newMaximumExclusiveValue; + } + + public DiffContext getContext() { + return this.context; + } + + @Override + public boolean equals(Object o) { + if (this == o) return true; + if (o == null || getClass() != o.getClass()) return false; + ChangedNumericRange that = (ChangedNumericRange) o; + return Objects.equals(oldMinimumValue, newMinimumValue) + && Objects.equals(oldMaximumValue, newMaximumValue) + && Objects.equals(oldMinimumExclusiveValue, newMinimumExclusiveValue) + && Objects.equals(oldMaximumExclusiveValue, newMaximumExclusiveValue) + && Objects.equals(context, that.context); + } + + @Override + public int hashCode() { + return Objects.hash( + oldMinimumValue, + newMinimumValue, + oldMaximumValue, + newMaximumValue, + oldMinimumExclusiveValue, + newMinimumExclusiveValue, + oldMaximumExclusiveValue, + newMaximumExclusiveValue, + context); + } + + @Override + public String toString() { + return "ChangedNumericRange(" + + "oldMinimumValue=" + + oldMinimumValue + + ", newMinimumValue=" + + newMinimumValue + + ", oldMaximumValue=" + + oldMaximumValue + + ", newMaximumValue=" + + newMaximumValue + + ", oldMinimumExclusiveValue=" + + oldMinimumExclusiveValue + + ", newMinimumExclusiveValue=" + + newMinimumExclusiveValue + + ", oldMaximumExclusiveValue=" + + oldMaximumExclusiveValue + + ", newMaximumExclusiveValue=" + + newMaximumExclusiveValue + + ", context=" + + context + + ')'; + } +} diff --git a/core/src/test/java/org/openapitools/openapidiff/core/ParameterDiffTest.java b/core/src/test/java/org/openapitools/openapidiff/core/ParameterDiffTest.java index ce233ed8b..6e4cd9303 100644 --- a/core/src/test/java/org/openapitools/openapidiff/core/ParameterDiffTest.java +++ b/core/src/test/java/org/openapitools/openapidiff/core/ParameterDiffTest.java @@ -5,11 +5,87 @@ import org.junit.jupiter.api.Test; public class ParameterDiffTest { - private final String OPENAPI_DOC1 = "parameters_diff_1.yaml"; - private final String OPENAPI_DOC2 = "parameters_diff_2.yaml"; @Test public void testDiffDifferent() { - assertOpenApiChangedEndpoints(OPENAPI_DOC1, OPENAPI_DOC2); + assertOpenApiChangedEndpoints("parameters_diff_1.yaml", "parameters_diff_2.yaml"); + } + + @Test + public void issue458MaximumDecreased() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_2.yaml"); + } + + @Test + public void issue458MaximumIncreased() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_3.yaml"); + } + + @Test + public void issue458MinimumDecreased() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_4.yaml"); + } + + @Test + public void issue458MinimumIncreased() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_5.yaml"); + } + + @Test + public void issue458IntegerFormatChanged() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_6.yaml"); + } + + @Test + public void issue458ExclusiveMinimumChanged() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_7.yaml"); + } + + @Test + public void issue458ExclusiveMaximumChanged() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_8.yaml"); + } + + @Test + public void issue458ExclusiveMinimumRemoved() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_9.yaml"); + } + + @Test + public void issue458ExclusiveMaximumRemoved() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_1.yaml", "issue-458-integer-limits_10.yaml"); + } + + @Test + public void issue458ExclusiveMaximumTrueToFalse() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_11.yaml", "issue-458-integer-limits_12.yaml"); + } + + @Test + public void issue458ExclusiveMinimumTrueToFalse() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_11.yaml", "issue-458-integer-limits_13.yaml"); + } + + @Test + public void issue458ExclusiveMaximumTrueRemoved() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_11.yaml", "issue-458-integer-limits_12.yaml"); + } + + @Test + public void issue458ExclusiveMinimumTrueRemoved() { + assertOpenApiChangedEndpoints( + "issue-458-integer-limits_11.yaml", "issue-458-integer-limits_13.yaml"); } } diff --git a/core/src/test/resources/issue-458-integer-limits_1.yaml b/core/src/test/resources/issue-458-integer-limits_1.yaml new file mode 100644 index 000000000..16b769d5b --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_1.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: false + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_10.yaml b/core/src/test/resources/issue-458-integer-limits_10.yaml new file mode 100644 index 000000000..e704c4f9c --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_10.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_11.yaml b/core/src/test/resources/issue-458-integer-limits_11.yaml new file mode 100644 index 000000000..ea16b71a9 --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_11.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: true + exclusiveMaximum: true + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_12.yaml b/core/src/test/resources/issue-458-integer-limits_12.yaml new file mode 100644 index 000000000..1c410a34d --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_12.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: true + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_13.yaml b/core/src/test/resources/issue-458-integer-limits_13.yaml new file mode 100644 index 000000000..896a9c32e --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_13.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: false + exclusiveMaximum: true + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_14.yaml b/core/src/test/resources/issue-458-integer-limits_14.yaml new file mode 100644 index 000000000..7fa4e1f50 --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_14.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: true + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_15.yaml b/core/src/test/resources/issue-458-integer-limits_15.yaml new file mode 100644 index 000000000..9bd90be6f --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_15.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMaximum: true + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_2.yaml b/core/src/test/resources/issue-458-integer-limits_2.yaml new file mode 100644 index 000000000..55c1c1983 --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_2.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 99 + exclusiveMinimum: false + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_3.yaml b/core/src/test/resources/issue-458-integer-limits_3.yaml new file mode 100644 index 000000000..f30ef6501 --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_3.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 101 + exclusiveMinimum: false + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_4.yaml b/core/src/test/resources/issue-458-integer-limits_4.yaml new file mode 100644 index 000000000..91cc048c2 --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_4.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 9 + maximum: 100 + exclusiveMinimum: false + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_5.yaml b/core/src/test/resources/issue-458-integer-limits_5.yaml new file mode 100644 index 000000000..4881d7fd9 --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_5.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 11 + maximum: 100 + exclusiveMinimum: false + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_6.yaml b/core/src/test/resources/issue-458-integer-limits_6.yaml new file mode 100644 index 000000000..dbcaa9bed --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_6.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int64 + minimum: 10 + maximum: 100 + exclusiveMinimum: false + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_7.yaml b/core/src/test/resources/issue-458-integer-limits_7.yaml new file mode 100644 index 000000000..1c410a34d --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_7.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: true + exclusiveMaximum: false + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_8.yaml b/core/src/test/resources/issue-458-integer-limits_8.yaml new file mode 100644 index 000000000..896a9c32e --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_8.yaml @@ -0,0 +1,34 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: false + exclusiveMaximum: true + responses: + '200': + description: OK diff --git a/core/src/test/resources/issue-458-integer-limits_9.yaml b/core/src/test/resources/issue-458-integer-limits_9.yaml new file mode 100644 index 000000000..8dbf0cd3e --- /dev/null +++ b/core/src/test/resources/issue-458-integer-limits_9.yaml @@ -0,0 +1,33 @@ +openapi: 3.0.0 +servers: + - url: 'http://petstore.swagger.io/v2' +info: + description: >- + Description + version: 1.0.0 + title: Swagger Petstore + termsOfService: 'http://swagger.io/terms/' + contact: + email: apiteam@swagger.io + license: + name: Apache 2.0 + url: 'http://www.apache.org/licenses/LICENSE-2.0.html' +paths: + /int-limits: + get: + summary: get int + description: 'description' + operationId: getInt + parameters: + - name: int + in: query + required: true + schema: + type: integer + format: int32 + minimum: 10 + maximum: 100 + exclusiveMinimum: false + responses: + '200': + description: OK