vitepress-openapi

website·Indexed 29 days ago

https://vitepress-openapi.vercel.app

A tool for generating documentation from OpenAPI documents using VitePress. It includes features for custom sidebar generation via templates, itemsByPaths, itemsByTags, and operationsByTags, as demonstrated through various API examples including an Argentine Rock artists API and an Upload/Download API.

Tokens
27.5K
Snippets
195
Records
259
Agent score
73%

What's inside vitepress-openapi

  1. Overview of the Scalar Galaxy Example API

    The Scalar Galaxy is a fictional OpenAPI document (v0.7.0) designed for testing OpenAPI tools and libraries. It provides a set of endpoints to manage fictional planets and demonstrates a wide range of OpenAPI specification features, including various authentication schemes and rich text descriptions.
  2. Retrieve details for a specific planet

    Use the GET /planets/{planetId} endpoint to get detailed information about a specific planet using its unique identifier. Returns a 200 OK if the planet is found or a 404 if not.
    curl -X GET https://galaxy.scalar.com/planets/{planetId}
  3. Render a specific API operation with OAOperation

    The OAOperation component is used to render a single API operation from an OpenAPI specification. It includes details such as parameters, request bodies, responses, and an interactive playground. If specUrl is provided, the component displays a loading indicator while the specification is being fetched.
  4. Argentine Rock Legends API Overview

    The Argentine Rock Legends API (v1.0.0) is an example OpenAPI specification used for testing OpenAPI tools and libraries. It provides endpoints to manage a database of Argentine rock artists, their albums, and user authentication.
  5. Create a new user account

    Create a user account to access exclusive content about Argentine Rock legends. This endpoint allows a new user to sign up and receive an API key for subsequent authenticated requests. The response includes user information (excluding the password) and the API key. It is critical to save the API key securely upon creation.
    POST /api/v1/user/signup
    Content-Type: application/json
    
    {
      "name": "Carlos",
      "email": "carlos@rock-legends.com",
      "password": "i-love-rock"
    }
  6. Render a complete OpenAPI specification using the OASpec component

    The OASpec component is used to render a full OpenAPI specification, including all operations, schemas, and documentation. It can load the specification either from a provided object/JSON string or by fetching it from a remote URL.
  7. Redocly Museum API Overview

    The Redocly Museum API (v1.2.1) allows developers to interact with museum services and information. All requests are made against the base server URL: https://redocly.com/_mock/docs/openapi/museum-api. The API uses HTTP Basic authentication via the MuseumPlaceholderAuth scheme.
  8. Generate dynamic pages for OpenAPI operations

    To automatically generate a page for every operation in your OpenAPI spec, create a directory named operations in your docs folder containing a dynamic markdown file and a paths loader file. This leverages the VitePress Paths Loader File feature to map spec operations to unique URLs.
    /docs
    ├── /operations
    │   ├── [operationId].md
    │   └── [operationId].paths.js
  9. Use multiple OpenAPI specs on a single page

    To render operations from different OpenAPI specification files on the same page, import the JSON spec files in the <script setup> block and pass the desired spec to the OAOperation component using the :spec prop. If no :spec prop is provided, the component will use the default specification.
    <script setup lang="ts">
    import defaultSpec from './openapi.json'
    import schemasSpec from './openapi-schemas.json'
    </script>
    
    <!-- Uses the default spec -->
    <OAOperation operationId="getAllArtists" />
    
    <!-- Uses the schemasSpec -->
    <OAOperation operationId="getCircularReference" :spec="schemasSpec" />