openapi-parser skill
Parses complex OpenAPI specifications to generate Drift test cases covering polymorphic schemas and various response variants.
- GitHub 스타
- 7
- 파일
- 7
- 마지막 커밋
- 2026년 11월 11일
- 라이선스
- MIT
- 허용된 도구
- —
openapi-parser skill은 무엇을 하나요?
openapi-parser은(는) agent skill입니다. Parses complex OpenAPI specifications to generate Drift test cases covering polymorphic schemas and various response variants.
skill의 SKILL.md에서 생성된 요약입니다.
openapi-parser skill 정보
Generating Drift test cases from complex OpenAPI specifications is the primary function of this skill. It is designed for developers who need to scaffold tests that cover polymorphic schemas, inheritance, and various response variants. When an agent loads this skill, it can parse OpenAPI 3.x files to identify path, query, and header parameters, as well as request bodies and response status codes.
The process involves recursively resolving $ref chains and interpreting complex patterns like anyOf, oneOf, allOf, and discriminators. It uses reference files such as schema-patterns.md and drift-mapping.md to ensure correct interpretation of schema logic and mapping to Drift YAML. The output includes a detailed analysis of the schema, the complete operations block for Drift, necessary datasets, and a list of intentionally excluded schema combinations. This allows for high coverage of structurally distinct schema variants without creating an unnecessary combinatorial explosion of tests.
agent가 수행할 수 있는 작업
- 1Scaffold Drift tests from a specA developer can provide an OpenAPI file path to automatically generate a complete set of Drift operations and datasets.
- 2Test polymorphic schema branchesYou can use this to ensure every branch of a oneOf or anyOf schema is covered by a unique test case.
- 3Validate complex field valuesAn agent can help determine which specific values are valid for a field defined by complex regex patterns or enums.
- 4Handle inheritance and compositionThe skill can merge base fields with local properties to create a single payload for allOf composition tests.
skill의 SKILL.md를 기반으로 작성되었습니다. 모든 사용 사례는 해당 문서의 인용구와 대조 확인되었습니다.
openapi-parser skill 설치 방법
각 명령은 skill 폴더를 클라이언트의 skills 디렉터리에 복사합니다. 클라이언트를 재시작하거나 새 세션을 시작하여 로드하세요.플러그인에 openapi-parser skill 설치
/plugin marketplace add pactflow/pactflow-agent-skills /plugin install swagger-contract-testing@swagger-contract-testing-agent-extensions
Claude Code에 openapi-parser skill 설치
~/.claude/skills/openapi-parser/SKILL.md
$ npx degit pactflow/pactflow-agent-skills/plugins/swagger-contract-testing/skills/openapi-parser ~/.claude/skills/openapi-parserClaude Code (project)에 openapi-parser skill 설치
.claude/skills/openapi-parser/SKILL.md
$ npx degit pactflow/pactflow-agent-skills/plugins/swagger-contract-testing/skills/openapi-parser .claude/skills/openapi-parserCodex에 openapi-parser skill 설치
~/.agents/skills/openapi-parser/SKILL.md
$ npx degit pactflow/pactflow-agent-skills/plugins/swagger-contract-testing/skills/openapi-parser ~/.agents/skills/openapi-parserGemini CLI에 openapi-parser skill 설치
~/.gemini/skills/openapi-parser/SKILL.md
$ npx degit pactflow/pactflow-agent-skills/plugins/swagger-contract-testing/skills/openapi-parser ~/.gemini/skills/openapi-parserClaude.ai에 openapi-parser skill 설치
npx degit pactflow/pactflow-agent-skills/plugins/swagger-contract-testing/skills/openapi-parser openapi-parser && zip -r openapi-parser.zip openapi-parser # claude.ai → Customize → Skills → + → Create skill → Upload a skill → openapi-parser.zip
SKILL.md
GitHub에서 보기OpenAPI Parser Skill
Reference files
references/schema-patterns.md— how to interpret and enumerate every complex pattern (anyOf / oneOf / allOf / discriminator / $ref / enum / pattern / nullable / optional), with real examples from snyk, digitalocean, posthog, and front/core specsreferences/drift-mapping.md— how to map enumerated schema variants to Drift YAML, including datasets, expressions, lifecycle hooks for stateful cases, and expected response matchers for each pattern type
Workflow
OpenAPI version: This skill targets OpenAPI 3.x. Swagger 2.0 specs use the same structural patterns (
$ref,allOf,oneOf) but different envelope syntax — you may need to adapt field names manually. If working from thekonfig-sdks/openapi-examplescollection, seereferences/example-repos.mdfor navigation commands.
1. Locate the endpoint
Extract only what's needed:
# Find the line number of the endpoint (macOS/Linux/Git Bash/WSL)
grep -n "^ /path/to/endpoint" spec.yaml
# Read just that block (adjust line range as needed)
# Then follow each $ref to components/schemas
grep -n "SchemaName:" spec.yaml
# PowerShell equivalents (Windows)
Select-String -Path spec.yaml -Pattern "^ /path/to/endpoint" | Select-Object LineNumber, Line
Select-String -Path spec.yaml -Pattern "SchemaName:" | Select-Object LineNumber, Line
Extract: path/query/header parameters, request body schema, and each response status code's schema.
2. Resolve $refs recursively
- Grep for
Foo:in the spec to find its definition block - If Foo itself contains refs, resolve those too
- Stop at primitive types (
string,integer,boolean,array,object)
allOf: [$ref: Base, properties: {...}] is inheritance — merge Base fields with local
properties to get the full schema. See references/schema-patterns.md for all patterns.
3. Enumerate viable combinations
For each response status code, enumerate structurally distinct schema variants. Aim for minimum tests that maximise schema coverage — not a combinatorial explosion of optional field permutations.
| Pattern | Tests to generate |
|---|---|
oneOf / anyOf with N branches |
N tests — one per branch |
discriminator with N mapping values |
N tests — one per discriminator value |
allOf (composition / inheritance) |
1 test — merge all schemas into one payload |
enum |
1 test covers it; add boundary variants only if the value drives behaviour |
| Optional field cluster | 2 tests: one with all optional fields, one without |
nullable field |
Covered by happy path; add null variant only if it changes behaviour |
pattern (regex) |
1 valid example matching the pattern; 1 invalid for negative testing |
4. Generate Drift test cases
For each combination produce a Drift operation block. See references/drift-mapping.md
for full patterns. Key conventions:
- Name operations as
{operationId}_{variant}— e.g.getImage_byId,getImage_bySlug - For discriminated unions, set the discriminator property explicitly in the request body
- For
anyOfpath parameters, write one test per type variant - Use
datasetfor test data; use inlineparametersonly for static, non-variant values (e.g. a fixed enum query param liketype: user) - For 401 tests, strip global auth with
exclude: [auth]and pass an invalid bearer token explicitly - Add
ignore: { schema: true }to any operation that sends an intentionally invalid request body - Tag each test to indicate which schema branch it covers
- Omitting
bodyfromexpectedlets Drift validate the response against the OpenAPI schema automatically; add explicitbodymatchers only when asserting a specific field value (e.g. the discriminator property came back correctly)
5. Output format
Always produce:
- Analysis — number of status codes, which schemas are polymorphic, how many tests will be generated and why
- Drift operations YAML — the complete
operations:block, ready to paste - Dataset YAML (if needed) — the
datasets:block for any referenced test data - Gaps — schema combinations intentionally excluded, with the reason
Example
Given GET /v2/images/{image_id} where image_id: anyOf: [integer, string]:
operations:
getImage_byId:
target: source-oas:getImage
tags: [images, param-integer]
parameters:
path:
image_id: ${image-data:images.existing.id}
expected:
response:
statusCode: 200
getImage_bySlug:
target: source-oas:getImage
tags: [images, param-string]
parameters:
path:
image_id: ${image-data:images.existing.slug}
expected:
response:
statusCode: 200
getImage_notFound:
target: source-oas:getImage
parameters:
path:
image_id: ${image-data:notIn(images.*.id)}
expected:
response:
statusCode: 404
이 스킬의 파일
7openapi-parser skill 질문
Claude Code에 openapi-parser skill을 어떻게 설치하나요?
npx degit pactflow/pactflow-agent-skills/plugins/swagger-contract-testing/skills/openapi-parser ~/.claude/skills/openapi-parser를 실행합니다. Claude Code는 ~/.claude/skills(모든 프로젝트) 또는 .claude/skills(한 프로젝트)에서 skills를 로드하며, 설명이 작업과 일치할 때 skill을 사용합니다.
openapi-parser skill을 사용할 수 있는 클라이언트는 무엇인가요?
Agent Skills 형식을 읽는 모든 클라이언트(Claude Code, Codex, Gemini CLI, claude.ai(ZIP으로 업로드))가 사용할 수 있습니다. skill 내 스크립트는 클라이언트가 코드 실행을 허용하는 경우에만 실행됩니다.
What types of complex OpenAPI schemas can this skill handle?
The skill handles anyOf, oneOf, allOf, discriminators, polymorphism, inheritance, $ref chains, regex patterns, enums, and optional fields.
Which OpenAPI versions are supported?
This skill specifically targets OpenAPI 3.x, though Swagger 2.0 specs can be used by manually adapting field names.
How does the skill handle oneOf or anyOf patterns when generating tests?
For oneOf or anyOf patterns with N branches, it generates N tests, providing one test per branch.