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
Getting the error as Invalid Schema, but extremely difficult to understand what the issue is #1517
Comments
Thanks for opening the issue, that is indeed a bad error report from Schemathesis. As far as I see, the underlying issue is that some of the security schemes miss the "type" key. You might want to run Schemathesis with At the moment I plan to rework schema validation on the SaaS side, so it outputs precise locations and what is missing in the schema. Though, there is no ETA for it |
Just a note, I realised I was using a spec file here, which was in turn trying to build from more $ref files in my projects, which Schemathesis mostly likely might not have been able to access, not super sure, but strangely, some apis still seemed to have work, while some did not :) . When I tried to test with the detailed schema which did not need anything externally but was the final Yaml, Schemathesis worked its way through it. Yet having a nicer error will always help. Thank you |
Thanks for more context! Can it be that you have |
Traceback (most recent call last):
|
Most likely so, because the
Exactly as you describe it - the example generation is too slow and Hypothesis raises an error because of it. There could be different causes on the schema level. Not necessarily
Schemathesis executes checks on each received response and then calculates these total values. Some checks are implemented here, and here are the docs on how they work. Let me know if you need more info :) P.S. You mentioned that you can't provide the spec, but if it would be suitable, I can take a look it privately (e.g. in Discord DM). Then I can say more details :) |
I think that the steps to improve it are:
|
I am getting the below error when trying to run Schemathesis on my Open API spec version 3 definition
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/schemathesis/specs/openapi/schemas.py", line 206, in get_all_operations
yield Ok(self.make_operation(path, method, parameters, raw_definition))
File "/opt/homebrew/lib/python3.9/site-packages/schemathesis/specs/openapi/schemas.py", line 256, in make_operation
self.security.process_definitions(self.raw_schema, operation, self.resolver)
File "/opt/homebrew/lib/python3.9/site-packages/schemathesis/specs/openapi/security.py", line 20, in process_definitions
if definition["type"] == "apiKey":
KeyError: 'type'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/schemathesis/specs/openapi/schemas.py", line 215, in _into_err
raise InvalidSchema(SCHEMA_ERROR_MESSAGE, path=path, method=method, full_path=full_path) from error
InvalidSchema: Schema parsing failed. Please check your schema.
Steps to reproduce the behavior:
I am sorry, unable to provide to api spec, but it could be nice to understand what might be the reason for such an error. Note, we have oneOf, allOf etc in our spec def.
Environment (please complete the following information):
The text was updated successfully, but these errors were encountered: