Hi all, At this stage I have implemented the code to send 422 error message to the client if the request/response is invalid and also I was able to get the swagger file of the requested API at the time of microgateway setup and embed it to the validationFilter. Yet we have not decided how this feature will be enabled(API level/resource level). When an API have multiple resources should we give the chance to the client to enable the validation feature for each resource?. And also for a resource again there are two options for enabling, we can enable the feature when the request is in and also when the response is out. So is it enough to give the opportunity to the customer to enable the feature from resource level or do we have to go for the in/out level too? I highly appreciate if you all can give suggestions on this.
Thanks, Shalki. 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] > > > > -- *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]
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
