Ensure all API endpoints have complete and accurate OpenAPI annotations to support proper SDK generation and documentation. Use appropriate decorators, include all necessary metadata, and verify that generated SDKs work correctly.
Ensure all API endpoints have complete and accurate OpenAPI annotations to support proper SDK generation and documentation. Use appropriate decorators, include all necessary metadata, and verify that generated SDKs work correctly.
Key requirements:
@ApiPropertyOptional for optional fields instead of @ApiProperty with required: falseadditionalProperties: true for object types to enable proper SDK type generationnullable: true when fields can be null (different from optional)@ApiHideProperty conditionally when properties should not appear in public documentationExample of proper annotations:
@ApiPropertyOptional({
description: 'The data sent with the notification.',
type: 'object',
nullable: true,
example: { key: 'value' },
additionalProperties: true
})
data?: Record<string, unknown>;
// Conditional hiding for internal-only properties
@ApiHideProperty() // when IS_DOCKER_HOSTED !== 'true'
@IsOptional()
@IsNumber()
priority?: number;
This ensures accurate documentation generation, proper SDK type inference, and consistent API behavior across all client libraries.
Enter the URL of a public GitHub repository