rest-openapi

Annotate OrangeHRM REST API endpoints with OpenAPI v3 annotations.

1.1k|746|Updated Jan 5, 2017
One-click install
npx skills add https://github.com/orangehrm/orangehrm --skill rest-openapi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rest-openapi
Source: https://github.com/orangehrm/orangehrm/tree/main/.agents/skills/rest-openapi
Command: npx skills add https://github.com/orangehrm/orangehrm --skill rest-openapi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill eliminates the risk of missing or incorrect OpenAPI v3 annotations for OrangeHRM REST endpoints and models, which cause CI build failures and produce inaccurate, unreliable API documentation for consumers.

Core Features & Use Cases

  • OpenAPI Annotation Reference: Provides detailed guidance for zircote/swagger-php annotations on endpoint handler methods and Model classes, including required fields, naming conventions, and PHP constant usage.
  • Shared Component Guidance: Documents the project's pre-defined shared refs (RecordNotFound, ForbiddenResponse, sortOrder, limit, offset) to avoid duplication and ensure consistency across all API endpoints.
  • Practical Recipes & Checklists: Includes step-by-step examples for annotating common endpoint types (list, single resource, create, bulk delete) and Model schemas, plus checklists for new annotation work and debugging CI failures.
  • Use Case: When adding a new PIM employee API endpoint, use this Skill to ensure your annotations match the routes.yaml configuration, use the correct shared response refs, and pass the mandatory generate-open-api-doc --throw CI check.

Quick Start

Use the rest-openapi skill to add correct OpenAPI annotations to your new OrangeHRM REST endpoint and pass the CI lint check.

Frequently Asked Questions about rest-openapi

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

FAQPage Schema
How do I fix generate-open-api-doc --throw CI failures for malformed OpenAPI annotations?

Fix generate-open-api-doc CI failures by correcting malformed zircote/swagger-php annotations on endpoint handlers and Model classes, ensuring required fields, naming conventions, and PHP constants align with routes.yaml to produce valid OpenAPI v3 specs.

How to add OpenAPI annotations for a new REST API endpoint in OrangeHRM?

Add OpenAPI annotations by applying zircote/swagger-php attributes to your endpoint handler methods, defining Model @OA.Schema blocks, and referencing project-standard shared component refs like RecordNotFound and sortOrder to ensure consistent REST v2 API documentation.

What are the required shared component references for OrangeHRM REST v2 API documentation?

Required shared component references for OrangeHRM REST v2 API include RecordNotFound, ForbiddenResponse, sortOrder, limit, and offset. Using these pre-defined shared refs eliminates duplication and ensures documentation consistency across all endpoints.

Why do my swagger-php annotations break the CI lint workflow for OpenAPI spec generation?

swagger-php annotations break the CI lint workflow when they contain missing required fields, use literal values instead of PHP constants, or mismatch the routes.yaml configuration, which collectively cause invalid OpenAPI spec generation and build failures.

Can I use swagger-php literal values instead of PHP constants in OpenAPI schema definitions?

You cannot use literal values in swagger-php OpenAPI schema definitions for OrangeHRM. You must reference PHP constants to ensure annotations pass the mandatory generate-open-api-doc CI lint check and maintain accurate API documentation.

What's the best way to debug OpenAPI annotation errors for bulk delete endpoints?

Debug OpenAPI annotation errors for bulk delete endpoints by using step-by-step recipes and checklists to verify @OA.Schema blocks, validate shared response refs, and ensure endpoint handler methods match routes.yaml to pass CI lint enforcement.