API Connect

 View Only
Expand all | Collapse all

enum values in request param body not validating against OAS 2.0

  • 1.  enum values in request param body not validating against OAS 2.0

    Posted Fri September 22, 2023 11:13 AM
      |   view attached

    I am using the attached swagger file for enumerating the day parameter present in query parameter of the GET request to check against some predefined values. Also I am using the validate policy as my first policy to validate the body-param. Below screen shot.  Whatever param value I send in the query it takes in and doesn't throw an error.

    GET https://apitest-awe.xxx.com/xyz/sandbox/api.bastide.org/1/demo?day=ttt. 

    I get back a proper response.  basically Its not doing a strict check against the enum values. Please help.



    ------------------------------
    Radhika Tharayil
    ------------------------------

    Attachment(s)

    yaml
    enumeration.yaml   841 B 1 version


  • 2.  RE: enum values in request param body not validating against OAS 2.0

    Posted Fri September 29, 2023 10:15 AM

    Hi Radhika,
    The validate policy is for validating the body only, not parameters.  The only parameter validation that is done today is the required property. For now my only suggestion would be to have a GatewayScript policy at the beginning of the assembly that would do a context.reject if the value doesn't match what you want.  You could open a PMR to have this done based upon the parameter configuration, but my assumption would be this would be considered a request for enhancement although I would see this as a useful feature.
    Best Regards,
    Steve



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