controllers-contract-openapi

Standardize controller DTOs and response schemas to align with OpenAPI contracts.

Updated Apr 9, 2026
One-click install
npx skills add https://github.com/SergeuMatyasov/dotnet-shared-skills --skill controllers-contract-openapi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: controllers-contract-openapi
Source: https://github.com/SergeuMatyasov/dotnet-shared-skills/tree/main/controllers-contract-openapi
Command: npx skills add https://github.com/SergeuMatyasov/dotnet-shared-skills --skill controllers-contract-openapi

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Контроль и согласование контрактов API между контроллером и спецификацией OpenAPI; устранение несоответствий DTO и статусов ответов.

Core Features & Use Cases

  • Приведет к единообразию DTO для запросов и ответов в разных частях API.
  • Обновит и зафиксирует атрибуты ProducesResponseType и коды статусов, обеспечивая совместимость схем.
  • Обеспечит единый формат ошибок (ProblemDetails/ValidationProblemDetails) и согласованный формат полей camelCase.

Quick Start

Синхронизируй контракт API между контроллером и OpenAPI, обновив DTO и производные типы ответа для нового сценария.

Frequently Asked Questions about controllers-contract-openapi

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

FAQPage Schema
How do I align API contracts between C# controllers and OpenAPI specifications?

Enforcing consistent DTOs and updating ProducesResponseType attributes aligns API contracts between controllers and OpenAPI. This standardizes response schemas, requires explicit 200 OK responses, and ensures non-anonymous response objects with camelCase JSON field names.

Why does my OpenAPI schema show mismatched response types for C# controller endpoints?

OpenAPI schema mismatches occur when DTOs and response status codes are not explicitly standardized. Applying consistent ProducesResponseType attributes and enforcing non-anonymous response objects ensures the generated OpenAPI specification matches the actual controller output.

What is the best way to standardize error formats in an OpenAPI contract?

Standardizing error formats in an OpenAPI contract requires using consistent ProblemDetails or ValidationProblemDetails responses. This approach ensures all API errors follow a uniform schema, making the OpenAPI specification accurate and the API contract reliable.

How do I update ProducesResponseType attributes to ensure OpenAPI compatibility?

Update ProducesResponseType attributes by explicitly defining expected status codes like 200 OK and binding them to non-anonymous DTOs. This enforces schema compatibility and guarantees the OpenAPI specification accurately reflects controller response types.

Does OpenAPI contract alignment work with camelCase JSON field names in C#?

OpenAPI contract alignment enforces camelCase JSON field names across all request and response DTOs. This ensures the C# API serialization settings match the OpenAPI schema expectations, providing consistent field naming throughout the API contract.