Closed thebookyouread closed 3 years ago
Hi @thebookyouread , thanks for reporting the issue.
Can you please share a stack trace of the error?
Hi, I think this error is a result of "Circular references", i've tested other circular references definitions and got the same error. The following is the error:
`/Users/tests/test_validator/node_modules/api-schema-builder/src/index.js:42
Object.keys(dereferenced.paths).forEach(currentPath => {
^
TypeError: Cannot convert undefined or null to object
at Function.keys (<anonymous>)
at buildValidations (/Users/tests/test_validator/node_modules/api-schema-builder/src/index.js:42:12)
at Object.buildSchemaSync (/Users/tests/test_validator/node_modules/api-schema-builder/src/index.js:31:12)
at Middleware.init (/Users/tests/test_validator/node_modules/openapi-validator-middleware/src/middleware.js:33:41)
at Object.<anonymous> (/Users/tests/test_validator/index.js:4:19)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)`
Hi @thebookyouread , we checked the issue in both api-schema-builder
and json-schema-deref-sync
packages, and the circular references are not supported due to performance and complexity issues. We checked what we can do in our package to solve it and concluded that it will be too complicated and will take us into more issues.
For now, we decided to not support it and we recommend avoiding this pattern as stated in the following issue
Using the spec below I get this error:
Cannot convert undefined or null to object