DataPower

 View Only
  • 1.  Getting JSV0006 Invalid string _Validate policy

    Posted Wed June 15, 2022 10:13 AM
    Edited by Kumar . 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.
    Using 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 03:47 AM

    "...api_1.4.0.json:185: [JSV0006] Invalid..."

    Please look into line 185 of ...api_1.4.0.json file for the failing element, the line number is appended with a ":" to the JSV.



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support & Fixpack team lead
    IBM DataPower Gateways (⬚ᵈᵃᵗᵃ / ⣏⠆⡮⡆⢹⠁⡮⡆⡯⠂⢎⠆⡧⡇⣟⡃⡿⡃)
    https://stamm-wilbrandt.de/en/blog/
    ------------------------------



  • 3.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Mon June 20, 2022 04:18 AM
    Hi Hermann,

    Thanks for the assistance but we are getting this error while hitting API which we have created in API Connect v10. We are using Validate policy for the schema validation at API Connect level, While validation fails we are expecting error element name in the error response instead of line number. Customer is expecting error element, Why it's not printing error element name.

    Example:
    We have set Min. and Max. length as 5 for below Json value ID , If I hit the API with more than 6characters it's throwing an error  like in below error description
    Error description:
    Invalid string:the string maximum length must be at most5(got 6)

    If I give 6 characters as a value to ID filed, I am expecting error with ID element. Can you suggest us what we can do to print the error element name in the error.



    {
    "Header": {
    "ID": "utddcu",
    "MsgDtTm":"2176-32-02 2176-32-",
    "Name": "Duis aliqua est ullamco laborum",
    "Loc": "voluptate enim incididunt id"
    }
    }

    Thanks,
    Ravi

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



  • 4.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Mon June 20, 2022 08:17 AM

    Sorry, DataPower does report errors in the way it does, and which I explained ("JSV file":line number).
    That is working as designed.

    In case your customer wants a different reporting, he can raise an RFE (Request For Enhancement).



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support & Fixpack team lead
    IBM DataPower Gateways (⬚ᵈᵃᵗᵃ / ⣏⠆⡮⡆⢹⠁⡮⡆⡯⠂⢎⠆⡧⡇⣟⡃⡿⡃)
    https://stamm-wilbrandt.de/en/blog/
    ------------------------------



  • 5.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Mon June 20, 2022 09:59 AM
    But I am Getting ERROR ELEMENT in this scenario.
    I have a SOAP service in API Connect v10, When I am selecting WSDL as a Validation type it's giving the error element name. 

    Not Getting ERROR ELEMENT
    and When I am selecting the Definitions as Validation type it's not giving the error element name.

    I couldn't able to find the exact behavior of API Connect and DataPower in this scenario. Issue is with  the Validate policy in API connect or it depends upon our Request Type(In earlier post i have used JSON Request )?

    Could you please provide me the information to get understand what's happening exactly.

    Thanks,
    Ravi

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



  • 6.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Mon June 20, 2022 12:20 PM
    Edited by Hermann Stamm-Wilbrandt Mon June 20, 2022 12:21 PM

    DataPower provides 10 compilers, and all are different.

    What you stated in last posting is WSDL compiler, what you stated before was JSV (JSON Schema Validation) compiler.

    As said, for JSV compiler you get what was designed, any change requires an RFE.



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support & Fixpack team lead
    IBM DataPower Gateways (⬚ᵈᵃᵗᵃ / ⣏⠆⡮⡆⢹⠁⡮⡆⡯⠂⢎⠆⡧⡇⣟⡃⡿⡃)
    https://stamm-wilbrandt.de/en/blog/
    ------------------------------



  • 7.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Tue June 21, 2022 05:57 AM
    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]
    [ravikumarkunibilli@gmail.com]
    ------------------------------



  • 8.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Tue June 21, 2022 08:04 AM
    Edited by Hermann Stamm-Wilbrandt Tue June 21, 2022 08:05 AM

    > Thanks for the information and Can I get a error element name in the error response, If I open a RFE request ?

    >

    Only if product management approves the RFE, after looking at amount of development, test and documentation work needed.

    > If yes, What will be the ETA of the Resolution?

    >

    No ETA.

    https://www.ibm.com/developerworks/rfe/execute?use_case=tutorials



    ------------------------------
    Hermann Stamm-Wilbrandt
    Compiler Level 3 support & Fixpack team lead
    IBM DataPower Gateways (⬚ᵈᵃᵗᵃ / ⣏⠆⡮⡆⢹⠁⡮⡆⡯⠂⢎⠆⡧⡇⣟⡃⡿⡃)
    https://stamm-wilbrandt.de/en/blog/
    ------------------------------



  • 9.  RE: Getting JSV0006 Invalid string _Validate policy

    Posted Wed June 22, 2022 04:06 PM

    Hi Ravikumar,

    Just a FYI, our product management now uses a different RFE site, please use https://integration-development.ideas.ibm.com/?project=DPGWY for the DataPower Gateway product and https://integration-development.ideas.ibm.com/ideas?project=APICONN for the API Connect product.  This specific RFE as I indicated in the API Connect community forum is a long standing RFE and can be viewed at https://integration-development.ideas.ibm.com/ideas/DPGWY-I-80.  Since the RFE already exists, I would suggest you vote for it and you can comment on your need for it as well.  I fully understand that the wsdl / xsd parser will indicate the specific element that was encountered for validation errors, but that is a different compiler.  As Hermann indicated, the JSV Compiler will require an RFE to make any changes including updating these error messages, and product management will weigh all of the requests for enhancement including this one versus the amount of time to implement, test, etc to decide which ones will get approved for each release cycle of the product.

    Best Regards,
    Steve



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