epam / Wilma

Service Virtualization Solution – a combined Service Stub and Transparent Proxy
GNU General Public License v3.0
58 stars 12 forks source link

New Wilma extra - offer json validation on-the-fly #94

Closed tkohegyi closed 6 years ago

tkohegyi commented 6 years ago

This is a good step before #88 that is about to use json configuration in Wilma, instead of Xml. In addition, this has additional benefit - can be used to validate the messages between services - if there is no such validation in the service itself.

tkohegyi commented 6 years ago

Example usage of the method implemented:

<dialog-descriptor comment="random comment" name="error-descriptor" usage="always">
    <condition-descriptor>
        <not>
            <condition class="JsonSchemaChecker">
                <param name="schema" value="jsonTestSchema.json"/>
                <param name="isSchemaVolatile" value="false"/>
            </condition>
        </not>
    </condition-descriptor>
    <response-descriptor code="200" delay="0" mimetype="application/json" template="templateBadJson"/>
</dialog-descriptor>

This little config example cause stub response (templateBadJson) in case the incoming request does not fit to jsonTestSchema.json schema file.