Skip to content

feat(api-service): Environments v2 publish API fixes NV-7108#10012

Open
scopsy wants to merge 5 commits intonextfrom
cursor/NV-7108-environments-v2-api-swagger-c8c7
Open

feat(api-service): Environments v2 publish API fixes NV-7108#10012
scopsy wants to merge 5 commits intonextfrom
cursor/NV-7108-environments-v2-api-swagger-c8c7

Conversation

@scopsy
Copy link
Contributor

@scopsy scopsy commented Feb 11, 2026

What changed? Why was the change needed?

This PR exposes the environments-v2 diff and publish endpoints and enhances their Swagger documentation.

Specifically, it:

  • Removed @ApiExcludeEndpoint() from the diff and publish endpoints in EnvironmentsController.
  • Added @SdkMethodName decorators and comprehensive Swagger annotations (@ApiOperation, @ApiParam, @ApiBody) to these endpoints.
  • Updated ResourceDiffDto to correctly use DiffActionEnum with enumName for Swagger rendering.
  • Introduced SyncActionEnum in sync.types.ts and 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-v2 diff and publish APIs public, as requested in NV-7108, and to ensure their response DTOs are properly annotated for correct Swagger documentation rendering. The existing v2 sync-workflow API remains unchanged.

Screenshots

N/A - This change primarily involves API exposure and documentation improvements.


Linear Issue: NV-7108

Open in Cursor Open in Web

- 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
Copy link
Contributor

cursor bot commented Feb 11, 2026

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@linear
Copy link

linear bot commented Feb 11, 2026

@netlify
Copy link

netlify bot commented Feb 11, 2026

👷 Deploy Preview for dashboard-v2-novu-staging processing.

Name Link
🔨 Latest commit 4de192f
🔍 Latest deploy log https://app.netlify.com/projects/dashboard-v2-novu-staging/deploys/69a05314f6fa4b0008469353

@scopsy scopsy changed the title Environments v2 API swagger feat(api-service): Environments v2 publish API fixes NV-7108 Feb 11, 2026
…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>
@scopsy scopsy marked this pull request as ready for review February 15, 2026 21:43
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 15, 2026

Walkthrough

This pull request refactors the environments-v2 module to replace string literal unions with typed enums. It introduces DiffActionEnum and SyncActionEnum across sync operation types, DTOs, and result builders. ResourceTypeEnum is applied to resourceType properties in multiple DTOs. Changes include updated imports, method signatures using the new enum types, and constant values referencing enum members. Additional adjustments include Swagger metadata enhancements on controller endpoints for publish and diff operations. The refactoring maintains existing functionality while improving type safety and API documentation consistency.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat(api-service): Environments v2 publish API fixes NV-7108' directly summarizes the main change: exposing and fixing the v2 publish/diff APIs with proper documentation.
Description check ✅ Passed The description clearly explains what changed (removed @ApiExcludeEndpoint, added decorators, introduced enums) and why (to make APIs public and fix Swagger documentation), with reference to issue NV-7108.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into next

✏️ 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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
apps/api/src/app/environments-v2/usecases/sync-strategies/constants/sync.constants.ts (1)

7-12: SYNC_ACTIONS is now a redundant mirror of SyncActionEnum.

Since every value in SYNC_ACTIONS is just a re-export of the corresponding SyncActionEnum member, callers could reference the enum directly (e.g., SyncActionEnum.CREATED instead of SYNC_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, and SkippedWorkflowDto handle all resource types (workflows, layouts, etc.) as evidenced by the ResourceTypeEnum field and descriptions saying "Resource." Consider renaming to SyncedResourceDto, FailedResourceDto, and SkippedResourceDto to avoid confusion — especially since these are now publicly exposed via Swagger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants