Open APIs

 View Only

OAS 3.0 'oneOf' Validation Error in Mulesoft – Both Schemas Matching

  • 1.  OAS 3.0 'oneOf' Validation Error in Mulesoft – Both Schemas Matching

    TM Forum Member
    Posted 27 days ago

    Hi Team,

    I'm facing an issue with oneOf validation in Mulesoft while using OpenAPI Specification (OAS) 3.0. When I send a request where the payload contains type: "A" or type: "B", both schemas match, resulting in the following error:

    {
      "code": "REQUEST_VALIDATION_ERROR",
      "message": "Invalid schema for content type application/json. Errors: /productOrderItem/0/product #: 2 subschemas matched instead of one."
    }

    Issue:

    Even though the payload correctly contains type: "A" or type: "B", Mulesoft is treating both schemas as valid matches, leading to the validation error.

    How can I properly enforce oneOf validation so that only one schema is recognized at a time?



    ------------------------------
    Lokasree B S
    CGI Information Systems and Management Consultants Inc.
    ------------------------------