Skip to content

The swagger-validator has hard dependency on BodyHandler to parse the body to object into attachement #18

@stevehu

Description

@stevehu

In order to do schema validation for request body against swagger specification body definition, we have body validator in swagger-validator module. However, it depends on the BodyHandler to parse the body stream into map/list and put the Java object into an exchange attachment. This will require that BodyHandler must be existed in the request/response chain before RequestValidator. In the light-proxy imeplementation, we cannot consume the body it should be proxied downstream to the backend. Once BodyHandler is disabled, the RequestValidator output and error message that complain the body is missing for post etc. This needs to be resolved to break this kind of hard dependency. What if somebody miss the BodyHandler in their request chain?

The solution is to check if body attachment exists in the exchange or not to decide if body validator is called or not. It means that Body validation is skipped silently if BodyHandler is not working. In order to remind developer the behaviour, an warning log message will be write to the log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions