An ember-cli addon for quickly and easily adding swagger-ui components to your ember application.
Compatibility
$ ember install ember-swagger-ui
As of version 1.0.0, the addon is based on swagger-ui 3.x. Some notable differences from previous versions include:
Configuring a component is done by passing a config object to the component's config
attribute.The object takes any and all supported swagger-ui 3.x configuration
// controllers/application.js
import Controller from '@ember/controller';
import Swag from 'swagger-ui';
const {
SwaggerUIBundle,
SwaggerUIStandalonePreset
} = Swag;
export default Controller.extend({
swaggerConfig: {
url: 'http://petstore.swagger.io/v2/swagger.json',
deepLinking: false,
presets: [
SwaggerUIStandalonePreset,
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
docExpansion: 'none',
tagsSorter: 'alpha',
operationsSorter: 'alpha',
defaultModelsExpandDepth: -1,
defaultModelExpandDepth: 1,
validatorUrl: 'https://online.swagger.io/validator'
}
});
{{!-- application.hbs --}}
{{swagger-ui config=swaggerConfig}}
// ember-cli-build.js
let app = new EmberAddon(defaults, {
'ember-swagger-ui': {
// use public tree instead of vendor concat
usePublic: true
}
});
Releases preceeding 1.0.0 are based on swagger-ui 2.x and are considered pre-releases.
Many of the swagger-ui configuration properties are available as attributes on the component.The currently supported options are documented below. For more details on each of these options, please refer to the swagger-ui docs:
The component's default url is "http://petstore.swagger.io/v2/swagger.json".The following would load the API docs of the default petstore example:
{{swagger-ui}}}
To load your API docs, simply supply the URL of your swagger.json as the "url" attribute value:
{{swagger-ui url="http://petstore.swagger.io/v2/swagger.json"}}
As noted in the swagger-ui docs, you could alternately supply a JSON object that is a valid Swagger definition:
{{swagger-ui spec=mySpec}}
{{swagger-ui docExpansion="list"}}
{{swagger-ui supportedSubmitMethods=anArrayOfHttpMethods}}
{{swagger-ui showRequestHeaders=true}}
Authorizations are configured in the same manner they would be if pulling in the entire swagger-ui distribution.See below for an example of query parameter apiKey configuration.
{{#swagger-ui showRequestHeaders=true docExpansion="list" supportedSubmitMethods=submitMethods authorizations=authz}}
<div id='header'>
<div class="swagger-ui-wrap">
<a id="logo" href="http://swagger.io">swagger</a>
<form id='api_selector'>
<div class='input'><input placeholder="http://example.com/api" id="input_baseUrl" name="baseUrl" type="text"/></div>
<div class='input'><input placeholder="api_key" id="input_apiKey" name="apiKey" type="text"/></div>
<div class='input'><a id="explore" href="#" data-sw-translate>Explore</a></div>
</form>
</div>
</div>
{{/swagger-ui}}
// my-route.js
// set up component attribute values on your controller
setupController(controller) {
controller.set('submitMethods', ['get', 'post'] );
controller.set('authz', { name: 'api_key', value: 'myQueryParamApiKey', type: 'query'} );
}
The component supports block syntax to aid in customizing any content necessary to interact with your API documentation.Following is a contrived example of adding basic auth via a form:
{{#swagger-ui}}
<div>
<form {{action "submit" on="submit"}}>
{{input value=user placeholder="Username"}}
{{input value=pw placeholder="Password" type="password"}}
{{input type="submit" value="Submit"}}
</form>
</div>
{{/swagger-ui}}
// my-route.js
// setup action to handle the form submission and addition of the swagger authorization
actions: {
submit() {
let { user, pw } = this.controllerFor('application').getProperties('user', 'pw');
let creds = window.btoa(user + ':' + pw);
let basicAuth = new window.SwaggerClient.ApiKeyAuthorization("Authorization", "Basic " + creds, "header");
window.swaggerUi.api.clientAuthorizations.add("Authorization", basicAuth);
window.swaggerUi.load();
}
}
See the Contributing guide for details.
This project is licensed under the MIT License.
ember-uikit This addon is a wrapper for the CSS library UIkitwhich exposes certain components to give users an easy way for using UIkit inember apps. ember-uikit is heavily inspired by Vuikit which do
Ember检查器是一个浏览器插件,用于调试Ember应用程序。 灰烬检查员包括以下主题 - S.No. 灰烬检查员方式和描述 1 安装Inspector 您可以安装Ember检查器来调试您的应用程序。 2 Object Inspector Ember检查器允许与Ember对象进行交互。 3 The View Tree 视图树提供应用程序的当前状态。 4 检查路由,数据选项卡和库信息 您可以看到检查
Swagger UI是一款RESTFUL接口的文档在线自动生成+功能测试功能软件。 demo参见:http://petstore.swagger.wordnik.com/#!/pet
对于一个nodejs项目,我正在使用swagger ui express和swagger jsdocs作为swagger API。当我尝试使用Swagger调用应用程序的POSTendpoint时,没有使用发送数据。有什么问题吗?我的全部相关代码如下: Swagger正在执行get请求,但在发送数据时,d标志为空。有人有主意吗? 最好的问候
英文原文: http://emberjs.com/guides/getting-ember/index/ Ember构建 Ember的发布管理团队针对Ember和Ember Data维护了不同的发布方法。 频道 最新的Ember和Ember Data的 Release,Beta 和 Canary 构建可以在这里找到。每一个频道都提供了一个开发版、最小化版和生产版。更多关于不同频道的信息可以查看博客
ember-cli-ui ember-cli in the browser to create and manage yourEmber projects using GUI See the demo video. Installation npm install -g ember-cli-ui Usage ember-cli-ui The CLI will automatically open