API Connect

 View Only
  • 1.  Getting JSV0006 Invalid string _Validate policy

    Posted Wed June 15, 2022 10:14 AM
    Hi,

    I am trying to validate JSON message using "Validate against via Definitions" option available on validate action in API Connect 10.0.4.0.
    DataPower: IDG.10.0.4.0



    When I am testing a failure scenario, as expected schema validation error is generated but the actual JSON element is not reported in the error message.

    " [JSV0006] Invalid string: the string maximum length must be at most 5 (got 11)."

    How to ensure that the JSON element is present in the error message. Or there any other ways to custom this error message?

    Error:
    {
    "httpCode": "422",
    "httpMessage": "Unprocessable Entity",
    "moreInformation": "Validate: temporary:///swagger/sample-apim-org_sandbox_proxy_sync-dev-api_1.4.0.json:185: [JSV0006] Invalid string: the string maximum length must be at most 5 (got 6)."
    }

    ------------------------------
    ravikumar kunibilli
    ------------------------------


  • 2.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Mon June 20, 2022 12:22 PM

    Hi Ravikumar,
    There is a long standing DataPower request for enhancement to provide the property name in many of the JSON validation error messages.  At this point all I can tell you is to open a RFE request to get another customer's request in the system for this change.  As for how to change the generic error message, you can always catch the ParseError and change the message as you like, but you still won't have access to the failing property.  Catching the exception would allow you to specify your own schema for the error message.

    Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------



  • 3.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Tue June 21, 2022 04:26 AM
    Edited by ravikumar kunibilli Tue June 21, 2022 05:54 AM
    Hi @Steve Linn

    Thanks for the information and Can I get a error element name in the error response, If I open a RFE request ? If yes, What will be the ETA of the Resolution?

    HOW TO DO THE SCHEMA VALIDATION FOR OPEN API 3.0 DEFINITION IN API CONNECT V10 ?

    I have received OpenAPI3.0 file from other team and they're asking me to create an API with the given OpenAPI3.0 file. As per requirement We have to do the Schema validation for the Incoming JSON request at API Connect.  In general we will use VALIDATE policy to do the validation on Coming Request. Currently, In API Connect v10 there was no VALIDATE policy. Now, How can I do the schema validation in API Connect v10 for OpenAPI3.0 Definition.

    I tried writing gateway script but I felt that was not a good practice. Can you please suggest me the way to do the validation of OpenAPI3.0 definition in API Connect for JSON request?

    CONERSION OF OpenAPI3.0 To Open API2.0 using APIMATIC - Dashboard
    I did this process as I couldn't able to find any solution to do the Schema validation for OpenAPI3.0 definition in API Connect v10.

    I thought I could create a OpenAPI2.0 definition and can expose it as a OpenAPI3.0 to the consumers, while configuring the 2.0 API Endpoint at OpenAPI3.0 Invoke policy.

    I tried to convert OpenAPI3.0 To OpenAPI2.0 using APIMATIC - Dashboard. Then I created an OpenAPI2.0 definition with that Online converted OpenAPI2.0 file in API Connect V10. So that I could see Validate policy for the Schema validation. But I am not sure whether APIMATIC - Dashboard converted the file In a proper way or not as I am getting errors regards schema while testing the API with Valid Request body.

    Can I rely on Online converters to Convert OpenAPI3.0 to OpenAPI2.0?





    ------------------------------
    ravikumar kunibilli
    ------------------------------



  • 4.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Tue June 21, 2022 10:21 AM
    @Steve Linn   Could you please share your comments on below Issue, It would be very helpful for us to move forward.​

    ------------------------------
    [Ravikumar] [Kunibilli]
    [ravikumarkunibilli@gmail.com]
    ------------------------------



  • 5.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Wed June 22, 2022 04:09 PM

    Hi Ravikumar,
    As the underlying JSV compiler that API Connect uses is a DataPower feature, please see the responses on https://community.ibm.com/community/user/integration/discussion/getting-jsv0006-invalid-string-validate-policy?ReturnUrl=%2fcommunity%2fuser%2fintegration%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3db13f4693-16ee-422b-9d0b-f5262e25426f.

    Regards,

    Steve



    ------------------------------
    Steve Linn
    Senior Consulting I/T Specialist
    IBM
    ------------------------------