Hi Sivaramya, Its always good to start with complete swagger sample hosted by swagger. If you look at APIs deployed here then different paths accept different request payloads. How are we adding resource accordingly? Is that local entry UUID passed to class mediator knows resource specific schema? If so there can be multiple entries per API.
Also lets think about cleaning local entries when we disable this. Otherwise they will be remain in gateways. [1] https://github.com/OAI/OpenAPI-Specification/blob/master/examples/v2.0/json/petstore-simple.json Thanks, sanjeewa. On Wed, Mar 14, 2018 at 4:39 PM, Sivaramya Sivanathan <[email protected]> wrote: > Hi all, > > Currently, I'm working on the Json Schema Validation for API manager. When > we execute a API request, we need to do the Json schema validation so that > we can reduce the backend failures and also we can protect the gateways. > For this feature the proposed method is as follows, > > - > > Add the Json schema to the swagger file as mentioned below, so that we > can validate the request using the swagger file. > > *"parameters": [* > > * {* > > * "name": "Product",* > > * "description": "A product from the catalog",* > > * "required": false,* > > * "in": "body",* > > * "schema": {* > > * "type": "object",* > > * "properties": {* > > * "id": {* > > * "type": "number",* > > * “Description”: “The unique identifier for a product”* > > * },* > > * "name": {* > > * "type": "string",* > > * “Description”: “Name of the product”* > > * },* > > * "price": {* > > * "type": "number",* > > * “minimum”: 0* > > * }* > > * }* > > * }* > > * ],* > > > - Add a new check-box to enable the json-schema in UI in the publisher > level. > - If check-box enabled, at the point of generating API synapse > configuration, we can add the schema to a local entry which the name of the > local entry will be UUID + api+ resource version. > - We can add a property to hold the local entry name related with UUID > and add a class mediator inside each resource definition. > - Class mediator should make use of that property to get the schema > > Regards, > Sivaramya Sivanathan > Associate Software Engineer | WSO2 > Tel: 0770874960 <077%20087%204960> > WSO2 Inc : http://wso2.org > <http://www.google.com/url?q=http%3A%2F%2Fwso2.org&sa=D&sntz=1&usg=AFQjCNE_eTDfyl2ibPcq0hcXvRDNVuQmMg> > LinkedIn | www.linkedin.com/in/sivaramya > -- *Sanjeewa Malalgoda* WSO2 Inc. Mobile : +94713068779 <http://sanjeewamalalgoda.blogspot.com/>blog :http://sanjeewamalalgoda.blogspot.com/ <http://sanjeewamalalgoda.blogspot.com/>
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
