OAS Validation for Request Verb Validation

Hi Team,

I am using OAS Validation policy for validating my request payload and corresponding parameters. Its working as expected. But, if I am sending the request verbs which are not defined in OAS Validation, it is failing with 400 response. Instead of that, I have used 405 Method not found error in the response format in the OpenAPI 3.0. But, it is not working as expected. Is there anything else do I need to mention? Below is the OpenAPI

 

  /getFireBaseUserDetails:
    post:
      summary: Get status of the Email
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetFirebaseUserDetailRequest'
        required: false
      responses:
        200:
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFirebaseUserDetailResponse'
        405:
          description: Method not allowed
          content:
            application/json:
              schema:
                $ref: '#/definitions/405ErrorPayload'

 

0 1 84
1 REPLY 1

You will need to use a FaultRule to catch the fault from the OASValidation policy, then AssignMessage to set the return message you like.  I don't know the exact fault, but you can read the docs, and use Apigee Trace/Debug to determine the fault at runtime.  Then insert a FaultRule in the ProxyEndpoint, and attach your policy there. If you don't know how to do this, search in the Apigee doc for "handling faults". 

There is no way, as far as I know, to simply configure the OASValidation policy to create the error message that you have described in the specification.