Code Monkey home page Code Monkey logo

openapi-editor's Introduction

openapi-editor

The OpenAPI Editor is a wrapper package built around the Swagger Editor tool which allows you to edit Open API specifications in YAML inside your browser and preview its documentations in real time.

The OpenAPI Specification is a community-driven open specification within the OpenAPI Initiative, a Linux Foundation Collaborative Project.

OpenAPI Editor is built with swagger-editor-dist which is a dependency-free module that includes everything you need to serve Swagger Editor in a project.

Features

  • Runs as a stand-alone web application in a port of your choice.
  • Edit, validate and save your OpenAPI yaml file describing your project API.

Getting Started

In a typical workflow of building an API based on the Open API specifications, you would design and model your API, write the implementation code, test it and maintain it.

Install

In a new or existing folder containing your project:

npm install openapi-editor

Usage

By default openapi-editor will run in a dynamically assigned port and will attempt to find an OpenAPI yaml file in the default path src/api/v1/api.yaml

You can add an entry to the "scripts" section in package.json:

"scripts": {
  "api:edit": "openapi-editor --file ./src/api/v1/api.yaml --port 10021"
}

You can also run it from the command line using npx

npx openapi-editor --file ./src/api/v1/api.yaml --port 10021

Or in JavaScript by importing the module

const openApiEditor = require('openapi-editor');

const options = {
  file: './src/api/v1/api.yaml', // specify path as string or fully resolved path
  port: 10021, // specify port or omit for random port usage
  silent: false, // invoque browser or run silently
};

openApiEditor.edit(options);

API

--file [optional]

The OpenAPI specification File to edit. Defaults to src/api/v1/api.yaml

--port [optional]

Optional port to run. Defaults to 0 or dynamically assigned port.

--silent [optional true/false]

Automatically opens default browser. Defaults to true.

Licence

This project is licensed under the MIT License

Development Setup

Clone this repo git clone https://github.com/Codermar/openapi-editor

npm install

npm run test:watch To run tests in watch mode.

npm run build or npm run build:watch To build the project.

npm test to run the tests.

Contributing

Keep it simple. Keep it minimal.

openapi-editor's People

Contributors

codermar avatar

Watchers

James Cloos avatar  avatar

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.