Search code examples
mulemulesoftapikit

raml with trait injecting query params


I am working at a place which makes heavy use of mule and I am relatively a noob. One of the things that I am unable to understand is - we have an existing RAML with traits Example of RAML snippet:

/:
  description: Employee Resource
  get:
    description: Get all employees
    is: [ pageable ]

Here is snippet from 'pageable' trait:

queryParameters:
 offset:
  description: Specific page, starting from 1
  type: integer
  required: false
  example: 40
  default: 1

This is a Mule API with an APIKitRouter .

When I run this api in debug mode and do NOT send a request with this query param : offset

I can see that we dont have a query param ( in 'InboundProperties' ) . However as soon as the code passes through 'APIKitRouter' mule is injecting this query param into 'InboundProperties' ( this is a Mule 3 api )

I am aware that APIKitRouter contains a definition / reference to the RAML What I do not understand is : why is mule injecting this query param ? Thanks

edit1 : here is the screen print of inbound with injected query param in debug mode: enter image description here


Solution

  • It seems that APIkit is injecting the offset query parameter because it has a default value of 1 in the trait. Since you are not actually sending it in the HTTP request it is adding it with default value.