APIDevTools / swagger-parser

Swagger 2.0 and OpenAPI 3.0 parser/validator
https://apitools.dev/swagger-parser
MIT License
1.08k stars 153 forks source link

Open API 3.1 - Additional properties not allowed: $id #215

Closed foulong closed 2 years ago

foulong commented 2 years ago

Hi,

with this sample of my api doc :

{
   "openapi": "3.1",

   "components": {
      "schemas": {
         "schema1": {
             "$id": "/schema1",
             "type": "object",
             "properties": {

             }
         }
      }
   }
}

obtained result : "Swagger schema validation failed. \n Data does not match any schemas from 'oneOf' at #/components/schemas/schema1\n Additional properties not allowed: $id at #/components/schemas/schema1\n"

expected result : "Swagger schema validation suceeded"

"$id" field is accepted in open API 3.1 (OpenAPI Specification v3.1.0) but not accepted in swagger (Supported JSON Schema Keywords)

Thanks in advance.

foulong commented 2 years ago

ok ! This package unsupported OpenAPI version 3.1 It's normal. I will wait for the new version.