Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes util.deep_get when obj is a list (#1055)
* Fixes util.deep_get when obj is a list The example below will seem strange. It's the result of distilling a complex API spec down to the root cause of the issue. ```yaml --- openapi: 3.0.0 info: version: v0 title: Repo an error description: Extremely contrived, but it illustrates the problem paths: /: get: operationId: app.get responses: '200': description: Just for giggles content: application/json: schema: $ref: "#/components/schemas/SomeWeirdResource" components: schemas: Resource: allOf: - type: object properties: id: type: string SomeWeirdResource: allOf: - type: object properties: id: $ref: '#/components/schemas/Resource/allOf/0/properties/id' ``` While convoluted, this is a valid OpenAPI 3 spec. ```sh $ yarn swagger-cli validate openapi/my_api.yaml yarn run v1.17.3 $ /[redacted]/node_modules/.bin/swagger-cli validate openapi/my_api.yaml openapi/my_api.yaml is valid ✨ Done in 0.23s. ``` `utils.deep_get` assumes the obj to be a dictionary when it can also be a list. * Updates docstring for utils.deep_get Comment on the pull request was asking for an explanation to clarify the code. The updated docstring aims to be clear on how exactly the object can be a list.
- Loading branch information