feat(api-service): Environments v2 publish API fixes NV-7108#10012
feat(api-service): Environments v2 publish API fixes NV-7108#10012
Conversation
- Remove @ApiExcludeEndpoint from diff and publish endpoints to make them public
- Add @SdkMethodName decorators for SDK code generation ('diff' and 'publish')
- Add @ApiParam decorators with descriptions for targetEnvironmentId parameter
- Add @ApiBody decorators for request body documentation
- Update response DTOs with proper enum annotations (DiffActionEnum, SyncActionEnum, ResourceTypeEnum)
- Add DiffActionEnum import to diff-environment.dto.ts and use proper enum type for action field
- Create SyncActionEnum in sync.types.ts and update all related interfaces and DTOs
- Update sync-result.builder.ts and base-sync.operation.ts to use SyncActionEnum
- Update SYNC_ACTIONS constants to use SyncActionEnum values
Resolves NV-7108
Co-authored-by: Dima Grossman <dima@grossman.io>
|
Cursor Agent can help with this pull request. Just |
👷 Deploy Preview for dashboard-v2-novu-staging processing.
|
…alidation - Remove example from ResourceToPublishDto.resourceType (no-$ref-siblings error) - Remove example array from PublishEnvironmentRequestDto.resources - Fix ResourceInfoDto id/name to use explicit type: 'string' instead of example - Remove example from ResourceDiffDto.resourceType - Remove examples from ResourceDependencyDto (resourceType, reason, resourceId, resourceName, isBlocking) - Remove example from ResourceDiffResultDto.resourceType These changes fix OpenAPI 3.0 validation errors where example properties were placed next to enum $ref references. Co-authored-by: Dima Grossman <dima@grossman.io>
WalkthroughThis pull request refactors the environments-v2 module to replace string literal unions with typed enums. It introduces 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
apps/api/src/app/environments-v2/usecases/sync-strategies/constants/sync.constants.ts (1)
7-12:SYNC_ACTIONSis now a redundant mirror ofSyncActionEnum.Since every value in
SYNC_ACTIONSis just a re-export of the correspondingSyncActionEnummember, callers could reference the enum directly (e.g.,SyncActionEnum.CREATEDinstead ofSYNC_ACTIONS.CREATED). Consider removing this constant to reduce indirection, or keep it if you anticipate decoupling the two in the future.apps/api/src/app/environments-v2/dtos/publish-environment.dto.ts (1)
51-71: DTO class names still reference "Workflow" but now represent generic resources.
SyncedWorkflowDto,FailedWorkflowDto, andSkippedWorkflowDtohandle all resource types (workflows, layouts, etc.) as evidenced by theResourceTypeEnumfield and descriptions saying "Resource." Consider renaming toSyncedResourceDto,FailedResourceDto, andSkippedResourceDtoto avoid confusion — especially since these are now publicly exposed via Swagger.
What changed? Why was the change needed?
This PR exposes the
environments-v2diff and publish endpoints and enhances their Swagger documentation.Specifically, it:
@ApiExcludeEndpoint()from thediffandpublishendpoints inEnvironmentsController.@SdkMethodNamedecorators and comprehensive Swagger annotations (@ApiOperation,@ApiParam,@ApiBody) to these endpoints.ResourceDiffDtoto correctly useDiffActionEnumwithenumNamefor Swagger rendering.SyncActionEnuminsync.types.tsand refactored related DTOs (publish-environment.dto.ts) and internal interfaces/use cases to consistently use this enum, ensuring accurate Swagger documentation for response DTOs.These changes were needed to make the
environments-v2diff and publish APIs public, as requested in NV-7108, and to ensure their response DTOs are properly annotated for correct Swagger documentation rendering. The existingv2 sync-workflowAPI remains unchanged.Screenshots
N/A - This change primarily involves API exposure and documentation improvements.
Linear Issue: NV-7108