blong-rest

Implement REST APIs from OpenAPI specs within Blong's gateway.

1|Updated Dec 21, 2023
One-click install
npx skills add https://github.com/feasibleone/blong --skill blong-rest
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: blong-rest
Source: https://github.com/feasibleone/blong/tree/main/.github/skills/rest
Command: npx skills add https://github.com/feasibleone/blong --skill blong-rest

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Blong's default API runtime is JSON-RPC. This Skill enables teams to implement pre-defined REST APIs using OpenAPI/Swagger contracts while preserving Blong's gateway and adapter patterns for a consistent API surface.

Core Features & Use Cases

  • REST Server: Expose REST endpoints from OpenAPI specs via gateway at /rest/{namespace}/...
  • REST Client: Call external REST APIs using OpenAPI definitions through the HTTP adapter
  • API Merging: Merge multiple OpenAPI specs into a single namespace for maintainability
  • Standards Compliance: Enforce OpenAPI contracts and operationId-based handler mapping
  • Gateway Integration: Integrates REST with the existing JSON-RPC flow

Quick Start

  • Define a gateway/api/ namespace for the REST API and attach an OpenAPI YAML spec with operationId
  • Create the OpenAPI YAML describing endpoints under paths with operationId
  • Implement handlers under orchestrator named by the namespace and operationId
  • Update the realm server configuration to enable REST gateway and route /rest requests

Frequently Asked Questions about blong-rest

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement REST APIs from an OpenAPI spec while keeping JSON-RPC as the default transport?

You can implement REST APIs from an OpenAPI spec by mounting gateway endpoints under /rest while preserving JSON-RPC as the default transport. This approach uses OpenAPI specifications to define REST endpoints and maps operationId values to orchestrator handlers for consistent API integration.

How do I map OpenAPI operationId values to my orchestrator handlers for a REST gateway?

To map OpenAPI operationId values to orchestrator handlers, define a gateway/api namespace and implement handlers named by that namespace and operationId. The REST gateway uses these operationId mappings to route requests correctly under the /rest path.

Can I merge multiple OpenAPI specs into a single REST namespace?

Yes, you can merge multiple OpenAPI specs into a single namespace for maintainability. This API merging feature consolidates multiple OpenAPI definitions into one unified namespace, simplifying gateway routing and client-side adapter management.

How do I call external REST APIs using OpenAPI definitions through an HTTP adapter?

You can call external REST APIs by using OpenAPI definitions through the client-side HTTP adapter. This adapter pattern consumes OpenAPI specs to interact with external REST services while maintaining consistency with the existing Blong gateway flow.

What configuration is required to enable the REST gateway and route /rest requests?

Enabling the REST gateway requires updating the realm server configuration to activate the REST integration. You must also provide an OpenAPI YAML file with operationId, a gateway/api definition, and orchestrator handlers named by namespace and operationId to route /rest requests.

Does this REST adapter work with both server-side gateway endpoints and client-side adapters?

Yes, the REST integration targets both server-side gateway endpoints and client-side adapters. Server-side endpoints expose REST APIs via the gateway at /rest, while client-side adapters consume OpenAPI definitions to call external REST APIs through the HTTP adapter.