Re: [Architecture] Revamping validator filter in API Microgateway

2020-02-16 Thread Hasunie Adikari
Hi All,

Right now we maintain massive ballerina code for the schema validation
logic but it is cumbersome. We face some readability and performance issues
with the existing code. Hence we decided to take advantage of the ballerina
interop and wrap the java codes to a ballerina function. So the new
approach is to create two functions for the request validation and response
validation in the validation filter and call the ballerina method which
wraps the java logic.

Moreover, we have to face a blocking issue by keeping the swagger content
in the .bal files. Hence from this release, we use the ballerina resources/
folder which contains the swagger files of the MG project that will be
available at runtime.

Regards,
Hasunie


On Sun, Oct 6, 2019 at 8:20 AM Praminda Jayawardana 
wrote:

> +1
>
> - This makes the maintainability of validation feature easy.
> - We've evaluated everit library before to validate the earlier
> configuration model of MGW and got acceptable results.
>
>
> On Thu, Oct 3, 2019 at 7:29 PM Rajith Roshan  wrote:
>
>> I think using a common library would make both synapse and micro gateways
>> behaves the same way when validating the schemas. Maintaining our own
>> library would become difficult as open API spec add more and more
>> validations(with newer versions) , we will have to keep track of it and
>> include those into the feature. Using a library(under continuous
>> development), would make this easier as we only have to update the library
>> version.
>>
>> Thanks!
>> Rajith
>>
>> On Thu, Oct 3, 2019 at 7:21 PM Hasunie Adikari  wrote:
>>
>>> Hi All,
>>>
>>> I have been working on JBallerina upgrade for the schema validator
>>> filter which validates the request/response payloads against the schema in
>>> the swagger file. Significant changes have been introduced with the b7
>>> release and thus we need to revamp the feature accordingly. This is an
>>> arduous task provided that the validation logic has been implemented by
>>> ourselves and not using a third-party library. The validation logic in a
>>> sense, it includes a blend of tasks as below.
>>>
>>> 1. Primitive type validation
>>>
>>> 2. Custom type validation
>>>
>>> 3. Minimum, Maximum length of the integer and query parameters
>>>
>>> 4. Required field validation
>>>
>>> 5. Consider (allOf, anyOf ,oneOf) and use with a discriminator
>>>
>>> Besides the above, the feature should be compatible with both swagger
>>> versions 2 and 3. There are some drawbacks with the current implementation
>>> such as,
>>>
>>>1.
>>>
>>>Complexity - We have to put unnecessary effort to do generic JSON
>>>schema validations on our side.
>>>2.
>>>
>>>Maintainability - We can get future improvements from the library
>>>instead of writing ourselves.
>>>
>>> Hence, I would like to propose to use the third party library everit [1]
>>> which is similar to the synapse gateway and It provides the same
>>> capabilities extensively. If we go ahead with this approach, we just need
>>> to provide the payload and relevant schema model to the validate function
>>> of the library. WDYT?
>>>
>>> [1] https://github.com/everit-org/json-schema
>>>
>>> Regards,
>>> Hasunie
>>>
>>>
>>>
>>> --
>>> *Hasunie Adikari*
>>> Associate Technical Lead
>>> WSO2 Inc.; http://wso2.com
>>> lean.enterprise.middleware
>>> blog http://hasuniea.blogspot.com | https://medium.com/@Hasunie/
>>> Mobile:+94713095876
>>>
>>>
>>
>> --
>> *Rajith Roshan* | Associate Technical Lead | WSO2 Inc.
>> (m) +94-717-064-214 |  (e) raji...@wso2.com 
>>
>> 
>>
>
>
> --
>
> *Praminda Jayawardana* | Senior Software Engineer | WSO2 Inc.
> (m) +94 (0) 716 590918 | (e) prami...@wso2.com
> GET INTEGRATION AGILE
> Integration Agility for Digitally Driven Business
>


-- 
*Hasunie Adikari*
Associate Technical Lead
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware
blog http://hasuniea.blogspot.com | https://medium.com/@Hasunie/
Mobile:+94713095876
___
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture


Re: [Architecture] Revamping validator filter in API Microgateway

2019-10-05 Thread Praminda Jayawardana
+1

- This makes the maintainability of validation feature easy.
- We've evaluated everit library before to validate the earlier
configuration model of MGW and got acceptable results.


On Thu, Oct 3, 2019 at 7:29 PM Rajith Roshan  wrote:

> I think using a common library would make both synapse and micro gateways
> behaves the same way when validating the schemas. Maintaining our own
> library would become difficult as open API spec add more and more
> validations(with newer versions) , we will have to keep track of it and
> include those into the feature. Using a library(under continuous
> development), would make this easier as we only have to update the library
> version.
>
> Thanks!
> Rajith
>
> On Thu, Oct 3, 2019 at 7:21 PM Hasunie Adikari  wrote:
>
>> Hi All,
>>
>> I have been working on JBallerina upgrade for the schema validator filter
>> which validates the request/response payloads against the schema in the
>> swagger file. Significant changes have been introduced with the b7 release
>> and thus we need to revamp the feature accordingly. This is an arduous task
>> provided that the validation logic has been implemented by ourselves and
>> not using a third-party library. The validation logic in a sense, it
>> includes a blend of tasks as below.
>>
>> 1. Primitive type validation
>>
>> 2. Custom type validation
>>
>> 3. Minimum, Maximum length of the integer and query parameters
>>
>> 4. Required field validation
>>
>> 5. Consider (allOf, anyOf ,oneOf) and use with a discriminator
>>
>> Besides the above, the feature should be compatible with both swagger
>> versions 2 and 3. There are some drawbacks with the current implementation
>> such as,
>>
>>1.
>>
>>Complexity - We have to put unnecessary effort to do generic JSON
>>schema validations on our side.
>>2.
>>
>>Maintainability - We can get future improvements from the library
>>instead of writing ourselves.
>>
>> Hence, I would like to propose to use the third party library everit [1]
>> which is similar to the synapse gateway and It provides the same
>> capabilities extensively. If we go ahead with this approach, we just need
>> to provide the payload and relevant schema model to the validate function
>> of the library. WDYT?
>>
>> [1] https://github.com/everit-org/json-schema
>>
>> Regards,
>> Hasunie
>>
>>
>>
>> --
>> *Hasunie Adikari*
>> Associate Technical Lead
>> WSO2 Inc.; http://wso2.com
>> lean.enterprise.middleware
>> blog http://hasuniea.blogspot.com | https://medium.com/@Hasunie/
>> Mobile:+94713095876
>>
>>
>
> --
> *Rajith Roshan* | Associate Technical Lead | WSO2 Inc.
> (m) +94-717-064-214 |  (e) raji...@wso2.com 
>
> 
>


-- 

*Praminda Jayawardana* | Senior Software Engineer | WSO2 Inc.
(m) +94 (0) 716 590918 | (e) prami...@wso2.com
GET INTEGRATION AGILE
Integration Agility for Digitally Driven Business
___
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture


Re: [Architecture] Revamping validator filter in API Microgateway

2019-10-03 Thread Rajith Roshan
I think using a common library would make both synapse and micro gateways
behaves the same way when validating the schemas. Maintaining our own
library would become difficult as open API spec add more and more
validations(with newer versions) , we will have to keep track of it and
include those into the feature. Using a library(under continuous
development), would make this easier as we only have to update the library
version.

Thanks!
Rajith

On Thu, Oct 3, 2019 at 7:21 PM Hasunie Adikari  wrote:

> Hi All,
>
> I have been working on JBallerina upgrade for the schema validator filter
> which validates the request/response payloads against the schema in the
> swagger file. Significant changes have been introduced with the b7 release
> and thus we need to revamp the feature accordingly. This is an arduous task
> provided that the validation logic has been implemented by ourselves and
> not using a third-party library. The validation logic in a sense, it
> includes a blend of tasks as below.
>
> 1. Primitive type validation
>
> 2. Custom type validation
>
> 3. Minimum, Maximum length of the integer and query parameters
>
> 4. Required field validation
>
> 5. Consider (allOf, anyOf ,oneOf) and use with a discriminator
>
> Besides the above, the feature should be compatible with both swagger
> versions 2 and 3. There are some drawbacks with the current implementation
> such as,
>
>1.
>
>Complexity - We have to put unnecessary effort to do generic JSON
>schema validations on our side.
>2.
>
>Maintainability - We can get future improvements from the library
>instead of writing ourselves.
>
> Hence, I would like to propose to use the third party library everit [1]
> which is similar to the synapse gateway and It provides the same
> capabilities extensively. If we go ahead with this approach, we just need
> to provide the payload and relevant schema model to the validate function
> of the library. WDYT?
>
> [1] https://github.com/everit-org/json-schema
>
> Regards,
> Hasunie
>
>
>
> --
> *Hasunie Adikari*
> Associate Technical Lead
> WSO2 Inc.; http://wso2.com
> lean.enterprise.middleware
> blog http://hasuniea.blogspot.com | https://medium.com/@Hasunie/
> Mobile:+94713095876
>
>

-- 
*Rajith Roshan* | Associate Technical Lead | WSO2 Inc.
(m) +94-717-064-214 |  (e) raji...@wso2.com 


___
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture


[Architecture] Revamping validator filter in API Microgateway

2019-10-03 Thread Hasunie Adikari
Hi All,

I have been working on JBallerina upgrade for the schema validator filter
which validates the request/response payloads against the schema in the
swagger file. Significant changes have been introduced with the b7 release
and thus we need to revamp the feature accordingly. This is an arduous task
provided that the validation logic has been implemented by ourselves and
not using a third-party library. The validation logic in a sense, it
includes a blend of tasks as below.

1. Primitive type validation

2. Custom type validation

3. Minimum, Maximum length of the integer and query parameters

4. Required field validation

5. Consider (allOf, anyOf ,oneOf) and use with a discriminator

Besides the above, the feature should be compatible with both swagger
versions 2 and 3. There are some drawbacks with the current implementation
such as,

   1.

   Complexity - We have to put unnecessary effort to do generic JSON schema
   validations on our side.
   2.

   Maintainability - We can get future improvements from the library
   instead of writing ourselves.

Hence, I would like to propose to use the third party library everit [1]
which is similar to the synapse gateway and It provides the same
capabilities extensively. If we go ahead with this approach, we just need
to provide the payload and relevant schema model to the validate function
of the library. WDYT?

[1] https://github.com/everit-org/json-schema

Regards,
Hasunie



-- 
*Hasunie Adikari*
Associate Technical Lead
WSO2 Inc.; http://wso2.com
lean.enterprise.middleware
blog http://hasuniea.blogspot.com | https://medium.com/@Hasunie/
Mobile:+94713095876
___
Architecture mailing list
Architecture@wso2.org
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture