base on Terminal UI to list, browse and run APIs defined with openapi spec. ![logo](static/logo.png) # openapi-tui [![CI](https://github.com/zaghaghi/openapi-tui/workflows/CI/badge.svg)](https://github.com/zaghaghi/openapi-tui/actions) Terminal UI to list, browse and run APIs defined with OpenAPI v3.0 and v3.1 spec. # Usage ```bash ❯ openapi-tui --help This TUI allows you to list and browse APIs described by the openapi specification. Usage: openapi-tui --input <PATH> Options: -i, --input <PATH> Input file or url, in json or yaml format with openapi specification -h, --help Print help -V, --version Print version ``` ## Examples ```bash # open local yaml file ❯ openapi-tui -i examples/stripe/spec.yml # open local json file ❯ openapi-tui -i examples/petstore.json # open remote file ❯ openapi-tui -i https://raw.githubusercontent.com/github/rest-api-description/main/descriptions-next/api.github.com/api.github.com.yaml ``` # Demo ![demo](static/demo.gif) # Other Feature Animations <details> <summary>Show more</summary> ## Nested Components ![nested-refrences](static/nested-refs.gif) ## Fullscreen ![fullscreen](static/fullscreen.gif) ## Webhooks ![webhooks](static/webhooks.gif) ## Filter ![filter](static/filter.gif) ## Call Endpoints ![call](static/call.gif) ## Multiple Server Support ![call](static/switch-server.gif) </details> <br /> # Installation Install from source: ```bash ❯ cargo install openapi-tui ``` Or download pre-built artifact from release page. ## Docker Just run the application with docker. ```bash # open local file ❯ docker run --rm -ti -v$(pwd)/examples:/opt zaghaghi/openapi-tui -i /opt/petstore.json # open remote file ❯ docker run --rm -it zaghaghi/openapi-tui -i https://raw.githubusercontent.com/github/rest-api-description/main/descriptions-next/api.github.com/api.github.com.yaml ``` ## Distro Packages <details> <summary>Packaging status</summary> [![Packaging status](https://repology.org/badge/vertical-allrepos/openapi-tui.svg)](https://repology.org/project/openapi-tui/versions) </details> ### Arch Linux You can install using `pacman` as follows: ```bash ❯ pacman -S openapi-tui ``` ### NixOS You can install the `openapi-tui` package directly with the following command: ```bash nix profile install github:zaghaghi/openapi-tui ``` You can also install `openapi-tui` by adding it to your `configuration.nix` file. ```nix # flake.nix { inputs.openapi-tui.url = "github:zaghaghi/openapi-tui"; # ... outputs = {nixpkgs, ...} @ inputs: { nixosConfigurations.<your-hostname> = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; # this is the important part modules = [ ./configuration.nix ]; }; } } ``` Then, add `openapi-tui` to your `configuration.nix` ```nix # configuration.nix {inputs, pkgs, ...}: { environment.systemPackages = with pkgs; [ inputs.openapi-tui.packages.${pkgs.system}.openapi-tui ]; } ``` # Keybindings | Key | Action| |:----|:-----| | `→`, `l`| Move to next pane | | `←`, `h` | Move to previous pane | | `↓`, `j` | Move down in lists | | `↑`, `k` | Move up in lists | | `1...9` | Move between tabs | | `]` | Move to next tab | | `[` | Move to previous tab | | `f` | Toggle fullscreen pane| | `g` | Go in nested items in lists| | `q` | Quit| | `/` | Filter apis| | `:` | Run commands| | `Backspace`, `b` | Get out of nested items in lists| # Commands Main Page | Command | Description | |:--------|:------------| | `q` | Quit | | `request`, `r` | Go to request page| | `history` | Request history| # Commands Request Page | Command | Description | |:--------|:------------| | `q` | Quit | | `send`, `s` | Send request | | `query`, `q` | Add or remove query strings. sub-commands are `add` or `rm`. e.g. `query add page` | | `header`, `h` | Add or remove headers. sub-commands are `add` or `rm`. e.g. `header add x-api-key` | | `request`, `r` | Load request payload. e.g. `request open /home/hamed/payload.json` | | `response`, `s` | Save response payload e.g/ `response save /home/hamed/result.json` | # Environment Variables | Variable | Description | |:---------|:------------| | `OPENAPI_TUI_DEFAULT_SERVER` | Add a custom server url to the list of servers| # Implemented Features - [X] Viewer - [X] OpenAPI v3.1 - [X] Display Webhooks - [X] Display Info and Version - [X] Filter APIs - [X] Remote API specification - [X] Merge Parameters Based on `in` - [X] Pane Fullscreen Mode - [X] Nested Components - [X] Status Line - [X] Phone Page - [X] Call History - [X] Request Plain Editor - [X] Header Input (No Validation) - [X] Path Input (No Validation) - [X] Calling - [X] Plain Response Viewer (Status + Headers + Body) - [X] History viewer - [X] Refactor footer, add flash footer messages - [X] Import request body file - [X] Save response body and header - [X] Command history with ↑/↓ - [X] Support array query strings - [X] Suppert extra headers - [X] Support multiple servers # Backlog - [ ] Schema Types (openapi-31) - [ ] Display Key Mappings in Popup - [ ] Read Spec from STDIN - [ ] Request progress bar", Assign "at most 3 tags" to the expected json: {"id":"8505","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"