swagger-api / swagger-parser

Swagger Spec to Java POJOs
http://swagger.io
Apache License 2.0
774 stars 526 forks source link

3.1.0 spec processing const with boolean/integer value stored as string rather than boolean/Boolean/integer/Integer #1966

Closed spacether closed 7 months ago

spacether commented 11 months ago

3.1.0 spec processing const with boolean value stored as string rather than boolean/Boolean

When parsing this spec:

# OAS document that uses 3.1 features:
# 'null' type
# type array
openapi: 3.1.0
info:
  version: 1.0.0
  title: Example
  license:
    name: MIT
    identifier: MIT
servers:
  - url: http://api.example.xyz/v1
paths:
  /somePath:
    get:
      operationId: getSomePath
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema: {}
components:
  schemas:
    BooleanConstTrue:
      type: boolean
      const: true
    IntegerConstOne:
      type: integer
      const: 1

the value of the component BooleanConstTrue._const is the String "true" when it should be boolean true or Boolean.TRUE the value f the component IntegerConstOne._const is the String "1" when it should be the integer 1 Const values should be the same types as enums with the same value.

This bug blocks downstream users from implementing/using the const keyword data

Can this be fixed? Thanks!