On Tue, Oct 23, 2018 at 5:55 PM Shalki Wenushika <[email protected]> wrote:

> Hi all,
> As we have discussed I'm implementing this project in Ballerina. At this
> stage I have implemented a Ballerina code which validates
> requests/responses and put that code inside the validation filter which is
> created by me. After that I was able to successfully validate a json object
> against a schema which is defined inside the project.
> Now I'm working on sending a proper error message to the client if the
> request is invalid. And for further implementation, we are hoping to embed
> the swagger definition of the API at the time of micro-gateway setup and
> also to make the response validation optional.
>  [image: image.png]
>                                                  * Fig 1:Validating a
> request*
>    [image: image.png]
>
>                                               *Fig 2: Validating a
> response*
> Thanks,
> Shalki.
>
>
> On Mon, Sep 17, 2018 at 1:11 PM Shalki Wenushika <[email protected]>
> wrote:
>
>> Hi Firzhan,
>>
>> I'm implementing this functionality in Ballerina. For that I'm planning
>> to convert the json*-*schema-validator library in to Ballerina.
>>
>> Thanks,
>> Shalki
>>
>>
>> On Fri, Sep 14, 2018 at 10:42 PM, Firzhan Naqash <[email protected]>
>> wrote:
>>
>>> 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
>>>>
>>>
>>
>>
>> --
>>
>> *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]
>>
>>
>>
>>
>
> --
>
> *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]
>
>
>
>

-- 
*Sanjeewa Malalgoda*
Software Architect | Associate Director, Engineering - WSO2 Inc.
(m) +94 712933253 | (e) [email protected] | (b) Blogger
<http://sanjeewamalalgoda.blogspot.com>, Medium
<https://medium.com/@sanjeewa190>

GET INTEGRATION AGILE <https://wso2.com/signature>
Integration Agility for Digitally Driven Business
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to