mcpField
O
openapi-specification-v3.2

openapi-specification-v3.2

github.com/hairyf开发26878 次安装2 周前更新
代码仓库

关于 openapi-specification-v3.2

面向 Agent 的 OpenAPI Specification 3.2 参考技能,适用于编写、更新和验证规范描述。内容涵盖文档结构、Schema、引用解析、安全配置及编写实践。

主要功能

  1. 01编写 OpenAPI 3.2 文档
  2. 02Schema 与引用指南
  3. 03参数、请求体和响应
  4. 04配置安全方案
  5. 05规范编写实践

适用场景

  1. 01创建或更新 OpenAPI 3.2 文件
  2. 02解析多文档间的引用
  3. 03描述 API 操作与 Schema

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/hairyf/skills --skill openapi-specification-v3.2

安装后在 Claude Code 中输入/openapi-specification-v3.2确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

GENERATION.md
references/
advanced-security-filtering.md
core-data-types-and-formats.md
callbacks-and-webhooks.md
advanced-extensions.md
core-discriminator-and-xml.md
components-reuse.md
advanced-base-uri-and-resolution.md
core-encoding-object.md
best-practices-spec-authoring.md
core-example-object.md
core-path-templating.md
core-link-object.md
core-http-status-codes.md
core-openapi-object.md
core-fixed-patterned-fields.md
core-format-and-structure.md
core-header-object.md
core-info-metadata.md
core-media-types.md
core-reference-object.md
parameters.md
core-runtime-expressions.md
core-tags-and-external-docs.md
schema-composition-polymorphism.md
request-body-and-media-type.md
core-server.md
schema-and-components.md
paths-and-operations.md
responses.md

详细介绍

OpenAPI Specification 3.2

面向 Agent 的 OpenAPI Specification 3.2.0 参考。适用于编辑、生成或验证 OpenAPI 描述(OAD)时。

何时使用

  • 编写或更新 OpenAPI 3.2 YAML/JSON 文档
  • 解析多文档 OAD 中的 $ref、$self 和相对 URI
  • 描述路径、操作、参数(query/path/header/cookie/querystring)、请求体和响应
  • 使用 Schema Object(JSON Schema Draft 2020-12 方言)、components 和引用
  • 配置安全方案(apiKey、http、mutualTLS、oauth2、openIdConnect)和要求
  • 处理媒体类型、编码(form、multipart)和示例(dataValue/serializedValue/externalValue)

核心参考

主题描述参考
OpenAPI 对象根对象、openapi、$self、info、servers、paths、webhooks、components、security、tagscore-openapi-object
格式与结构JSON/YAML、大小写敏感、富文本、OAD 结构、解析、基础 URIcore-format-and-structure
固定字段与模式字段固定字段与模式字段、paths 键、components 键、扩展(x-)core-fixed-patterned-fields
信息与元数据Info、Contact、License 对象core-info-metadata
服务Server 对象、Server Variable、URL 模板化core-server
路径与操作Paths 对象、Path Item、Operation 对象、additionalOperations、querypaths-and-operations
路径模板化路径模板化、路径参数、匹配、ABNFcore-path-templating
参数Parameter 对象、in(path/query/header/cookie/querystring)、style、schema 与 contentparameters
请求体与媒体类型Request Body、Media Type 对象、顺序媒体类型、itemSchemarequest-body-and-media-type
编码对象按名称/位置编码、contentType、style、explode、form、multipartcore-encoding-object
媒体类型Content 键、媒体类型范围、OpenAPI Media Type Registrycore-media-types
响应Responses 对象、Response 对象、headers、content、linksresponses
HTTP 状态码Response 键、default、1XX–5XX 范围与 Xcore-http-status-codes
Schema 与 ComponentsSchema 对象(JSON Schema 2020-12)、Components、$ref 解析schema-and-components
Schema JSON Schema 关键字Schema 中的 JSON Schema 2020-12 关键字与 OAS 扩展schema-json-schema-keywords
Schema 组合与多态allOf、oneOf、anyOf、discriminatorschema-composition-polymorphism
数据类型与格式JSON Schema 类型、format 关键字、OAS 方言core-data-types-and-formats
Discriminator 与 XMLDiscriminator 对象、XML 对象(nodeType、name、namespace)core-discriminator-and-xml
Components 复用通过 $ref 复用参数、响应、schemacomponents-reuse
Reference 对象$ref、summary/description 覆盖、解析规则core-reference-object
Header 对象响应/multipart 头、style simple、Set-Cookie、Linkcore-header-object
Example 对象dataValue、serializedValue、value、externalValue、Working with Examplescore-example-object
Tag 与外部文档Tag 对象、External Documentation 对象、parent、kindcore-tags-and-external-docs
Link 对象operationRef、operationId、parameters、requestBodycore-link-object
运行时表达式$request、$response、$url、$method、ABNF、Link/Callback 用法core-runtime-expressions
安全Security Scheme、OAuth Flows、Security Requirement 对象security
安全方案类型apiKey、http(basic/bearer)、mutualTLS、oauth2、openIdConnectsecurity-scheme-types
Security Requirement 对象OR/AND 语义、{} 可选、[] 清除、scopessecurity-requirement-object
OAuth2 流程OAuth Flows 对象、OAuth Flow 对象、authorizationCode、deviceAuthorizationsecurity-oauth2-flows
回调与 WebhooksCallback 对象、webhookscallbacks-and-webhooks
扩展规范扩展(x-)、扩展注册表advanced-extensions

最佳实践

主题描述参考
规范编写operationId、tags、$self、components 复用、responses、securitybest-practices-spec-authoring

进阶

主题描述参考
基础 URI 与解析$self、检索 URI、引用解析、解析指南advanced-base-uri-and-resolution
安全过滤空 Paths/Path Item、安全注意事项advanced-security-filtering

要点

  • OAS 3.2 根对象使用 openapi: 3.2.0;components、paths 或 webhooks 中至少有一个必须存在。
  • $self 提供文档用于引用解析的基础 URI;在多文档 OAD 中使用它。
  • Schema Object 是 JSON Schema Draft 2020-12 的超集;空 schema = true,无 schema = false。
  • Parameter:使用 schema+style 或 content(一种 Media Type);in: "querystring" 需要 content。
  • 根级别的 security 为 OR(Security Requirement Object 之一);每个操作可覆盖;{} = 可选。

评论

支持 Markdown