Skip to content

Commit

Permalink
OAI -> OAS
Browse files Browse the repository at this point in the history
  • Loading branch information
gkoberger committed Mar 20, 2017
1 parent 86e6d8c commit 520edd1
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 21 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
oai
oas
===

Creating Swagger / Open API Initiative files is hard. This makes it easier.
Creating Swagger / Open API Spec files is hard. This makes it easier.

[![](https://cl.ly/1h271F1M1e2T/Untitled-2.png)](http://readme.io)

Installation
------------

npm install oai -g
npm install oas -g

Usage
-----

Go to a directory with your API, and type:

oai init
oas init

It will walk you through how to document your API with Open API Initiave.

Swagger Inline
--------------

Rather than trying to juggle one gigantic repo, `oai` uses something called
Rather than trying to juggle one gigantic repo, `oas` uses something called
[swagger-inline](https://github.com/readmeio/swagger-inline). It lets you include
a little swagger snippet in a comment above your code, and collects them all
together into one Swagger file:
Expand Down Expand Up @@ -54,7 +54,7 @@ Host your Swagger file
Hosting Swagger files is hard! So, we have an online component that hosts your
Swagger file for you. Just type the following to get a URL:

oai host
oas host

This will upload your Swagger file and give you a URL you can use.

4 changes: 2 additions & 2 deletions api.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ exports.api = function(args, opts) {
info.token = login.token;
} catch(e) {
console.log('You need to log in to do this!'.red);
console.log('Run ' + 'oai login'.yellow);
console.log('Run ' + 'oas login'.yellow);
return process.exit();
}
}
Expand Down Expand Up @@ -110,7 +110,7 @@ exports.load = function(action) {
}

console.log('Action not found.'.red);
console.log('Type ' + 'oai help'.yellow + ' to see all commands');
console.log('Type ' + 'oas help'.yellow + ' to see all commands');
process.exit();
};

Expand Down
20 changes: 20 additions & 0 deletions lib/docs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
var utils = require('../utils');

exports.swagger = true;
exports.swaggerUrl = true;
exports.login = true;
exports.desc = "Host your docs on ReadMe";
exports.category = "services";

exports.run = function(config, info) {
console.log("");
console.log("Success! ".green + "You can now access your Swagger from the following publicly sharable URL:");
console.log("");
console.log(" " + info.swaggerUrl + "?docs");
console.log("");
console.log("To use in ReadMe for documentation, follow the URL for setup information.");

utils.open(info.swaggerUrl + "?docs", info);

process.exit();
};
8 changes: 4 additions & 4 deletions lib/help.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ var _ = require('lodash');
exports.swagger = false;
exports.login = false;
exports.category = "basic";
exports.desc = "Learn what you can do with oai";
exports.desc = "Learn what you can do with oas";
exports.weight = 2;

exports.run = function(config, info) {
console.log("");
console.log("Usage: oai <command> [swagger url]");
console.log("Usage: oas <command> [swagger url]");
var files = glob.sync(path.join(__dirname, "*"));

var categories = {
Expand All @@ -35,7 +35,7 @@ exports.run = function(config, info) {

if(f.category) {
categories[f.category].commands.push({
text: " $".grey + pad(" oai " + action) + " " + info.grey,
text: " $".grey + pad(" oas " + action) + " " + info.grey,
weight: f.weight,
});
}
Expand All @@ -51,7 +51,7 @@ exports.run = function(config, info) {

console.log("");
console.log("Just getting started?".green);
console.log("Run " + "oai init".yellow + " to create your Swagger file.");
console.log("Run " + "oas init".yellow + " to create your Swagger file.");
console.log("");

process.exit();
Expand Down
4 changes: 2 additions & 2 deletions lib/init.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@ exports.run = function(config, info) {
console.log('');
console.log('For more information on this syntax, see https://github.com/readmeio/swagger-inline');
console.log('');
console.log('To see what you can do with your API, type ' + 'oai help'.yellow + '.');
console.log('To see what you can do with your API, type ' + 'oas help'.yellow + '.');
console.log('');
console.log('To publish your OAI file, type ' + 'oai host'.yellow + '!');
console.log('To publish your OAS file, type ' + 'oas host'.yellow + '!');
console.log('');

process.exit();
Expand Down
2 changes: 1 addition & 1 deletion lib/manage.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ exports.run = function(config, info) {
console.log("GRANT PUSH ACCESS".cyan);
console.log("Run the following command to add them (must match their GitHub email):");
console.log("");
console.log(" $ oai add [email protected]".grey);
console.log(" $ oas add [email protected]".grey);
console.log("");
console.log("");

Expand Down
12 changes: 7 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{
"author": "ReadMe <[email protected]> (http://readme.io)",
"name": "oai",
"name": "oas",
"description": "A collection of Open API Initiative (Swagger) tools",
"bin": {
"oai": "index.js"
"oas": "index.js"
},
"tags": [
"api",
"apis",
"swagger",
"open api initiative",
"open api spec",
"oai",
"oas",
"apidoc",
"microservice",
"documentation"
],
"version": "0.6.1",
"version": "0.6.2",
"repository": {
"type": "git",
"url": "git://github.com/readmeio/oai.git"
"url": "git://github.com/readmeio/oas.git"
},
"bugs": {
"url": "https://github.com/readmeio/oai/issues"
"url": "https://github.com/readmeio/oas/issues"
},
"main": "index.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ exports.findSwagger = function(cb, opts) {

if(!generatedSwagger['x-si-base']) {
console.log("We couldn't find a Swagger file.".red);
console.log("Run " + "oai init".yellow + " to get started.");
console.log("Don't worry, it's easy to get started! Run " + "oas init".yellow + " to get started.");
process.exit();
}

Expand Down

0 comments on commit 520edd1

Please sign in to comment.