swagger-parser
swagger-parser copied to clipboard
3.1.0 spec procesing, nonexistant types added
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:
ArrayContainsValue:
type: array
contains:
enum:
- 1
AnyTypeContainsValue:
contains:
enum:
- 1
AdditionalpropertiesBeingFalseDoesNotAllowOtherProperties:
$schema: https://json-schema.org/draft/2020-12/schema
properties:
foo: {}
bar: {}
patternProperties:
^v: {}
additionalProperties: false
- The schema in ArrayContainsValue.contains is given the property types = LinkedHashSet("number") This is incorrect because we see from the schema above that the schema there only defines an enum value and that anytype (type unset/null) is the correct definition.
- Type object is incorrectly set for AdditionalpropertiesBeingFalseDoesNotAllowOtherProperties
Can the parser be updated to show that the type for this use case is null?
This bug was hit on the additionalProperties test case AdditionalpropertiesBeingFalseDoesNotAllowOtherProperties when working on https://github.com/openapi-json-schema-tools/openapi-json-schema-generator/pull/241