Coder Social home page Coder Social logo

rookie-luochao / openapi-ui Goto Github PK

View Code? Open in Web Editor NEW
418.0 2.0 41.0 5.93 MB

OpenAPI/Swagger UI document, quickly generate mock params and call api, also simplified postman tool. 基于 OpenAPI/Swagger 规范的接口文档,快速模拟请求参数并调用接口,也是简化版 postman 工具

Home Page: http://www.openapi-ui.com

License: MIT License

JavaScript 0.25% Shell 0.15% Dockerfile 0.33% HTML 0.38% Makefile 0.27% TypeScript 98.63%
openapi openapi-ui swagger-ui swagger openapiui api-documentation oasv3 openapi-specification openapi3 openapi31

openapi-ui's Introduction

OpenAPI UI

OpenAPI/Swagger UI document, quickly generate mock params and call api, also simplified postman tool

License Release (latest by date) npm openapi-ui package build framework

English | 简体中文

Screen Shot

postman

Website domain

Usage

With CDN

<!doctype html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <title>openAPI UI</title>
  </head>
  <body>
    <div id="openapi-ui-container" spec-url="https://petstore3.swagger.io/api/v3/openapi.json"></div>
    <script src="https://cdn.jsdelivr.net/npm/openapi-ui-dist@latest/lib/openapi-ui.umd.js"></script>
  </body>
</html>

With React(or With Vue)

import { useEffect } from "react";

const SetUpOpenApiUI = () => {
  useEffect(() => {
    import("openapi-ui-dist")
  }, []);

  return (
    <div id="openapi-ui-container" spec-url="https://petstore3.swagger.io/api/v3/openapi.json" />
  );
}

export const openapiRoutes = {
  path: "/openapi",
  id: "openapi",
  element: <SetUpOpenApiUI />,
};

Quick start

# node version >= 18
# download node_modules
pnpm install
# or make install

# start
npm run dev
# or make dev

Some script

# build
npm run build
# or make build

# make docker image
make docker-build

# run docker image
make docker-run

# make docker image and run docker image
make docker-build-run

Support data format

  • swagger2.json/swagger2.yml
  • openapi3.json/openapi3.yml

How to use

  • enter swagger2/openapi3 api gateway URL, refresh the page to update the interface
  • upload swagger2/openapi3 file
  • enter swagger2/openapi3 text

Global config

  • supports configure request timeout, the default request timeout is 2 minutes
  • supports configure request Authorization, Authorization can be overridden in the current request

Share URL

  • url can only be shared when imported through url mode
  • copy the url and share it with those who need it, they can echo the url to the specified interface

Mock request params

  1. if the schema contains the format field, then use openapi-sampler to mock request params
  2. if the schema does not contain the format field, then use faker to mock request params

Request error message display rules

  1. if the returned structure contains a message field, display the message field
  2. if the returned structure contains a msg field, display the msg field
  3. if the returned result is a string, display the string
  4. display AxiosResponse.statusText field
  5. display AxiosError.message field

Connect intranet api

  • if unable to connect intranet api, you can run this project locally or use docker to deploy this project locally or on the server

Support multiple api gateway URL

  • the caching strategy used is session storage, so you can open multiple pages at the same time

Docker deploy, support env variable injection

# pull Docker image
docker pull ghcr.io/rookie-luochao/openapi-ui:latest

# start container, nginx reverse proxy custom port, for example: docker run -d -p 8081:80 ghcr.io/rookie-luochao/openapi-ui:latest
docker run -d -p 80:80 -e APP_CONFIG=env=zh,appNameZH=简洁美观的接口文档 ghcr.io/rookie-luochao/openapi-ui:latest

Node version

node >= 18

openapi-ui's People

Contributors

chenchongfu avatar dependabot[bot] avatar lu-zheng712 avatar rookie-luochao avatar xiaoxlm 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  avatar

openapi-ui's Issues

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.