Coder Social home page Coder Social logo

anbuksv / avantation Goto Github PK

View Code? Open in Web Editor NEW
83.0 2.0 15.0 12.81 MB

Build OpenAPI3.0 specification from HAR.

Home Page: https://avantation.in

License: MIT License

JavaScript 18.14% Batchfile 0.07% TypeScript 80.84% Shell 0.95%
avantation documentation-tool documentation-generator swagger-ui redoc openapi api-documentation api-documentation-tool static-site-generator

avantation's Introduction

Avantation

Version downloads license donation

avantation is a tool to generate an OpenAPI 3.0 specification from HTTP Archive format(HAR).

avantation is written and maintained by Anbarasan K ([email protected]).

Contributing

Bug reports and code and documentation patches are welcome.

Install

Direct downloads are available through the release page.

If you have Node installed on your computer just run npm install

npm install -g avantation

Features

  • HTTP sample code generation
  • Dynamic route path conversion
  • Schema generation
  • Supports json/yaml output formats
  • JWT authentication header mapping
  • Static-UI generation

Usage

Build OpenAPI specification from HAR.

USAGE
  $ avantation HAR

ARGUMENTS
  HAR  http archive(har) path

OPTIONS
  -b, --base-path=base-path                Separate the common path as base path from HTTP requests.
                                           Example:['api/v1']

  -h, --host=host                          Filter the http request from HAR and use it as server url in output.

  -j, --json                               Write output result in JSON format.

  -o, --out=out                            [default: ./openapi.yaml] Write output result at this DEST location.

  -r, --path-param-regex=path-param-regex  [default: ^([0-9]|[-$@!~%^*()_+])+$] Convert Regex matching params into dynamic path

  -s, --security-headers=security-headers  [default: {}] Map matching HTTP headers into security headers on request.

  -t, --template=template                  To override the default template pass the your template file location.

  --disable-tag                            Diable end points grouping based on route path in HAR

  --http-snippet                           Generate HTTP smaple code snippet for request and append it as 'x-code-sample' to OpenAPI path
                                           object.

Demo

Existing Projects

Existing Project Demo

Tools : Firefox | Chrome | Safari | Charles Proxy

New Projects

New Project Demo

Tools : Insomnia

User Interface's

Swagger-UI Redoc-UI

FAQ

How to generate Static-UI?

     avantation-ui bash script will help you to build static user interface for your specs but it's required redoc-cli.

avantation's People

Contributors

anbuksv avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

avantation's Issues

HAR file saved from Fiddler throws error

ServerService-GetNavigationMenu2-fiddler.zip
ServerService-GetNavigationMenu2-ff.zip

Hi,

When we try to generate OpenAPI specification from HAR file that is saved from Fiddler, it throws syntax error ---
SyntaxError: Unexpected token  in JSON at position 0
at JSON.parse ()
at Avantation.run (C:/Users/amit.potdar/AppData/Roaming/npm/node_modules/avantation/lib/index.js:31:20)
at Avantation._run (C:/Users/amit.potdar/AppData/Roaming/npm/node_modules/avantation/node_modules/@oclif/command/lib/command.js:43:31)

I've attached the HAR file for replication.

The command I used on Windows 10 OS ---- avantation.cmd ServerService-GetNavigationMenu2-fiddler.har

However, when we save HAR file from browser via dev tool, we could generate OpenAPI specification successfully. I saved the file from firefox browser --- avantation.cmd ServerService-GetNavigationMenu2-ff.har

The difference I could see is fiddler minifies HAR file and browser doesn't.

Can you check this?

Thanks,
Amit

Unexpected token e in JSON at position 0 at AvantationAPI.buildResponse

 Unexpected token e in JSON at position 0
    at JSON.parse (<anonymous>)
    at AvantationAPI.buildResponse (/media/storage/opensource/avantation/avantation/src/apis/avantation.ts:305:33)
    at AvantationAPI.buildEntry (/media/storage/opensource/avantation/avantation/src/apis/avantation.ts:93:43)
    at Array.forEach (<anonymous>)
    at AvantationAPI.run (/media/storage/opensource/avantation/avantation/src/apis/avantation.ts:60:30)
    at new AvantationAPI (/media/storage/opensource/avantation/avantation/src/apis/avantation.ts:54:14)
    at Avantation.run (/media/storage/opensource/avantation/avantation/src/index.ts:153:9)
    at Avantation._run (/media/storage/opensource/avantation/avantation/node_modules/@oclif/command/lib/command.js:29:31)

host and mimeType filtering preventing export of openapi

I have a har file with 7-8 different hosts in it. How do I process it with this tool? I want a single openapi if possible. OpenAPI 3.0 supports multiple hosts

if (!this.mimeTypes.includes(entry.response.content.mimeType)) {
this.oclif.warn(`Skipping invalid mimeType:${entry.response.content.mimeType} @${url.href} in response.`);
return;
}
if (url.host !== this.host || !url.pathname.includes(this.basePath)) {
this.oclif.warn(`Skipping invalid url ${url.href}`);
return; //simply ignore invalid url match
}

OpenAPI v3.1.0

Hello there! I'm making isues for all of the tools we've got listed on www.openapi.tools to see what folks are planning to do about OpenAPI v3.1.0 support. It's got some cool new functionality, like the OpenAPI Schema objects being entirely compatible with JSON Schema now!

Here's an article about the changes for the user perspective, and it sbhould highlight some useful tips for tooling vendors too.

https://www.openapis.org/blog/2021/02/16/migrating-from-openapi-3-0-to-3-1-0

If you get it upgraded please shout out, and I'll update it on openapi.tools.

Error on running with Deno

$ cat avantation.js
import "https://deno.land/std/node/module.ts";
import avantation from "https://dev.jspm.io/npm:[email protected]"
avantation.run()

$ deno run --unstable --allow-read --allow-net --allow-env avantation.js
Check file:///home/user/src/Deno_Land/avantation.js
error: Uncaught Error: Cannot find module 'https:/dev.jspm.io/npm:@oclif/[email protected]/package.json'
    var e = new Error("Cannot find module '" + id + "'");
            ^
    at _nullRequire (https://dev.jspm.io/npm:@oclif/[email protected]/lib/index.dew.js:14:13)
    at checkNodeVersion (https://dev.jspm.io/npm:@oclif/[email protected]/lib/index.dew.js:40:19)
    at dew (https://dev.jspm.io/npm:@oclif/[email protected]/lib/index.dew.js:48:3)
    at dew (https://dev.jspm.io/npm:[email protected]/lib/index.dew.js:15:21)
    at https://dev.jspm.io/npm:[email protected]:2:16

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.