-
-
Save Thanood/ce6e048f043fdc752815cec324c4ea1c to your computer and use it in GitHub Desktop.
Aurelia Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<require from="bootstrap/css/bootstrap.css"></require> | |
<require from="./open-api-info"></require> | |
<nav class="navbar navbar-default" role="navigation"> | |
<div class="navbar-header"> | |
<a class="navbar-brand" href="#"> | |
<i class="fa fa-user"></i> | |
<span> | |
Open API Designer | |
</span> | |
</a> | |
</div> | |
</nav> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-6"> | |
<h2> | |
Design view | |
</h2> | |
<div class="form-group"> | |
<label for="name"> | |
Open API Spec version | |
</label> | |
<input type="text" class="form-control" id="name" placeholder="Email" value.bind="openApiSpec.swagger"> | |
</div> | |
${openApiSpec} | |
<open-api-info info.two-way="openApiSpec.info"></open-api-info> | |
</div> | |
<div class="col-md-6"> | |
<h2>JSON Preview</h2> | |
<pre> | |
${openApiSpecString} | |
</pre> | |
</div> | |
</div> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class App { | |
constructor() { | |
this.openApiSpec = { | |
swagger: '2.0', | |
info: { | |
title: '' | |
}, | |
/* | |
host: '', | |
basePath: '', | |
schemas: [], | |
consumes: [], | |
produces: [], | |
paths: {}, | |
definitions: {}, | |
parameters: {}, | |
responses: {}, | |
security: [], | |
tags: [], | |
externalDocs: {} | |
*/ | |
}; | |
} | |
/* | |
* Convert Open API Spec object to string | |
*/ | |
get openApiSpecString() { | |
const openApiSpecStringified = JSON.stringify(this.openApiSpec, null, ' '); | |
return openApiSpecStringified; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html> | |
<head> | |
<title> | |
OpenAPI Designer | |
</title> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app> | |
<h1>Loading...</h1> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script> | |
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script> | |
<script> | |
System.import('aurelia-bootstrapper'); | |
</script> | |
</body> | |
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<h1>Info</h1> | |
<div class="form-group"> | |
<label for="info-title"> | |
Title | |
</label> | |
<input | |
type="text" | |
class="form-control" | |
id="info-title" | |
placeholder="Title" | |
value.bind="info.title"> | |
</div> | |
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {bindable, bindingMode} from 'aurelia-framework'; | |
export class OpenApiInfo { | |
@bindable({ defaultBindingMode: bindingMode.twoWay }) info = {}; | |
constructor() { | |
console.log(this); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment