Skip to content
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

Does not support anyOf in the schema #8

Open
dionysio opened this issue Jun 30, 2024 · 0 comments
Open

Does not support anyOf in the schema #8

dionysio opened this issue Jun 30, 2024 · 0 comments

Comments

@dionysio
Copy link

Hi, just tried running your tool, in my schema I have something like this:

"ChatCreate":{"properties":{"topic_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Topic Id"}},"type":"object"

your parser crashes because of the missing type under the "topic_id" schema:

Traceback (most recent call last):
  File ".../python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/fencer/cli.py", line 34, in run
    api_spec.load_endpoints()
  File "...lib/python3.11/site-packages/fencer/api_spec.py", line 255, in load_endpoints
    body=self.resolve_body(self.paths[path][method].get('requestBody')),
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/fencer/api_spec.py", line 273, in resolve_body
    schema = self.resolve_schema(body['content']['application/json']['schema']['$ref'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../lib/python3.11/site-packages/fencer/api_spec.py", line 306, in resolve_schema
    if description['type'] == 'array' and '$ref' in description['items']:
       ~~~~~~~~~~~^^^^^^^^
KeyError: 'type'

When I removed this object, the tool went through correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant