swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

3.1.0 parsing of document with max/minContains removes constraint if value is a float

Open spacether opened this issue 2 years ago • 0 comments

3.1.0 parsing of document with max/minContains removes constraint if value is a float swagger-parser version: 2.1.1

For spec:

openapi: 3.1.0
servers:
- url: https://someserver.com/v1
info:
  title: openapi 3.1.0 sample spec
  version: 0.0.1
  description: sample spec for testing openapi functionality, built from json schema
    tests for draft2020-12
tags: []
paths: {}
components:
  schemas:
    MaxcontainsWithContainsValueWithADecimal:
      $schema: https://json-schema.org/draft/2020-12/schema
      contains:
        const: 1
      maxContains: 1.0
    MincontainsWithContainsValueWithADecimal:
      $schema: https://json-schema.org/draft/2020-12/schema
      contains:
        const: 1
      minContains: 1.0

The parsed schema for MaxcontainsWithContainsValueWithADecimal has the value for maxContains set to null when it should be the value 1.0, a json number. This prevents downstream users from being able to implement maxContains correctly.

spacether avatar Sep 23 '23 19:09 spacether