'Mule APIKit and multiple RAMLs

It is possible using multiple RAML files in one APIKit Mule Project?

Let's say I have two functions /api/func1 and /api/func2. Each of the functions is defined in its own raml - func1.raml and func2.raml. I've generated a flow in Anypoint for the first function using the APIKit wizard. It's working ok.

Now, I'm trying generating a flow for the second function. The flow is generated with no errors. However, it just doesn't work. I've tried fixing the URLs, bindings, configurations and nothing really helps. Note, that I don't wanna bind both the RAMLs into one file. The reason is that it's easier to develop/maintain the functions separately.

The only solution I can see is to define two separate projects. But this is not really what I'd like to do.

So, looking for an advice of how to deal with this situation.

Thanks,



Solution 1:[1]

Ok, actually, it's possible. What you need to do is make the "Path"es different in the HTTP connectors for the flows generated.

The apikit wizard generates the default path that looks like this: "/api/*".

So, Mule generates an error when attempting to deploy the app. What you need to do is changing paths to "/api/func1/" and "/api/func2/"

Solution 2:[2]

You can continue having a single RAML file and make external references to simplify your raml, here is an example:

#%RAML 0.8

title: Eventlog API
version: 1.0
baseUri: http://eventlog.example.org/{version}

schemas:
  - eventJson: !include eventSchema.json
    eventListJson: !include eventlistSchema.json

Also going by strict REST design it is recommended to have a resource related details maintained in a single RAML file.

Optionally you may edit the url's to resolve any context related conflict.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 spoonboy
Solution 2 wajid mehraj