We use Spectral at ReadMe and love that it's done to help clean up some API documentation of ours that had become a bit messy over the years. Here's the config file we use and some custom plugins I've written that help to ensure that we have: consistent sentence punctuation in descriptions, consistent usage of slug terminology, and incorporating Alex to ensure that our API docs have considerate and inclusive language.
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
const fetch = require('node-fetch'); | |
const cheerio = require('cheerio'); | |
const path = require('path'); | |
const token = '<TMDB API KEY>'; | |
const args = process.argv.slice(2); | |
const year = args.length ? args[0] : undefined; | |
if (!year) { | |
console.error(`USAGE: node ${path.basename(process.argv[1])} <YEAR>`); |
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
{ | |
"openapi" : "3.0.1", | |
"info" : { | |
"title" : "Find_Jobs", | |
"version" : "v2" | |
}, | |
"servers" : [ { | |
"url" : "https://httpbin.org" | |
}], | |
"security" : [ { |
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
<?php | |
namespace Vimeo\Controllers\Api; | |
use Vimeo\Api\Response\UserResponse; | |
class UserController extends \Vimeo\Controller | |
{ | |
/** | |
* @api-label Get a user | |
* @api-operationId get_user |
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
<?php | |
/** | |
* Safely get a value by key from an array (without creating a notice) | |
* @param array|object $array - can be an array or object | |
* @param int|string|array $keys - if array, performs a deep fetch on a multidemensional array|object | |
* @param mixed $default - if $keys do not exist in $array, this value is returned | |
* @return mixed - The value at $keys, or else $default | |
* @throws Exception if $keys is not a scalar or array | |
*/ |
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
<?php | |
class Lint extends \Illuminate\Console\Command { | |
/** | |
* The console command name. | |
* | |
* @var string | |
*/ | |
protected $name = 'command:lint'; |
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
{ | |
"description": "This is my Vagrant box, it's an example of what you can do with a custom Vagrant Cloud.", | |
"short_description": "This is my Vagrant box.", | |
"name": "myorg/mybox", | |
"versions": [ | |
{ | |
"version": "1.0.0", | |
"status": "active", | |
"description_html": null, | |
"description_markdown": "", |
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
my.customcloud/myorg/mybox | |
my.customcloud/myorg/mybox.json | |
my.customcloud/myorg/mybox/version | |
my.customcloud/myorg/mybox/version/1 | |
my.customcloud/myorg/mybox/version/1/provider | |
my.customcloud/myorg/mybox/version/1/provider/virtualbox.box |
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
<?php | |
/** | |
* Parse out a given string containing CSS and count up the total number of | |
* selectors that are present in it. | |
* | |
* @return integer | |
*/ | |
function countSelectors($css) { | |
$css = preg_replace('/\{(.*?)\}/s', '', $css); |