@scalar/galaxy

v0.2.12
OpenAPI example specification in YAML and JSON
openapi example swagger petstore

Scalar Galaxy OpenAPI Example

Version Downloads License Discord

An OpenAPI example specification in YAML and JSON to test OpenAPI tooling, run test suites or learn about OpenAPI.

Installation

npm install @scalar/galaxy

Usage

CDN

Version Format URL
Latest JSON https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.json
Latest YAML https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/latest.yaml
OpenAPI 3.1 JSON https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/3.1.json
OpenAPI 3.1 YAML https://cdn.jsdelivr.net/npm/@scalar/galaxy/dist/3.1.yaml

Import as object

import galaxy from '@scalar/galaxy/latest.json'

Import as JSON string

import galaxy from '@scalar/galaxy/latest.json?raw'

Import as YAML string

import galaxy from '@scalar/galaxy/latest.yaml?raw'

Import specific OpenAPI version

import galaxy from '@scalar/galaxy/3.1.json'

Development

Use the @scalar/mock-server to serve an OpenAPI document:

npm run dev

Explore the API by making requests to it using your favourite API exploration tools:

curl http://localhost:5052/planets

Response

{
  "data": [
    {
      "id": 1,
      "name": "Mars",
      "description": "The red planet",
      "image": "https://cdn.scalar.com/photos/mars.jpg",
      "creator": {
        "id": 1,
        "name": "Marc",
        "email": "[email protected]"
      }
    }
  ],
  "meta": {
    "limit": 10,
    "offset": 0,
    "total": 100,
    "next": "/planets?limit=10&offset=10"
  }
}

Serve an OpenAPI specification yaml using the CLI

npx @scalar/cli serve ./src/specifications/3.1.yaml --watch

Community

We are API nerds. You too? Let’s chat on Discord: https://discord.gg/scalar

License

The source code in this repository is licensed under MIT.

npm i @scalar/galaxy

Metadata

  • MIT
  • >=18
  • Scalar
  • released 10/18/2024

Downloads