Package detail

@scalar/galaxy

scalar1.2kMIT0.5.3

OpenAPI example specification in YAML and JSON

openapi, example, swagger, petstore

readme

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 ScalarGalaxy from '@scalar/galaxy/latest.json'

Import as JSON string

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

Import as YAML string

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

Import specific OpenAPI version

import ScalarGalaxy 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": "marc@scalar.com"
      }
    }
  ],
  "meta": {
    "limit": 10,
    "offset": 0,
    "total": 100,
    "next": "/planets?limit=10&offset=10"
  }
}

Serve an OpenAPI document using the CLI

npx @scalar/cli document serve ./src/documents/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.