Closed mhamann closed 2 years ago
@mhamann please submit a PR to fix this.
Hello @jsdevel : I also suffer from this problem and try to probide a fix: It would be nice to be able to use openapi-framework without an implementation, e.g. to implement generic request validation. Looking a the code it seem to have worked in the past, as "routeItem.operations" rather looks like a typo. However I'm not sure with the role of "operationDoc" - which would become undefined in this case. Is this intended? It would be great if you could have a closer look and my PR and see it if makes sense at all. When I have execute the tests, one was failing that explicitly expected an exception in case of a missing operation. Maybe this test could become obsolete?
Thanks, Reiner.
I have jsut seem that also in case of operationDoc would be correctly filled with pathDoc[methodName] which seems to be correct. However I'm not sure if there are some corner cases that should be considered. I have also removed the "throws" check in the tests - now all tests are succeeding for me.
When an operation is defined in the OpenAPI spec, but doesn't have a matching function identified in the openapi-framework, the server crashes on startup because it tries to access an undefined property on the route item. Specifically here https://github.com/kogosoftwarellc/open-api/blob/master/packages/openapi-framework/index.ts#L358
It would be preferable to simply ignore the error and either just not process requests to that operation or return a 501 Not Implemented.