1---2name: restassured-analysis-contracts3description: Use when Codex needs to derive Rest Assured test scenarios from OpenAPI or Swagger contracts, including endpoints, methods, schemas, auth rules, status codes, and error conditions.4---56# Analyze REST Contracts78## 1. Load The Contract9101. Prefer OpenAPI or Swagger files already in the repo.112. Run `python scripts/extract_openapi_summary.py --input <path-or-url>` to produce a normalized summary.123. Read [openapi-swagger-analysis.md](references/openapi-swagger-analysis.md) when the contract contains advanced features.1314## 2. Extract Testable Surface15161. List paths, methods, tags, and operation IDs.172. List auth schemes and which operations require them.183. List path, query, header, and body parameters.194. List required vs optional request fields.205. List documented status codes, response schemas, and error payloads.216. Use the script output as the baseline summary, then read the raw contract only for unresolved details.2223## 3. Choose The Assertion Mode24251. Use `runtime-aligned` mode when the suite exists to prove the live service behavior that consumers actually receive.262. Use `contract-enforcement` mode when the goal is strict specification conformance, drift detection, or contract hardening.273. Use `mixed` mode when both matter: keep runtime-aligned regression tests separate from contract-enforcement checks.284. Record the chosen mode in the coverage plan so implementation and reporting stay consistent.295. Record the dominant OpenAPI tags and any explicit user priority for tags so coverage planning can order work intentionally.3031## 4. Convert To Test Candidates32331. Create happy-path candidates for every in-scope operation.342. Create validation candidates for required fields, formats, enums, and boundaries.353. Create authorization candidates from security requirements.364. Create negative candidates from documented `4xx` and `5xx` responses.375. In `contract-enforcement` or `mixed` mode, add explicit drift-detection candidates for status, content type, auth, required fields, and schema shape.386. Flag undocumented behavior instead of inventing expected results.397. Group candidates by tag before handing them to coverage planning when the contract is tag-rich or the user asked for domain-priority ordering.4041## 5. Merge With Business Requirements42431. Prefer business requirements when they are more specific than the contract.442. Flag conflicts instead of silently choosing one source.453. Hand the merged result to `../../coverage_plan/generation/SKILL.md`.4647## 5. Examples48491. Input: `Derive tests from openapi/orders.yaml.`50 Output: A normalized matrix of operations, validations, auth rules, and error responses ready for coverage planning.5152## 6. Troubleshooting53541. Problem: The contract is YAML and parsing fails.55 Fix: Install `PyYAML` or convert the file to JSON, then rerun the script.562. Problem: The contract omits business rules such as inventory side effects.57 Fix: Merge in user stories before finalizing the scenario list.583. Problem: The live runtime already diverges from the contract.59 Fix: Choose `mixed` mode unless the user asked for pure contract enforcement.