Skip to content

additionalProperties can be a bool or schema #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
domenkozar opened this issue Jul 27, 2018 · 2 comments · Fixed by #194
Closed

additionalProperties can be a bool or schema #67

domenkozar opened this issue Jul 27, 2018 · 2 comments · Fixed by #194
Labels
area/schema Indicates an issue on schema area kind/bug/confirmed

Comments

@domenkozar
Copy link
Contributor

As per https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#schema-object - currently it's expected to be schema.

@dremdem
Copy link

dremdem commented Aug 15, 2018

additionalProperties:
  type: number

This statement is not supported also.

@p1c2u p1c2u added the area/schema Indicates an issue on schema area label Aug 17, 2018
@berend
Copy link
Contributor

berend commented Feb 14, 2019

I ran into this as well. I would consider this not as enhancement, but as bug, because you can not load valid openapi files. Maybe a step into fixing this is to ignore it.

Simple way to reproduce:

openapi: 3.0.0
info: 
  version: "1"
  title: openapi test
paths:
  /foo:
    post:
      tags:
        - foo
      summary: foo
      requestBody:
        required: true
        content:
            application/json:
              schema:
                type: object
                additionalProperties: true
                example:
                  foo: bar
                  bar: foo
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                type: string
from openapi_core import create_spec
from openapi_core.shortcuts import RequestValidator 
import yaml

with open("openapi.yaml") as f:
    openapi_spec = yaml.safe_load(f)

spec = create_spec(openapi_spec)
validator = RequestValidator(spec)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/schema Indicates an issue on schema area kind/bug/confirmed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants