Giter VIP home page Giter VIP logo

insomnia-documenter's Introduction

Insomnia Documenter

Like Postman Documenter but for Insomnia! With this tool you can generate beautiful API documentation pages using your Insomnia export file.

Demo: https://insodoc.github.io/insomnia-documenter/
Tutorial and demo video: https://www.youtube.com/watch?v=pq2u3FqVVy8

Table of Contents

Requirements

  • Node.js (8.x or higher is recommended)
  • An exported Insomnia workspace JSON (v4)

Getting Started

Insomnia Documenter offers a CLI tool to make it super easy to set up a documentation page. You can use it in two ways.

Using npx

npx insomnia-documenter --config /path/to/insomnia/config.json

By installing the package globally

npm i -g insomnia-documenter
insomnia-documenter --config /path/to/insomnia/config.json

Options

Options:
  -c, --config <location>  Location of the exported Insomnia JSON config.
  -l, --logo <location>    Project logo location (48x48px PNG).
  -f, --favicon <location>    Project favicon location (ICO).
  -o, --output <location>  Where to save the file (defaults to current working directory).
  -h, --help               output usage information

Using a GitHub release

Alternatively, you can start using Insomnia Documenter by downloading a release archive from GitHub and adding your insomnia.json export file to the root directory of your site.

Updating the API

Updating the API is super simple! Since Insomnia Documenter is a plug-and-play web app, you can just replace your insomnia.json with your new exported JSON file. Just make sure it's called insomnia.json.

The same actually applies to the logo (logo.png) e favicon (favicon.ico) as well .

Custom Root Paths

Maybe you want to document multiple APIs on the same domain? Perhaps you want to host your documentation page on GitHub pages? In this (any many other cases), you will need to specify what the root path is. To do this, you have to open index.html and replace the following line:

<div id="app"></div>

with something like this:

<div id="app" data-root="/path/to/docs"></div>

In this case, the app will pick up the insomnia.json file from the /path/to/docs directory. This gives you more flexibility over how you want to maintain your documentation page (for example, you can store the export file somewhere other than the root directory of the webpage). You should NOT put a trailing slash in the data-root property.

Please note that setting this attribute will not affect the favicon and the logo of the page. They will still be loaded from the same directory where index.html is.

Running the Page Locally

Opening the index.html file will fail to load in 99.9% of cases because that's just how fetch works. To preview the page locally, you might want to use a tool such as zeit/serve:

npx serve

The page will be available at http://localhost:5000.

Insomnia Plugin

devhammed has made an awesome Insomnia Plugin that allows you to generate a documentation page directly from Insomnia's interface. Get The Plugin (npm - github)

Changelog

Please see the Changelog document.

Contribution

The CLI tool is a commander applet, while the frontend itself is a Svelte app. This project is still in beta, which means it has bugs and can be improved here and there. Contribution is most welcome :)

Clone the repository:

git clone [email protected]:jozsefsallai/insomnia-documenter.git
cd insomnia-documenter

Install the dependencies:

npm install

Copy the demo Insomnia export file:

cp docs/insomnia.json public/insomnia.json

Run a development build with hot reload:

npm run dev

Create a production build:

npm run build

Linting:

npm run lint

Testing:

npm run test

License

MIT.

Note: this project is not affiliated with Kong and/or Insomnia.

Insomnia Documenter for enterprise

Available as part of the Tidelift Subscription

The maintainers of Insomnia Documenter and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.

insomnia-documenter's People

Contributors

arnaudlier avatar badmask121 avatar dependabot[bot] avatar devhammed avatar dippi avatar ecarreras avatar farzeni avatar jozsefsallai avatar kesleydavid avatar mehrdadx10 avatar michaelbaudino avatar psychokiller1888 avatar wavpro 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

insomnia-documenter's Issues

Run-in-insomnia button

First, I just want to say that this project is awesome! It's so cool to see things like this start to come out of the community 🥳

Was taking a look at the demo you have up and thought it might be cool to include a "Run in Insomnia" button. Feel free to ignore this suggestion if you don't think it's a good fit.

https://support.insomnia.rest/article/68-run-button

specify RESPONSE codes

To document example response, we rely with the tags:

<! --RESPONSE -->
<! -- ENDRESPONSE -->

However, we may add specific responses, like 200 response, 401 response, 404 response.

Is it possible to add custom tags like:

Rewrite it in Vue

I plan on rewriting the project in Vue, since I find it a lot more mature and usable than Svelte. Sure, Svelte is nice and all, but removing abstractions like this is what actually makes it less fun and more awkward to use as a framework. It would also be nice to see which one would actually do better in terms of performance.

Of course, the old Svelte version will be available in a separate branch.

Convert to Insomnia Plugin

Good job so on this tool but since Insomnia now supports plugin, I feel the CLI can be converted to a plugin and now this opens the door to many possibilities e.g fixing #4 , #14 would not be an issue.

Response data using "function to perform" options

Hello, excellent tool, I have a question.
it is possible to create the response example, using the tag options "function to perform"

example:

action to perform

and with the following options
option tag

but when generating the documentation, it appears as follows
response doc page

Thank you!.
my apologies for the horrible english translation 😞

Insomnia Rest 7.1.1
[email protected]

Python request display

The payload is really weird to say the least:

import requests

url = 'http:///api/v1.0.1/dialog/say/'
headers = {
    "auth": ""
}
payload = '-----011000010111000001101001\nContent-Disposition: form-data; name=\"text\"\n\nI'm speaking through the API\n-----011000010111000001101001\nContent-Disposition: form-data; name=\"siteId\"\n\ndefault
-----011000010111000001101001--'

response = requests.request('POST', url, data=payload, headers=headers)
print(response.text)

This is on rendered pages when selecting python. Funny part is that it was also on Postman bug tracker

Handle Parameters section with POST and PATCH methods

It would be great to be able to display the parameters UI section for POST and PATCH query as you are currently doing with GET query. The idea would be to specify the mandatory and optional parameters with a short description.

Capture d’écran 2020-09-30 à 10 45 45

I know there is no direct way to handle this with Insomnia but maybe using a similar pattern than the response query in the docs tab ?

Example response not parsed

Example responses are not parsed despite being wrapped between <!-- RESPONSE --> and <!-- ENDRESPONSE --> tags.

How to deploy to github pages?

Hello. I have used this resource to deploy my insomnia workspaces many times in ZEIT easily using now command, as used in video tutorial. At this time, I'm trying to deploy the docs in gh-pages, but almost as expected, gh-pages services can't read cuz they don't have a server(I think...). How to deploy on gh-pages like in README.md example in this repo? This reply would be a good information for future new users that's wanna do the same.

Screenshot from 2020-07-28 20-23-57

Cannot read property 'getAttribute' of null

With the latest version, I currently get this error in my browser console.

bundle.js:6 Uncaught (in promise) TypeError: Cannot read property 'getAttribute' of null
    at bundle.js:6
    at bundle.js:6
    at bundle.js:6

Could this be resolved?

Thanks again!

Raw content data support.

Insomnia-documenter is a greate tool.

When I deploy the web page to the public network. I realize that the "insomnia.json" file authorization is a big problem. In my app, only allow logged users to access files.

So, is there any plan to support reading raw data? Like:

<div id="app" data-raw="{"_type":"export","__export_format":4,"__export_date":"2021-08-19T ...."></div>

Thanks very much.

Option to not include cookies in documentation

My Insomnia export includes a session cookie which is not important and is confusing my users. Would it be possible for an option to be added where all cookies are ignored when generating the documentation?

SyntaxError: JSON.parse: expected double-quoted property name at line 6 column 2 of the JSON data

Exported JSON

{
  "_type": "export",
  "__export_format": 4,
  "__export_date": "2020-07-13T16:39:23.109Z",
  "__export_source": "insomnia.desktop.app:v2020.2.2",
  "resources": [
    {
      "_id": "req_856347570f3f4d53910448b670f8df84",
      "authentication": {},
      "body": {},
      "created": 1594656381351,
      "description": "Any microservice which docs with assets should send a message to this topic, to register as a asset processor\n",
      "headers": [],
      "isPrivate": false,
      "metaSortKey": -1594656381351,
      "method": "HEAD",
      "modified": 1594657204728,
      "name": "insomniadocs.topic.asset-processor-registration",
      "parameters": [],
      "parentId": "fld_6482976752314abb95decc7bd4b3fd31",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "",
      "_type": "request"
    },
    {
      "_id": "fld_6482976752314abb95decc7bd4b3fd31",
      "created": 1594656340046,
      "description": "",
      "environment": {},
      "environmentPropertyOrder": null,
      "metaSortKey": -1594656340046,
      "modified": 1594656340046,
      "name": "MQ",
      "parentId": "wrk_6596657b2cb94d6ab4ffffc07363bf15",
      "_type": "request_group"
    },
    {
      "_id": "wrk_6596657b2cb94d6ab4ffffc07363bf15",
      "created": 1593518841588,
      "description": "",
      "modified": 1593518841588,
      "name": "insomnia docs",
      "parentId": null,
      "scope": null,
      "_type": "docspace"
    },
    {
      "_id": "req_d8f2203d26cc4b61942ed68eacd99ff4",
      "authentication": {},
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"action\": \"upload\",\n\t\"data\": {\n\t\t\"asset_id\": \"123234-324-234-24\",\n\t\t\"action\": \"upload\",\n\t}\n}"
      },
      "created": 1594656454772,
      "description": "",
      "headers": [
        {
          "description": "",
          "id": "pair_9c95bf9102d0445e84c285963378f976",
          "name": "Content-Type",
          "value": "application/json"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1594654555720.5,
      "method": "HEAD",
      "modified": 1594658299339,
      "name": "insomniadocs.topic.assets",
      "parameters": [],
      "parentId": "fld_6482976752314abb95decc7bd4b3fd31",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "",
      "_type": "request"
    },
    {
      "_id": "req_a44559bf8b8f4cf6abd03f42d9572b61",
      "authentication": {},
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"data\": {\n\t\t\"asset_id\": \"123234-324-234-24\",\n\t\t\"dim\" : \"thumbnail\"\n\t}\n}"
      },
      "created": 1594656588190,
      "description": "the resizer micoservice add message to the topic, so the assets can be reloaded and the database can be updated",
      "headers": [
        {
          "description": "",
          "id": "pair_7bdaa2a8f9664e8eb756413fef862b27",
          "name": "Content-Type",
          "value": "application/json"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1594653642905.25,
      "method": "HEAD",
      "modified": 1594658307045,
      "name": "insomniadocs.topic.resize",
      "parameters": [],
      "parentId": "fld_6482976752314abb95decc7bd4b3fd31",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "",
      "_type": "request"
    },
    {
      "_id": "req_a863166a921c45eca74a65dcb073d051",
      "authentication": {},
      "body": {},
      "created": 1594650859202,
      "description": "hitting this url will send a message to the message broker",
      "headers": [],
      "isPrivate": false,
      "metaSortKey": -1594650596617,
      "method": "PUT",
      "modified": 1594657601617,
      "name": "Uploaded Message from client",
      "parameters": [],
      "parentId": "fld_58892fc116be44e594eba7f82ad457dc",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "https://api.insomniadocs.in/uploaded/key",
      "_type": "request"
    },
    {
      "_id": "fld_58892fc116be44e594eba7f82ad457dc",
      "created": 1594650491093,
      "description": "",
      "environment": {},
      "environmentPropertyOrder": null,
      "metaSortKey": -1594650491094,
      "modified": 1594650491093,
      "name": "node-api",
      "parentId": "fld_c0337163ac8b4dcc9bdf3dc87c4bcd6f",
      "_type": "request_group"
    },
    {
      "_id": "fld_c0337163ac8b4dcc9bdf3dc87c4bcd6f",
      "created": 1594650484302,
      "description": "",
      "environment": {},
      "environmentPropertyOrder": null,
      "metaSortKey": -1594650484302,
      "modified": 1594650484302,
      "name": "Node",
      "parentId": "wrk_6596657b2cb94d6ab4ffffc07363bf15",
      "_type": "request_group"
    },
    {
      "_id": "req_0b371ff1439a4dd29eb9777d38dcd76b",
      "authentication": {},
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"path\": \"/s3/object/path\"\n}"
      },
      "created": 1594650596567,
      "description": "Getting Signed URLs to access S3 objects\n\n<!--RESPONSE-->\n{\n  \"putUrl\": \"https://insomnia-docs.s3.ap-south-1.amazonaws.com//s3/object/path?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAZQB5MH3LCF3FXI4C%2F20200713%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20200713T143216Z&X-Amz-Expires=900&X-Amz-Signature=bd5ce1c7f3251ce5240164d89f963d0f2d25a52a38c746a7bb80cec662b40928&X-Amz-SignedHeaders=host\",\n  \"getUrl\": \"https://insomnia-docs.s3.ap-south-1.amazonaws.com//s3/object/path?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAZQB5MH3LCF3FXI4C%2F20200713%2Fap-south-1%2Fs3%2Faws4_request&X-Amz-Date=20200713T143216Z&X-Amz-Expires=900&X-Amz-Signature=89a86d4e6dd04b449da25273747ae94748d995f36ed5be5c38ce760cb6e92518&X-Amz-SignedHeaders=host\"\n}\n\n<!-- ENDRESPONSE -->\n\n\n",
      "headers": [
        {
          "description": "required",
          "id": "pair_f3b4af3ddde54efc8ac3c380ffe8c98c",
          "name": "Content-Type",
          "value": "application/json"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1594650596567,
      "method": "POST",
      "modified": 1594650828482,
      "name": "Getting signed s3 urls",
      "parameters": [],
      "parentId": "fld_58892fc116be44e594eba7f82ad457dc",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "https://api.insomniadocs.in/signed-urls",
      "_type": "request"
    },
    {
      "_id": "req_6a7c704040b24484ae677d17b7c01dc1",
      "authentication": {},
      "body": {},
      "created": 1594650501632,
      "description": "Heartbeat endpoint",
      "headers": [],
      "isPrivate": false,
      "metaSortKey": -1594650501632,
      "method": "GET",
      "modified": 1594650563341,
      "name": "Heartbeat",
      "parameters": [],
      "parentId": "fld_58892fc116be44e594eba7f82ad457dc",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "https://api.insomniadocs.in",
      "_type": "request"
    },
    {
      "_id": "req_2bc960baead545c696f1872ceae7d44e",
      "authentication": {},
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\n\t\"action\": \"upload\",\n\t\"path\": \"/s3/object/path\",\n\t\"type\": \"image/jpeg\",\n  \"name\": \"some-image.jpg\",\n  \"team_id\": \"insomnia-docs\",\n\t\"account_id\": 1\n}"
      },
      "created": 1594652730090,
      "description": "adds message to `insomniadocs.topic.assets`\n\n<!-- RESPONSE --> \n\n{\n  \"data\": \"OK\",\n  \"type\": \"upload\"\n}\n\n<!-- ENDRESPONSE -->",
      "headers": [
        {
          "description": "",
          "id": "pair_445bc526b14f40cc819608953d762934",
          "name": "Content-Type",
          "value": "application/json"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1594652730090,
      "method": "HEAD",
      "modified": 1594658325524,
      "name": "upload",
      "parameters": [],
      "parentId": "fld_25b179a4f25243efa518dba9cb7b84ee",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "",
      "_type": "request"
    },
    {
      "_id": "fld_25b179a4f25243efa518dba9cb7b84ee",
      "created": 1594651121597,
      "description": "",
      "environment": {},
      "environmentPropertyOrder": null,
      "metaSortKey": -1594084667237.5,
      "modified": 1594651128853,
      "name": "websocket",
      "parentId": "wrk_6596657b2cb94d6ab4ffffc07363bf15",
      "_type": "request_group"
    },
    {
      "_id": "req_81073e8d01ba486898530eb5f3f610d7",
      "authentication": {},
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"action\": \"getPath\",\n\t\"text\": \"Hello, world\"\n}"
      },
      "created": 1594652986383,
      "description": "returns SVG path data\n\n<!-- RESPONSE --> \n\n{\n  \"data\": {\n    \"path\": \"M .... 0\",\n  }\n  \"type\": \"getPath\"\n}\n\n<!-- ENDRESPONSE -->",
      "headers": [
        {
          "description": "",
          "id": "pair_b6b8b6400a9842218b8ad428ee4f2a6b",
          "name": "Content-Type",
          "value": "application/json"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1594652027668,
      "method": "HEAD",
      "modified": 1594658331313,
      "name": "getPath",
      "parameters": [],
      "parentId": "fld_25b179a4f25243efa518dba9cb7b84ee",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "",
      "_type": "request"
    },
    {
      "_id": "req_1c5ff273f9384a44a9e2e06b1423985b",
      "authentication": {},
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"action\": \"notify-room\",\n\t\"roomId\": \"insomnia-docs\",\n\t\"message\": {\n  \t\"type\" : \"reload-assets\",\n\t\t\"reloadAssets\" : true\n\t}\n}"
      },
      "created": 1594651325246,
      "description": "Notifys all connections of`roomId`\n\n<!-- RESPONSE -->\n\n{\n  \"data\": \"OK\",\n  \"type\": \"notify-room\"\n}\n\n<!-- ENDRESPONSE -->",
      "headers": [
        {
          "id": "pair_60a2c3a0c76b48dfb16e9063f8e17bdf",
          "name": "Content-Type",
          "value": "application/json"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1594651325246,
      "method": "HEAD",
      "modified": 1594657216205,
      "name": "notify-room",
      "parameters": [],
      "parentId": "fld_25b179a4f25243efa518dba9cb7b84ee",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "",
      "_type": "request"
    },
    {
      "_id": "req_90f0d1071bc744c6bf657d7a760ab3f0",
      "authentication": {},
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"action\": \"join-room\",\n\t\"roomId\": \"wrikle-docs\" \n}\n"
      },
      "created": 1594651159317,
      "description": "JOIN ROOM and notifys all the connections about new connection\n\n<!-- RESPONSE -->\n\n{\n  \"data\": \"JOINED\",\n  \"type\": \"join-room\",\n}\n\n<!-- ENDRESPONSE -->",
      "headers": [
        {
          "id": "pair_3baf9bfb42ce4189989fe70e183e289d",
          "name": "Content-Type",
          "value": "application/json"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1594651325196,
      "method": "HEAD",
      "modified": 1594657219768,
      "name": "join-room",
      "parameters": [],
      "parentId": "fld_25b179a4f25243efa518dba9cb7b84ee",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "wss://app.insomniadocs.in/ws",
      "_type": "request"
    },
    {
      "_id": "env_96985cafbb53e0d1ed6171826e41c02741f8f414",
      "color": null,
      "created": 1593518841731,
      "data": {},
      "dataPropertyOrder": null,
      "isPrivate": false,
      "metaSortKey": 1593518841732,
      "modified": 1593518841731,
      "name": "Base Environment",
      "parentId": "wrk_6596657b2cb94d6ab4ffffc07363bf15",
      "_type": "environment"
    },
    {
      "_id": "jar_96985cafbb53e0d1ed6171826e41c02741f8f414",
      "cookies": [],
      "created": 1593518841738,
      "modified": 1593518841738,
      "name": "Default Jar",
      "parentId": "wrk_6596657b2cb94d6ab4ffffc07363bf15",
      "_type": "cookie_jar"
    },
    {
      "_id": "spc_70d7e63ecff645efa9a3d57eb5b7d3a8",
      "contentType": "yaml",
      "contents": "",
      "created": 1593518841596,
      "fileName": "insomnia docs",
      "modified": 1593518841596,
      "parentId": "wrk_6596657b2cb94d6ab4ffffc07363bf15",
      "_type": "api_spec"
    }
  ]
}

Complete error:

SyntaxError: JSON.parse: expected double-quoted property name at line 6 column 2 of the JSON data
    __parseJSON golang.js:61
    parse index.js:24
    body content.js:6
    Ye Table.svelte:17
    nt Request.svelte:129
    ne index.mjs:1287
    at Request.svelte:40
    pt Group.svelte:13
    ht Rows.svelte:16
    gt Rows.svelte:16
    ne index.mjs:1287
    mt Rows.svelte:12
    dt Group.svelte:31
    ht Rows.svelte:16
    gt Rows.svelte:16
    ne index.mjs:1287
    mt Rows.svelte:12
    sn Select.svelte:453
    ne index.mjs:1287
    cn Content.svelte:9
    hn Content.svelte:36
    ne index.mjs:1287
    fn App.svelte:59
    app cuteConfig.js:62

cannot access insomnia,json

Hello, i am having a problem when running the documentation at localhost the page telling me that "It looks like it's not possible to retrieve the contents of the API documentation at the moment. ". The console browser give me this :
image

I also have tried to generate documentation (with the very same steps) on another project and it was perfectly fine.

unable to read insomnia.json

I have an insomnia.json file, its about 3198 lines long. Is there a limit to the size of the json file? I tested with 2 other json exports from the same Insomnia and they had no issues displaying.

thanks

Error displaying app

Error in console:

main.js:35 TypeError: Cannot read property 'replace' of null
    at Re (formatEnv.js:2)
    at content.js:89
    at Array.forEach (<anonymous>)
    at ze.headers (content.js:86)
    at Ye (Request.svelte:103)
    at at (Request.svelte:102)
    at ne (index.mjs:1287)
    at new ot (Request.svelte:81)
    at Array.gt (Rows.svelte:16)
    at ft (Rows.svelte:12)

Website deployed with github-actions on https://project-alice-assistant.github.io/api/
App tag is replaced with GH actions

I had the same on my computer when localhost

Insomnia export is a v4 json export

Demo Page 404 on README.md

I would like to see how does insomnia-documenter exports but the demo at the readme.md isn't working.
image

Cannot use Insomnia Tags

Hello. First of all, Thanks For So Best App!!!)))

When i use Insomnia Tags for fill response body or query params (with JsonPath from another request), I get a tag flag as string
like a

### Пример ответ
<!-- RESPONSE -->
    ```
{% response 'raw', 'req_6f556f2bae314b9591e79fdcbce9754c', '', 'always', 60 %}
    ```
<!-- ENDRESPONSE -->

Tag Screen
Tag Screen

Result Screen

Is it possible to fix this???

Error in export Json V4

main.js:35 SyntaxError: Unexpected token q in JSON at position 10
at JSON.parse ()
at Re.__parseJSON (content.js:14)
at Re.parse (content.js:50)
at qe.body (content.js:110)
at Ye (Request.svelte:106)
at rt (Request.svelte:105)
at ne (index.mjs:1287)
at new it (Request.svelte:80)
at Array.ht (Rows.svelte:16)
at gt (Rows.svelte:12)

insomnia.zip

FormatEnv function throws an error when url for some requests are empty

I had a request without an endpoint when served using vercel it throws an error
Screenshot 2021-06-18 at 12 25 41 AM

I looked at the codebase on GitHub and realized formatEnv in Request.svelte was looking up request.url and in one of my API request i had an empty URL input

Screenshot 2021-06-18 at 12 38 53 AM

I believe there should be a better way for handling null values for looking up environment variables.

i'll creeate a PR suggesting a fix for this

Change <!-- RESPONSE --> to // RESPONSE inside a code block comment

There is a problem when documenting an example response.

Actually works like:

<!-- RESPONSE -->
{
... data
}
<!-- ENDRESPONSE -->

But the problem with that is looks ugly and not readable in Insomina Docs tab, without format.

I suggest change it to:

// RESPONSE
{
    ... data
}

all inside a codeblock.

In that form the markdown format preserves in the Insomnia doc tab and will still appear at the right panel as response example in the generated documentation.

[Bug] Enviroments render error

Hi, Enviroment {{host}} in url and {{AuthInternal}} in headers didn't rendered correctly.

This is the data I exported.

{
  "_type": "export",
  "__export_format": 4,
  "__export_date": "2020-01-20T05:54:54.582Z",
  "__export_source": "insomnia.desktop.app:v7.0.6",
  "resources": [
    {
      "_id": "req_d724d8db1e384ed3b364832f34bdb411",
      "authentication": {
        "disabled": true,
        "token": "",
        "type": "bearer"
      },
      "body": {
        "mimeType": "application/json",
        "text": "{\n\t\"symbol\": \"\",\n\t\"ipo_name\": [\"TX-002-IPO\"],\n\t\"page\": 1,\n\t\"per_page\": 10,\n\t\"start_date\": \"2020-01-01\",\n\t\"end_date\": \"2020-02-01\"\n}"
      },
      "created": 1576052448832,
      "description": "",
      "headers": [
        {
          "description": "",
          "disabled": false,
          "id": "pair_003121b0bf4c487880ceba2082aacc1a",
          "name": "Authorization",
          "value": "{{ AuthInternal  }}"
        }
      ],
      "isPrivate": false,
      "metaSortKey": -1575341882669.5,
      "method": "GET",
      "modified": 1579254584984,
      "name": "ipo search",
      "parameters": [],
      "parentId": "wrk_c933e28b674d44549e567514ef217307",
      "settingDisableRenderRequestBody": false,
      "settingEncodeUrl": true,
      "settingFollowRedirects": "global",
      "settingRebuildPath": true,
      "settingSendCookies": true,
      "settingStoreCookies": true,
      "url": "{{ host  }}/internal/api/v1/ipo/search?ipo_name=01911-IPO",
      "_type": "request"
    },
    {
      "_id": "wrk_c933e28b674d44549e567514ef217307",
      "created": 1575340895113,
      "description": "",
      "modified": 1579082458535,
      "name": "Customer",
      "parentId": null,
      "_type": "workspace"
    },
    {
      "_id": "env_3bfa825369fc4f65bd77f0e7265b40d5",
      "color": null,
      "created": 1575965028661,
      "data": {
        "AuthH5": "Bearer 1111",
        "AuthInternal": "Bearer 2222",
        "AuthInternalBos": "Basic 3333",
        "host": "https://test.foo.com"
      },
      "dataPropertyOrder": {
        "&": [
          "host",
          "AuthH5",
          "AuthInternalBos",
          "AuthInternal"
        ]
      },
      "isPrivate": false,
      "metaSortKey": 1,
      "modified": 1579497604088,
      "name": "StagingGZ",
      "parentId": "env_8dd061095c33eafccd1c8a21521cfe0a8cba7f30",
      "_type": "environment"
    }
  ]
}

View Response Data in Documentation?

Hi, first of all this is a beautiful application so thank you for making it!

I just wanted to know if there was a way to view the response data in the documentation, for example what an example response would be.

What would be the best method to include that in the API doc be?

Thank you!

CORS error, when running from file.

Hey,
The demo seems nice, but when I'm trying to run by clicking index.html I get Cross Origin Request Block, cause file:///insomnia.json isn't on the same origin as the .js file.

To be honest, cause I want it to run in production, I put it to our Apache server and there I got
SyntaxError: "JSON.parse: unexpected character at line 1 column 1 of the JSON data".
Tried to use the Release downloaded from GitHub, the NPX package and also the Global installed NPM package.
Also,
üdvözlet, BP-ről, remélem minél hamarabb futhat ez a csodás tool prod-ban nálunk is, keep it up :)

Github Pages Deployment steps

Hey, I am trying to deploy my documentation through GitHub pages, and am confused about how to do it. I think we could add more elaborate steps in the documentation about this. It'll be really helpful, as in my deployment it just shows a blank page,

Display info.description

Hi everyone!

Before anything else ¡Thank u very much 4 this beatiful app!

Now i'm adding description under the info section. But when i try to insomnia documenter i'm only getting the requests. I'm not able to see the servers, info ands schemas section. Is there any setup i should do?

Here is how it looks in my local insomnia

Captura de Pantalla 2022-06-01 a la(s) 13 00 09

And this is the result after insominia-documenter
Captura de Pantalla 2022-06-01 a la(s) 13 00 28

How can i get the servers, info and schemas sections?

thanks 4 the support.

Query and header documentation

Insomnia allows to include description for query parameters and headers. I think it would be great if those were documented too.

image

Converting to Static Site

How could I setup the generated Svelte site to support npm run build in order to output a pure static version of the documentation?

Add support for nested environment variables

First of all, good job on this tool but I am currently using a nested environment variables structure for an API I am developing but the merging always conflicts with the base settings for endpoint...You can check it out here: https://fanfaro-accounting-api-docs.vercel.app

Base Settings:

{
  "base": "http://fanfaro.test/api"
}

Folder Settings (e.g auth):

{
  "base": "{{ base }}/auth"
}

Insomnia Documenter Output:

http://fanfaro.test/api

Expected Output:

http://fanfaro.test/api/auth


This works fine in the Insomnia app.

JSON.parse SyntaxError since 0.4.4

Hello there!

The generator since version 0.4.4 is throwing error Uncaught SyntaxError: Unexpected token in JSON at position 2764 with the insomnia.json file below (though it import correctly in Insomnia app and also works in version 0.4.3):

{"_type":"export","__export_format":4,"__export_date":"2021-01-19T08:26:15.602Z","__export_source":"insomnia.desktop.app:v2020.5.2","resources":[{"_id":"req_d3a7868acd2d4c2baa1808ea1efc49d4","parentId":"fld_99f32bcae3c34cb7b995f62366560549","modified":1611044671451,"created":1611044671451,"url":"{{ base_url }}/surveys","name":"GetSurveys","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"Admin-Token","value":"{{ administrator.token }}","description":"","id":"pair_d76b9d0a0156442aa58bf141cab64bc2"}],"authentication":{},"metaSortKey":-1606833245833,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_99f32bcae3c34cb7b995f62366560549","parentId":"fld_4fd02f68cf00457f950610a091b0c7d3","modified":1606836884702,"created":1606832899101,"name":"Surveys","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-999999975,"_type":"request_group"},{"_id":"fld_4fd02f68cf00457f950610a091b0c7d3","parentId":"wrk_a58dbb58449f43928aebb88192101a91","modified":1606836830731,"created":1606836830720,"name":"Administration","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1000000000,"_type":"request_group"},{"_id":"wrk_a58dbb58449f43928aebb88192101a91","parentId":null,"modified":1606832665458,"created":1606832590082,"name":"Survey","description":"","scope":null,"_type":"workspace"},{"_id":"req_e033048f93b84135b613c1c9bb911e24","parentId":"fld_16e8e4700e63418ba935eff07b06d9b4","modified":1608309726232,"created":1606833746449,"url":"{{ base_url }}/{surveyId}/pages","name":"GetPages","description":"","method":"GET","body":{},"parameters":[],"headers":[{"name":"Admin-Token","value":"{{ administrator.token }}","description":"","id":"pair_aac4458f06db41858bf2119caa73b16f"}],"authentication":{},"metaSortKey":-1606833746449,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_16e8e4700e63418ba935eff07b06d9b4","parentId":"fld_4fd02f68cf00457f950610a091b0c7d3","modified":1606836878158,"created":1606833742115,"name":"Pages","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1000000025,"_type":"request_group"},{"_id":"req_1126487208be4840aa158e73d0c2c58e","parentId":"fld_653a28282362407bb92d5dbf6ea2d172","modified":1611044697399,"created":1611044697399,"url":"{{ base_url }}/administrator/session","name":"CreateSession","description":"","method":"POST","body":{"mimeType":"application/json","text":"{\n\t\"username\": \"{{ administrator.userame }}\",\n\t\"password\": \"{{ administrator.password }}\"\n}"},"parameters":[],"headers":[{"name":"Content-Type","value":"application/json","id":"pair_730eb2bcd7524a4192df6536e82e5518"}],"authentication":{},"metaSortKey":-1606835358452,"isPrivate":false,"settingStoreCookies":true,"settingSendCookies":true,"settingDisableRenderRequestBody":false,"settingEncodeUrl":true,"settingRebuildPath":true,"settingFollowRedirects":"global","_type":"request"},{"_id":"fld_653a28282362407bb92d5dbf6ea2d172","parentId":"fld_4fd02f68cf00457f950610a091b0c7d3","modified":1606836872222,"created":1606836790274,"name":"Session","description":"","environment":{},"environmentPropertyOrder":null,"metaSortKey":-1000000075,"_type":"request_group"},{"_id":"env_800ccb2e8347e5b93c470fb4e3762c9fbfd3242e","parentId":"wrk_a58dbb58449f43928aebb88192101a91","modified":1606858393882,"created":1606832590172,"name":"Base Environment","data":{"base_url":"","administrator":{"userame":"","password":"","token":""}},"dataPropertyOrder":{"&":["base_url","administrator"],"&~|administrator":["userame","password","token"]},"color":null,"isPrivate":false,"metaSortKey":1606832590172,"_type":"environment"},{"_id":"jar_800ccb2e8347e5b93c470fb4e3762c9fbfd3242e","parentId":"wrk_a58dbb58449f43928aebb88192101a91","modified":1606837170275,"created":1606832590175,"name":"Default Jar","cookies":[{"key":"PHPSESSID","value":"qb5jd2023s5bjpclv9f3udjbqj","domain":"api.carenity.test7","path":"/","hostOnly":true,"creation":"2020-12-01T15:39:30.269Z","lastAccessed":"2020-12-01T15:39:30.269Z","id":"36095498947206206"}],"_type":"cookie_jar"},{"_id":"spc_d5bd08f434f54e14805db1e120d8337a","parentId":"wrk_a58dbb58449f43928aebb88192101a91","modified":1606832590084,"created":1606832590084,"fileName":"Insomnia","contents":"","contentType":"yaml","_type":"api_spec"},{"_id":"env_6ee0ecb85e8b4236ae5a9497c2fae807","parentId":"env_800ccb2e8347e5b93c470fb4e3762c9fbfd3242e","modified":1611044461604,"created":1606858176670,"name":"dev","data":{"base_url":"http://api.dev.test7","administrator":{"userame":"","password":"","token":""}},"dataPropertyOrder":{"&":["base_url","administrator"],"&~|administrator":["userame","password","token"]},"color":null,"isPrivate":false,"metaSortKey":1606858176670,"_type":"environment"}]}

Insomnia Plugin issue: devhammed/insomnia-plugin-documenter#3

Add description for a FOLDER. Is that possible?

Through the "Docs" tab we can document the methods, but it would be really cool if we could put a description in a folder that contains several methods.

For example, if my workspace is divided in 3 folders:

  • Admin
  • Client
  • Auth

When I click on Admin option, from left menu, is there any way to add a description like image shows?
Captura de Tela 2020-09-04 às 19 37 43

Environment not working

Hello!
I just discovered this documenter and I love it, but I have a problem with my environment's variables. Look at my generated documentation:
image

It is not taking the value of my variable. Insomnia does it with no problem. Is this a bug? I was thinking it may is because of the introduction of the underscore and dot before the variable in insomnia:
image

Originally posted by @AxelLR992 in #48

Example response not working

The example response is not show on the right panel:

2021-07-27_14-59

Response language tag:

{
  "ok": true,
  "data": [
    {
      "name": "Insomnia",
      "description": "REST client for humans"
    },
    {
      "name": "Insomnia Documenter",
      "description": "Documentation generator for Insomnia"
    }
  ]
}

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.