All tests threw a KeyError: 'types'.
Hi, I am a newbie to the robot framework, this is a great project;I encountered some problems while testing https://petstore31.swagger.io/ with OpenApiDriver, requesting help;First of all, when validating the openapi.json corresponding to this project, there appears similar errors:ResolutionError while trying to load openapi spec: (2, 'No such file or directory', 'File not found: /components/schemas/petdetails')It appears that openapi.json does not comply with the OAS specifications, it should be modified to: "$ref" : "#/components/schemas/PetDetails"After modifying other similar errors, serve it as local openapi.json, as follows: openapi.json
Then create a svc1_api_test.robot file, with the content as follows: `*** Settings *** Library OpenApiDriver ... source=openapi.json ... origin=https://petstore31.swagger.io/api/v31 ... recursion_limit=3 Test Template Validate Using Test Endpoint Keyword
*** Test Cases *** Test Endpoint for ${method} on ${path} where ${status_code} is expected
*** Keywords *** Validate Using Test Endpoint Keyword [Arguments] ${path} ${method} ${status_code} Test Endpoint ... path=${path} method=${method} status_code=${status_code} `
Run the test: robot svc1_api_test.robot, all tests failed, with the information as follows: ...... Test Endpoint for POST on /pet where 200 is expected | FAIL | KeyError: 'types' ......
I didn't find any helpful information from the log.html.
Thanks for the report!
I've taken a quick look and it's caused by how this petstore references models within models. I did a quick "fix" locally but I need to consider / test that more thoroughly to be able to release it.
There is, however, a rather fundamental problem with how the petstore models the APIs; when looking at post pet for example, in the model for the pet, the full model of the category is referenced. This would mean that, to post a pet, you'll need to provide the full details for a (new) category. That is, in my opinion, a really bad idea (and goes against REST principles). For the post pet a model should be used that references the unique identifier (normally a uuid) of the category.
So even if I publish a fix for this structure, you'll have a hard / terrible time trying automation on the petstore API.