0

I am getting an error when I attempt to import a local RAML API definition into Mulesoft, it gives a very vague error that the API definition file exists and that API Kit is pointing to it.

Api Kit configuration

This is the error message I get

Mule error message

The project is targeting Mule 4.3.0, and the version of Anypoint Studio is 7.11.1. In order to get this error I am right-clicking and selecting Mule > Generate Flows from Local REST API, I have also tried Mule > Generate flows from RAML. Both give the same error result.

The XML for the APIKit is as follows

<apikit:config outboundHeadersMapName="outboundHeaders" httpStatusVarName="httpStatus" doc:name="Router" doc:id="daffbcd4-325c-4911-a042-ca6e74e73970" name="ve-sys-moviesinformation-config" raml="ve-sys-moviesinformation.raml" api="api\ve-sys-moviesinformation.raml">
    <apikit:flow-mappings >
        <apikit:flow-mapping resource="/media/{movieId}" action="get" content-type="application/json" flow-ref="get:\media\(mediaId):ve-sys-moviesinformation-config" />
        <apikit:flow-mapping resource="/media/{movieId}" action="post" content-type="multipart/form-data" flow-ref="post:\media\(mediaId):multipart\form-data:ve-sys-moviesinformation-config" />
    </apikit:flow-mappings>
</apikit:config>

I have no idea how to resolve this issue, any help would be much appreciated.

Matthew Pigram
  • 1,400
  • 3
  • 25
  • 65
  • It should say importing into an Anypoint Studio project rather than MuleSoft (unless you are importing into MuleSoft office?). What steps are you taking to reproduce the issue? Is the same file already existing in the application project? What is the exact version of Studio and what is the version of Mule Runtime to execute the application? Please share the APIKIT configuration and flows as XML in text. – aled Mar 24 '22 at 01:17
  • I have updated the information of the question – Matthew Pigram Mar 24 '22 at 03:04

2 Answers2

0

I suspect that the problem is related to the APIKit configurations having manual mappings (ie <apikit:flow-mappings>), which is very unusual in my experience. The normal usage that the mappings are dynamically generated at runtime and are not explicit in the configuration. Unless there is a very specific reason there is no need for manual mappings.

Also some configurations seem to be deprecated. Maybe the configuration was created with an older version of APIKit, or even carried from the Mule 3 version which is not recommended.

Try commenting or removing the APIKit configuration and repeat the Generate Flows action in Anypoint Studio. It should automatically create a sane APIKit configuration along with the flows. You may need to do some refactoring of the existing flows, but seeing it is using only two flows it is not probably a significant effort.

aled
  • 21,330
  • 3
  • 27
  • 34
0

I meet the problem today and the solution is move config to the api.xml

http:listener-config apikit:config

then the generate flow works.

Rookie lx
  • 11
  • 1