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
