-
-
Notifications
You must be signed in to change notification settings - Fork 34
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
[Feature] add support for OpenAPI 3.1 #85
Comments
Hey @asdfasdfasdfasdfasasdf, looks like you are using openapi: 3.1.0
info:
version: unknown
title: unknown
description: unknown
servers:
- url: https://localhost
description: unknown
paths:
/slots:
get:
operationId: getSlots
tags:
- backplane
responses:
"200":
description: Successful operation
content:
application/json:
schema:
$ref: "#/components/schemas/slots"
components:
schemas:
slots:
type: array
items:
$ref: "#/components/schemas/slot"
object_create:
type: object
properties:
id:
type: integer
slot:
type: object
properties:
id:
type: integer
occupied:
type: string
enabled:
type: boolean
module:
$ref: "#/components/schemas/slot_module"
slot_module:
type: object
properties:
serial:
type: string # fixed line |
Hi and thanks for your quick reply. I'm no expert in YAML, trying to get a hang of it.
But in the code attached to this ticket, we only have 1 member in the array. |
I see, but unfortunately, this is the wrong way of doing that in OpenAPI specs, you can check the details and example of a proper way of handling multiple types here in docs. Specifically in the Mixed Types section. |
In Open API 3.1 it seems as if it is allowed: OAI/OpenAPI-Specification#2244 (comment) |
@asdfasdfasdfasdfasasdf |
You are correct, this is part of version 3.1. May I suggest that you add the supported Open API version to https://github.com/manchenkoff/openapi3-parser? Currently it says
but it would be nice if it stated 3.0.*. Regards, Jonas |
Yep, that would make sense! Will update readme 👍 |
tmp.yaml.txt
Describe the bug
The YAML file we use fails to be parsed. I believe have tracked it down to:
type:
- string
The error is shown as:
File "/home/***/.local/lib/python3.10/site-packages/openapi_parser/builders/schema.py", line 135, in create
raise ParserError(f"Invalid schema type '{schema_type}'") from None
openapi_parser.errors.ParserError: Invalid schema type '['string']'
I'm quite confident that the YAML syntax is correct. We use it just fine and Swagger does not complain.
To Reproduce
Use attached YAML file and type:
python3
from openapi_parser import parse
all_parse = parse('tmp.yaml')
Expected behavior
No error parsing the file.
System details (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: