Skip to content

[Bug]: Negative and Positive validation annotations does not utilze OAS 3.1 syntax #5170

@Mattias-Sehlstedt

Description

@Mattias-Sehlstedt

Description of the problem/issue

PR #5162 introduced support for @Positive and @Negative validation annotations.

Currently these are both resolved into the same

"schema": {
  "type": "integer",
  "format": "int32",
  "exclusiveMinimum": true,
  "minimum": 0
}

for both OAS 3.0 and OAS 3.1.

I would expect the OAS 3.1 version to be

"schema": {
  "type": "integer",
  "format": "int32",
  "exclusiveMinimum": 0
}

since the json-schema that was introduced with 3.1 supports a numeric representation of exclusiveMinimum/exclusiveMaximum. For example see https://learn.openapis.org/upgrading/v3.0-to-v3.1.html#update-exclusiveminimum-and-exclusivemaximum.

Affected Version

2.2.49

Earliest version the bug appears in (if known):
2.2.49

Steps to Reproduce

Use @Positive or @Negative in an OAS 3.1 context.

Expected Behavior

The schema should be

"schema": {
  "type": "integer",
  "format": "int32",
  "exclusiveMinimum": 0
}

Actual Behavior

The schema is

"schema": {
  "type": "integer",
  "format": "int32",
  "exclusiveMinimum": true,
  "minimum": 0
}

Logs / Stack Traces

Additional Context

Checklist

  • I have searched the existing issues and this is not a duplicate.
  • I have provided sufficient information for maintainers to reproduce the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions