mservicetech / openapi-schema-validation

Apache License 2.0
17 stars 11 forks source link

When there are multiple validation issues only the first one is returned #41

Open lukaszkegss opened 8 months ago

lukaszkegss commented 8 months ago

Current behaviour When there are multiple validation issues in body only the first one is returned

Expected All validation issues should be returned

Proposed fix:

 if(processingReport != null && !processingReport.isEmpty()) {
            var message = processingReport.stream().map(ValidationMessage::getMessage).collect(Collectors.joining(","));
            status = new Status(VALIDATOR_SCHEMA, message);
        }

https://github.com/mservicetech/openapi-schema-validation/blob/7b77cf791695ae6d0205adc0f23d71da8c7b9b47/src/main/java/com/mservicetech/openapi/validation/SchemaValidator.java#L126

stevehu commented 3 months ago

This is actually by design and we call it fail-fast. It will prevent attackers from exploiting our application significantly slower. If needed, we can open this as a configuration to turn off the fail-fast for the validator. Thanks.

lukaszkegss commented 3 months ago

Hi thank, you Steve, can this be open as an configuration?