Hi Shalika,

This particular validation functionality has been partially implemented
(Without UI support) across various customer implementations.

However, before implementing this feature, we should be able to consider
having options to use JSON schema validation options at the resource level
or on a global level.

I have already done a custom handler implementation for JSON validation by
using the json*-schema-validator *library which is being used with the EI's
Validator mediator. AFAIK Lahiru implemented a comprehensive JSON schema
validation library.

Regards,
Firzhan


email: [email protected]
mobile: (+94) 77 9785674 <%28%2B94%29%2071%205247551>*|
blog: http://firzhanblogger.blogspot.com/
<http://firzhanblogger.blogspot.com/>  <http://suhothayan.blogspot.com/>*
*twitter: https://twitter.com/firzhan007 <https://twitter.com/firzhan007> |
linked-in: **https://www.linkedin.com/in/firzhan
<https://www.linkedin.com/in/firzhan>*


On Fri, Sep 14, 2018 at 9:49 AM Hasunie Adikari <[email protected]> wrote:

> Hi Shalika,
>
> Could you please elaborate more on how are we planning to store the
> swagger definition in the API Gateway runtime?
>
> Regards,
> Hasunie
>
> On Fri, Sep 14, 2018 at 3:33 PM, Shalki Wenushika <[email protected]>
> wrote:
>
>> Hi All,
>>
>> Problem
>>
>>
>>    -
>>
>>    Current microgateway version does not have an approach to validate
>>    requests/responses.
>>    -
>>
>>    Validating request/response based on a predefined API schema is
>>    helpful to     ensure whether the user have sent the request
>>    according to the schema and also to ensure whether the back-end have sent
>>    the correct     response to the request.
>>
>> Solution
>>
>>
>>    -
>>
>>    Store the swagger definition within gateway runtime.
>>    -
>>
>>    When     a user sends a request to the microgateway, validate the
>>    request using the swagger file.
>>    -
>>
>>    If valid, send the request to the back-end or otherwise send an error
>>    message to the user.
>>    -
>>
>>    And when the back-end sends response to the request, validate the
>>    response using the swagger file.
>>    -
>>
>>    If valid, send the response to the user or otherwise send an error
>>    message.
>>
>>
>> Implementation
>>
>>
>>    -
>>
>>    Two solutions exist for this problem.
>>
>> 01. First solution is to validate request/response using everit JSON
>> schema validator.
>>
>> 02. Implement a request/response validator in Ballerina.
>>
>> For that swagger-model-validator for Node.js can be convert in to
>> Ballerina.
>>
>>
>>
>> Fig 1: Validating a request
>>
>>                                                     Fig 2: Validating a
>> response
>>
>>
>> Thank you!
>>
>> --
>>
>> *Shalki Wenushika*
>> *Software engineering Intern*
>> WSO2  (University of Moratuwa)
>> *mobile *: *+94 716792399* |   *email *:
>> <http://c.content.wso2.com/signatures/wso2-signature-general.png>
>> [email protected]
>>
>>
>>
>>
>
>
> --
> *Hasunie Adikari*
> Senior Software Engineer
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
> blog http://hasuniea.blogspot.com | https://medium.com/@Hasunie/
> Mobile:+94713095876
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to