swagger-parser icon indicating copy to clipboard operation
swagger-parser copied to clipboard

OpenAPIV3Parser.resolve() should handle all errors in the entire spec

Open verve111 opened this issue 1 year ago • 0 comments

Hi, currently we've faced the issue on our project: OpenAPIV3Parser.resolve() is wrapped with the try-catch and when any error occurs within it, e.g. path is incorrect or a component is wrongly defined, the exception is thrown and caught by that try-catch (typical try-catch behaviour). In this way the spec validation stops and not proceeded to further paths and components:

private SwaggerParseResult resolve(SwaggerParseResult result, List<AuthorizationValue> auth, ParseOptions options,
        String location) {
    try {
    	// any exception here stops the spec parsing

    } catch (Exception e) {
        LOGGER.warn("Exception while resolving:", e);
        result.getMessages().add(e.getMessage());
    }
    return result;
}

It would be perfect to collect all such errors and not to get limited to a single one. Please tell if it's possible, Many thanks!

verve111 avatar Jan 09 '25 16:01 verve111