Git Product home page Git Product logo

scribe-js's Introduction

Scribe for Node.js


Automatically generate API documentation for humans from your Node.js codebase. Here's what the output looks like. There's a Laravel version, too!

npm version npm Build Status

๐Ÿ‘‹ Scribe helps you generate docs automatically, but if you really want to make friendly, maintainable and testable API docs, there's a few more things you need to know. So I made a course for you.

Features

  • Pretty HTML documentation page, with included code samples and friendly text
  • Included "Try It Out" button so users can test endpoints right from their browser
  • Markdown source files that can be edited to modify docs
  • Safely calls API endpoints to generate sample responses, with authentication and other custom configuration supported
  • Supports Postman collection and OpenAPI (Swagger) spec generation

Installation

Node.js 12.4.0 or higher is required.

Supported frameworks:

  • Adonis.js 4
  • Express 4
  • Restify 8
# For Adonis.js
npm i @knuckleswtf/scribe-adonis

# For Express
npm i @knuckleswtf/scribe-express

# For Restify
npm i @knuckleswtf/scribe-restify

Documentation

View the docs at scribe.knuckles.wtf/nodejs.

scribe-js's People

Contributors

shalvah 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

Watchers

 avatar  avatar

scribe-js's Issues

Can not generate html markdown and collections coreectly

What happened?

  1. I set my configuration to...
  2. Then I ran npx scribe:generate ...
  3. But I saw
    โ“˜ Writing docs...
    โœ– Writing HTML docs
    โ—ผ Writing Postman collection
    โ—ผ Writing OpenAPI spec
    Error: Promise rejected with value: [
    [Error: ENOENT: no such file or directory, lstat 'C:\nodejs\blog_api\node_modules@knuckleswtf\scribe\resources\images'] {
    errno: -4058,
    code: 'ENOENT',
    syscall: 'lstat',
    path: 'C:\nodejs\blog_api\node_modules\@knuckleswtf\scribe\resources\images'
    }
    ]
    at process. (C:\nodejs\blog_api\node_modules\hard-rejection\index.js:15:12)
    at process.emit (events.js:375:28)
    at processEmit [as emit] (C:\nodejs\blog_api\node_modules\signal-exit\index.js:175:34)
    at processPromiseRejections (internal/process/promises.js:245:33)
    at processTicksAndRejections (internal/process/task_queues.js:96:32)
    instead of...
    done

Screenshots or stack traces:
image

My environment:

  • Node.js version (from node -v): 14.17.2
  • Framework (Adonis/Express/Restify):Express 4.17.1
  • Framework version (from npm list @adonisjs/core or npm list express or npm list restify): npm list express : [email protected]
  • Scribe version (from npm list @knuckleswtf/scribe):2.0.0

My Scribe config (minus the comments):

Additional info:

AdonisJS v5 ?

Hello, first of all thank you for this library ๐Ÿš€
Is the support of Adonis V5 planned ? In progress ? Do you need help with this?
I use the version for Laravel and I would love to use it for my projects with Adonis as well.
Thanks

Update endpoints/00.yaml for group

Hi,

I try to use your package for generate docs of my nodeJS API based on overridden Express

I arrive to generate one config file (00.yaml) with all my endpoints. And i would like define Group / title and description in it.
It's ok for title / description but when i put groupName in metaData and when i launch the generate command.
It's work once;
If i want to relaunch it, while it was explose it in multiple files (00.yaml, 01.yamlโ€ฆ), he rebase it on app router and so it loose title / description and groups..

Sorry for my english, i 'm french
Say me if i'm not clear
Thnaks a lot

Doc block for parent route

  • I've read the documentation and I can't find details on how to achieve this.

  • All endpoints have the "lang" param.
    How do i specify the details and example for it generally without adding it to every route doc block?
    Also scribe generates random value for it on every route

Screenshot 2022-02-16 at 2 59 00 PM

Generate api docs from different route files

Does scribe library supports routes which are imported from different files in expressjs 4.x? I have divided routes into different files and sub files under it for better management like this:

// front routes
require('./app/routes/front')(app);

Code of app/routes/front/index.js

module.exports = function(app) {
  var routeFiles = fs.readdirSync(path.join(__dirname, 'router/'))

  routeFiles.forEach(function(file) {

    if (file === 'index.js' || file.substr(file.lastIndexOf('.') + 1) !== 'js') {
      return;
    }

    var name = file.substr(0, file.indexOf('.'));

    app.use('/', require('./router/' + name));
  });
}
// admin routes
require('./app/routes/admin')(app);

I'm unable to generate api docs. It always gives me undefined handlers on @knuckleswtf\scribe-express\src\get_routes.js [Line no. 55]

Any idea what am I missing over here?

Thank you

Description for @urlParam is ignored

I have the following

/**
* Here be my title
*
* And this is a description
*
* @urlParam {string} theParam required This should be the description. Example: its-a-string
* @urlParam {int} anotherParam This is another description
*/
server.get('/:theParam/:anotherParam', (req, res, next) => {
...

It seems that the @urlParam parser is ... exiting early? I can't provide a screenshot for unimportant reasons. But, what I get as output in the html page here is the "URL Parameters" header followed by
theParam string
anotherParam string

It is completely ignoring everything other than the @urlParam and the variable name tokens on those lines. The example text isn't used in the example request. The description is completely missing. required vs not having it there makes no difference. And the type is even ignored (as the int is showing in the doc as string).

Examples of request body are not generated

What happened?
After generating the documentation I noticed that request body examples are missing

Screenshots or stack traces:

Screenshot 2021-08-30 at 12 27 07 PM

My environment:

  • Node.js version (from node -v): v14.16.1
  • Framework (Adonis/Express/Restify): Express
  • Framework version (from npm list @adonisjs/core or npm list express or npm list restify): [email protected]
  • Scribe version (from npm list @knuckleswtf/scribe): @knuckleswtf/[email protected]

My Scribe config (minus the comments):

Additional info:
The openapi.yaml that is generated has examples in it but the postman collections generate doesn't

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.