返回顶部
o

openapi-spec

Deep OpenAPI workflow—design-first vs code-first, reusable schemas, security schemes, errors, examples, linting, compatibility, and codegen. Use when documenting REST APIs or driving clients and gateways from a spec.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
162
下载量
1
收藏
概述
安装方式
版本历史

openapi-spec

# OpenAPI Specification (Deep Workflow) OpenAPI is the **contract** between teams and tools. Quality comes from **consistent schemas**, **realistic examples**, and **lint rules** that catch breaking changes early. ## When to Offer This Workflow **Trigger conditions:** - New REST API; **public** or **partner** surface - **Codegen** for clients/servers; **API gateway** validation from spec - **Drift** between docs and implementation **Initial offer:** Use **six stages**: (1) workflow choice & ownership, (2) info & versioning, (3) resources & operations, (4) schemas & components, (5) security & errors, (6) lint, compatibility & publish). Confirm **OpenAPI** 3.x and **style guide**. --- ## Stage 1: Workflow & Ownership **Goal:** **Design-first** (spec → implement) vs **code-first** (annotations → export)—pick one per service and **enforce**. ### Ownership - **Who** approves breaking changes; **where** spec lives in repo **Exit condition:** Single source of truth for the API contract. --- ## Stage 2: Info & Versioning **Goal:** `info.title`, **version** scheme aligned with **URL** or **header** versioning strategy. ### Practices - **Deprecation** policy in description or extension fields --- ## Stage 3: Resources & Operations **Goal:** **RESTful** naming where appropriate; **operationId** stable for codegen. ### Practices - **Pagination** (`cursor`/`page`), **filtering**, **sort** documented - **Idempotency** (`Idempotency-Key`) for unsafe retries when relevant --- ## Stage 4: Schemas & Components **Goal:** **`components/schemas`** reused; **nullable** vs **optional** correct in JSON Schema sense. ### Practices - **OneOf** discriminated unions for polymorphic payloads when needed - **Examples** per schema for human and machine readers --- ## Stage 5: Security & Errors **Goal:** **`securitySchemes`** (Bearer, OAuth2) applied per operation or globally. ### Errors - **Problem Details** (`application/problem+json`) pattern with **stable** `type` URIs --- ## Stage 6: Lint, Compatibility & Publish **Goal:** **Spectral** or **vacuum** rules in CI; **openapi-diff** on PRs. ### Publish - **Docs** portal (Swagger UI, Redoc); **postman** collections optional --- ## Final Review Checklist - [ ] Single ownership and design-first or code-first discipline - [ ] Versioning and deprecation story clear - [ ] Operations complete with pagination/errors as needed - [ ] Reusable components and examples - [ ] Security and error model consistent - [ ] CI lint and breaking-change detection ## Tips for Effective Guidance - **Examples** should be **copy-paste valid**—catch enum drift. - **Nullable** in OpenAPI 3.1 aligns with JSON Schema—**mind** **3.0** differences when mixing. - **Internal** APIs still benefit from the same rigor—**future** you is a partner team. ## Handling Deviations - **GraphQL** elsewhere: OpenAPI for **REST** **edge** only—don’t force one doc for both.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 openapi-spec-1776030880 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 openapi-spec-1776030880 技能

通过命令行安装

skillhub install openapi-spec-1776030880

下载 Zip 包

⬇ 下载 openapi-spec v1.0.0

文件大小: 2.15 KB | 发布时间: 2026-4-13 11:17

v1.0.0 最新 2026-4-13 11:17
- Initial release of the OpenAPI Spec skill with a detailed, stage-based workflow for REST API specification.
- Covers design-first vs code-first, ownership, versioning, RESTful conventions, reusable schemas, security schemes, error patterns, linting, and compatibility checks.
- Provides a practical final review checklist and best practices for robust API contracts.
- Includes guidance for handling deviations (e.g., using GraphQL elsewhere) and tips for maintaining examples and schema consistency.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部