TypeError: Cannot read property 'schema' of undefined
Issue #91
invalid
I get this error while validating this swagger file. According to swagger-cli, this file is valid and I cannot understand the reason.
Using the very last 10.1.0. The swagger file has been generated by Swashbuckle.
Here is the complete stack:
TypeError: Cannot read property 'schema' of undefined
at toJsonSchema (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\validate-mock-value-against-spec.
js:11:40)
at Object.validateMockValueAgainstSpec (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\validate-m
ock-value-against-spec.js:57:20)
at jsonSchemaTypeValidator (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\get-parsed-spec-operat
ion.js:11:126)
at parsedSpecPathNameSegments.map (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\get-parsed-spec
-operation.js:20:39)
at Array.map (<anonymous>)
at doInteractionAndOperationMatchPaths (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\get-parsed
-spec-operation.js:17:48)
at doInteractionAndOperationMatch (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\get-parsed-spec
-operation.js:41:30)
at normalizedParsedSpec.operations.map (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\get-parsed
-spec-operation.js:58:39)
at Array.map (<anonymous>)
at Object.getParsedSpecOperation (C:\Users\legalles\AppData\Roaming\npm\node_modules\swagger-mock-validator\dist\swagger-mock-validator\validate-spec-and-mock\get-parsed-spec-
operation.js:58:10)
Comments (2)
-
Account Deactivated -
Account Deactivated - changed status to invalid
the input spec is invalid, not a bug.
- Log in to comment
Hi @xavier le galles , sorry for the late response. It seems the swagger file you sent is actually invalid. You can try in swagger.editor.io :
The error is probably caused by the non matching parameter name (because of the different casing).
Unfortunately our pre-validation for openapi3 specs is not too thorough, so the problem is not detected there, and it fails later with that
Cannot read ….
error.