Skip to content
This repository has been archived by the owner on Dec 11, 2020. It is now read-only.

APItools/autoswagger.lua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 

Repository files navigation

autoswagger.lua

This Lua module can learn from a set of "raw" server traces and build a swagger spec with them.

It is intelligent enough to deduce common parameters from numbers or ids on the urls.

installation and usage

Copy the autoswagger folder inside your app. Then:

local autoswagger = require 'autoswagger' -- or 'autoswagger.init', depending on your package.path config

local brain = autoswagger.Brain:new()

brain:learn('GET', 'google.com', '/users/1/app/5')
brain:learn('GET', 'google.com', '/users/2/app/4')
brain:learn('GET', 'google.com', '/users/3/app/3')
brain:learn('GET', 'google.com', '/users/4/app/2')
brain:learn('GET', 'google.com', '/users/5/app/1')

brain:get_swagger('google.com') -- returns the swagger spec that the brain has learned from google.com. It probably includes /users/{user_id}/app/{app_id} as an operation.

specs

This project uses busted for its specs. Just execute busted inside the root of the repo.

About

Generate swagger specs from raw API traces

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages