-
Notifications
You must be signed in to change notification settings - Fork 48
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
Recursive components #112
Comments
I am seeing this exact problem while attempting to parse the Jira API: https://dac-static.atlassian.com/cloud/jira/platform/swagger-v3.v3.json |
Using aiopenapi3 instead, there is still some issues with the jira api description document.
but this is addressable. import pytest
import aiopenapi3.errors
from aiopenapi3 import OpenAPI
from aiopenapi3.plugin import Init
from aiopenapi3.loader import WebLoader
import yarl
class NoArrayEnum(Init):
def schemas(self, ctx: "Init.Context") -> "Init.Context":
for n,s in ctx.schemas.items():
if s.type == "array" and s.enum != None:
s.enum = None
return ctx
def test_jira():
url = "https://dac-static.atlassian.com/cloud/jira/platform/swagger-v3.v3.json"
loader = WebLoader(yarl.URL(url))
with pytest.raises(aiopenapi3.errors.DiscriminatorWarning):
api = OpenAPI.load_sync(url, loader=loader, plugins=[NoArrayEnum()]) |
Thanks for the suggestion. I'm hoping that one library will "just work" like the Swagger Java library. FYI, I can reproduce this error in 1.7.0 too. I'm attaching a sample file. As far as I can tell, the official Swagger parser does not chase down resolving component schema $ref items if they are attached as properties. The main parser loads a Component Processor. And then once a component property has a $ref it loads a Schema Processor. The Schema Processor only processes a $ref if it is an external reference. |
You are basically asking for a client which accepts invalid description documents. ms/kiota:
Number of warnings/errors:
Even if you got a library which "just works" as in "it can parse the description document", there may be differences in the protocol described by the description document, the protocol spoken by the service and the generated client protocol implementation. I favor a strict client providing the facilities to address inconsistencies. |
From 1.8+, there is an issue with openapi specs that contain recursive or cyclic references in components.
See attached sample spec and test file to reproduce. Works without issue for 1.7.0, but 1.8.0 yields a python error related to maximum recursion depth
test_recursive.py
recursive-spec.yaml
Output
Output from 1.7.0 and 1.8.0 parsing the same yaml spec
The text was updated successfully, but these errors were encountered: