Skip to content

dv-net/dv-docs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

67 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“š DV Docs - OpenAPI Documentation Generator

Automatic generation of multilingual documentation from an OpenAPI specification using VitePress

VitePress Node.js OpenAPI


๐Ÿ“– Attribution

This project is a fork and derivative of vitepress-openapi by Enzo Notario.

We extend our gratitude to the original author and contributors for their excellent work. This project builds upon their foundation with additional features including multilingual support, enhanced documentation generation, and custom integrations.

Original Project: vitepress-openapi
Original Author: Enzo Notario

Note on Package Naming: This project uses the package @dv.net/docs-vitepress-openapi as a dependency, which is a modified version of the original vitepress-openapi package. We acknowledge that the naming similarity may cause confusion, and we are committed to maintaining clear attribution and distinction from the original project.


๐Ÿš€ Quick Start

1๏ธโƒฃ Install dependencies

npm install

2๏ธโƒฃ Prepare the OpenAPI specification

Place the openapi.json file into the scripts/ folder.

โš ๏ธ Important: The format must be OpenAPI 3.0.1

๐Ÿ’ก To convert Swagger to OpenAPI use Swagger Editor

3๏ธโƒฃ Generate English translations

npm run docs:genTranslation

Run this command when adding new endpoints or when changing names/descriptions.

4๏ธโƒฃ Translate section titles

Open and translate the titles in src/{locale}/t.json files for the required languages.

5๏ธโƒฃ Generate the documentation

npm run docs:genDoc

6๏ธโƒฃ Build the project

npm run build

7๏ธโƒฃ Run the dev server

npm run dev

๐ŸŒ Supported Languages

  • ๐Ÿ‡ฌ๐Ÿ‡ง English (en)
  • ๐Ÿ‡ท๐Ÿ‡บ Russian (ru)
  • ๐Ÿ‡ฉ๐Ÿ‡ช Deutsch (de)
  • ๐Ÿ‡ช๐Ÿ‡ธ Espaรฑol (es)
  • ๐Ÿ‡จ๐Ÿ‡ณ ไธญๆ–‡ (zh)
  • ๐Ÿ‡ฐ๐Ÿ‡ท ํ•œ๊ตญ์–ด (ko)
  • ๐Ÿ‡ฎ๐Ÿ‡ณ เคนเคฟเคจเฅเคฆเฅ€ (hi)
  • ๐Ÿ‡ธ๐Ÿ‡ฆ ุงู„ุนุฑุจูŠุฉ (ar)

โž• Adding a New Language

Step-by-Step Guide

1๏ธโƒฃ Register the language

Add the new language to scripts/regions.json:

{ "locale": "fr", "name": "Franรงais", "flag": "๐Ÿ‡ซ๐Ÿ‡ท" }

2๏ธโƒฃ Generate translations

Repeat steps 3โ€“6 from the Quick Start section.

3๏ธโƒฃ Update mappings

Add the language configuration to .vitepress/mappers.ts.

4๏ธโƒฃ Translate UI elements

Add button translations to scripts/buttonText.ts.

5๏ธโƒฃ Create textual documentation

Add translated pages to the src/{lang}/ folder:

  • ๐Ÿ“ installation/ - Installation instructions
  • ๐Ÿ“ integration/ - Integration guides
  • ๐Ÿ“ operations/ - Operations description

Translate texts in the following files:

  • src/{lang}/titles.json - Section titles
  • src/{lang}/defaultTranslate.json - Common translations

๐Ÿ“Š Google Analytics

Analytics setup

1๏ธโƒฃ Create a .env file on the server

Copy the template from .env.example:

cp .env.example .env

2๏ธโƒฃ Fill in the environment variables

env VITE_GA_ID=G-XXXXXXXXXX

โ„น๏ธ Note: Analytics only works in production mode


๐Ÿ“ Available Scripts

Command Description
npm run dev ๐Ÿ”ฅ Start the dev server with hot reload
npm run build ๐Ÿ“ฆ Build the production version
npm run docs:genTranslation ๐Ÿ”ค Generate English translations from OpenAPI
npm run docs:genDoc ๐Ÿ“„ Generate documentation for all languages
npm run preview ๐Ÿ‘๏ธ Preview the production build

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

License Note

This project is a derivative work based on vitepress-openapi, which is also licensed under the MIT License. The original copyright notice and license terms are preserved in the LICENSE file.


Made with โค๏ธ for the developer community

GitHub

About

๐Ÿ“š DV Docs - OpenAPI

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •