Open rscadrde opened 6 years ago
You can download it to local file system first and then generate it
For sure downloading is a workaround (as setting the API to public when generating is a workaround).
But as maven works it should be possible to execute ram-java-client-generator during some kind of execution-phase (e.g. process-resources) and re-generate the java files automatically.
Which is currently possible on
but not for private anypoint.mulesoft.com APIs (even not our private nor private from other parties shared with us).
As raml-java-client-generator is from mulesoft and the anypoint API platform is, it should be possible to somehow add anypoint credentials to access the APIs programmatically.
With Design Center (Crowd Release?) the Artifacts from Exchange are available via Maven dependency
<dependency>
<groupId>6b05fd51-2fe5-4078-b1a1-83d46894bf7</groupId>
<artifactId>mule-template1</artifactId>
<version>1.0.4</version>
<classifier>raml</classifier>
<type>zip</type>
</dependency>
and so I started using maven-dependency-plugin
to copy them to the local directory and successully generated from the raml via
<ramlURL>file:////${project.build.directory}/copied-dependencies/mule-template1-1.0.4-raml-zip/api.raml</ramlURL>
That seems to be a good working solution.
So nothing to do here.
Issue can be closed.
Having a private API in
https://anypoint.mulesoft.com/apiplatform/---companyname---/#/portals/organizations/----organization-id----/apis/---api-number----/versions/---version-number--
it is not possible to pass any authentication / token informations as just
new InputStreamReader(ramlURL.openStream()))
is done in RamlJavaClientGenerator not allowing any basic auth or token header.Result is always:
[ERROR] Failed to execute goal org.mule.raml.codegen:raml-client-generator-maven-plugin:0.1.1:generate-client (default-cli) on project : Exception while generating client. Server returned HTTP response code: 401
(setting API to public is not an option as it is a private one ;-) )