
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
api-console
Advanced tools
An API console for RAML (Restful Api Modeling Language) documents. The RAML Console allows browsing of API documentation and in-browser testing of API methods.
There are two ways you can include the console: directly, or within an iframe. The direct method is seamless but has the potential of CSS and JS conflicts. Using an iframe avoids conflicts, but has its own quirks noted below.
Include the packaged CSS and JS in your document
<head>
…
<link href="styles/vendor.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="path/to/dist/styles/light-theme.css" type="text/css" />
</head>
<body ng-app="ramlConsoleApp" ng-cloak>
…
<script src="path/to/dist/scripts/vendor.js"></script>
<script type="text/javascript" src="scripts/api-console.js"></script>
<script type="text/javascript">
$.noConflict();
</script>
</body>
Include the <raml-console>
directive, specifying your RAML as a src
attribute.
Please ensure that the container for the console directive provides the CSS properties overflow: auto
and position: relative
.
The CSS for the console is namespaced so that it won't affect other parts of the page it's included on. However, general styles you have (such as on h1
s) may inadvertently bleed into the console.
The console's javascript includes various dependencies, for example AngularJS and jQuery. If your document requires different versions or includes conflicting libraries, your page may break.
Within the page that you would like to include the console into, add the following:
<iframe src="path/to/dist/index.html?raml=path/to/your.api.raml"/>
You will need to specify a fixed height for the iframe that fits into the design of your page. Since iframes do not automatically resize to fit content, the user may have to scroll within the iframe.
A proxy for Try It can be provided after loading the console JavaScript. For example:
RAML.Settings.proxy = 'http://www.someproxy.com/somepath/'
Given the above, trying a GET to http://www.someapi.com/resource
would get
http://www.someproxy.com/somepath/http://www.someapi.com/resource
A redirect URI for OAuth 2 can be provided in a similar manner:
RAML.Settings.oauth2RedirectUri = 'http://www.raml.org/console/'
Given the above, OAuth 2 requests would redirect back to that URL.
In Single View mode you will be able to see only documentation or try-it.
<raml-console src="path-to-raml" single-view></raml-console>
Theme Switcher can be disable if needed by adding the following setting:
<raml-console src="path-to-raml" disable-theme-switcher></raml-console>
Raml client generator can be disable if needed by adding the following setting:
<raml-console src="path-to-raml" disable-raml-client-generator></raml-console>
Resources can be collapsed if needed by adding the following setting:
<raml-console src="path-to-raml" resources-collapsed></raml-console>
Documentation can be collapsed if needed by adding the following setting:
<raml-console src="path-to-raml" documentation-collapsed></raml-console>
Unsafe Markdown will be disable by default, if you want to allow unsafe contet check the following example:
<raml-console src="path-to-raml" allow-unsafe-markdown></raml-console>
To run the console, you'll need the following:
gem install sass
npm install -g grunt-cli
npm install -g bower
npm install
bower install
$ grunt
$ open http://localhost:9000
To run tests, you'll need the following:
gem install sass
npm install -g grunt-cli
npm install -g protractor
npm install
node_modules/grunt-protractor-runner/node_modules/protractor/bin/webdriver-manager update
$ grunt regression
To contribute source code to this repository, please read our contributor's agreement, and then execute it by running this notebook and following the instructions: https://api-notebook.anypoint.mulesoft.com/notebooks/#380297ed0e474010ff43
FAQs
The API Console to automatically generate API documentation from RAML and OAS files.
The npm package api-console receives a total of 325 weekly downloads. As such, api-console popularity was classified as not popular.
We found that api-console demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.