Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Workspace]Validate features field in workspace create and update API #7907

Closed
wanglam opened this issue Aug 29, 2024 · 0 comments
Closed

[Workspace]Validate features field in workspace create and update API #7907

wanglam opened this issue Aug 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@wanglam
Copy link
Contributor

wanglam commented Aug 29, 2024

Is your feature request related to a problem? Please describe.

Currently, the workspace create and update API does not have proper validation for the features field. This can lead to inconsistencies between the API and the workspace create/update form, which enforces that each workspace should have only one use case.

The problem arises when the API allows creating or updating a workspace with multiple use cases or invalid use case values in the features field. This can result in workspaces being created or updated with an invalid state, leading to potential issues or errors when using the workspace functionality.

Describe the solution you'd like

To address this issue, we need to add validation logic to the workspace create and update API endpoints to ensure that the features field adheres to the following rules:

  1. The features field must contain at least one valid use case value.
  2. The features field can only contain one use case value (no multiple use cases allowed).
  3. The use case value(s) in the features field must be from the allowed list of use cases (e.g., use-case-observability, use-case-security-analytics, use-case-analytics, use-case-search, use-case-all).

If the features field does not meet these criteria, the API should return an appropriate error response with a descriptive error message, preventing the creation or update of the workspace.

Describe alternatives you've considered

N/A

Additional context

#4944

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant