# Feature NEX-674 - [backport] Improve validation error messages for integration setup API

Project: Stream Nextcloud app "OpenProject Integration"
Status: closed
URL: https://community.openproject.org/work_packages/NEX-674

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions |  Nextcloud Integration 2.12.0 |
| Votes |  |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module |  |
| Feature Flag |  |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |
| Accessibility | No |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers |  |
| Designer |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| Work |  |
| Labor costs |  |

## Description

In the setup integration endpoint, there are some too generic validation errors. we need to improve those errors so that some useful information about the validation error is shown to the client in the response.

Errors to improve:

*   `invalid key`
    
*   `invalid data`
    

Possible alternatives:

*   `Missing required setting: <setting_name>`
    
*   `Invalid value for setting: <setting_name>`
    

<br>

## Test Steps

check with invalid setup requests:

```text
curl -XPOST 'https://nextcloud.local/index.php/apps/integration_openproject/setup' \         
-H'Content-Type: application/json' \
-d'{
 "values":{
  "openproject_instance_url": "test",
  "authorization_method": "oidc",
  "sso_provider_type": "nextcloud_hub",
  "targeted_audience_client_id": "client-id",
  "setup_project_folder": false,
  "setup_app_password": false,
  "default_enable_navigation": false,
  "default_enable_unified_search": false
 }
}' \
-u admin:admin -vk

# Response
400
{"error":"Invalid OpenProject URL."}
```

```text
curl -XPOST 'https://nextcloud.local/index.php/apps/integration_openproject/setup' \
-H'Content-Type: application/json' \
-d'{
 "values":{
  "openproject_instance_url": "http://lol.test", 
  "authorization_method": "",    
  "sso_provider_type": "nextcloud_hub",
  "targeted_audience_client_id": "client-id",
  "setup_project_folder": false,
  "setup_app_password": false,
  "default_enable_navigation": false,
  "default_enable_unified_search": false
 }
}' \
-u admin:admin -vk

# Response
400
{"error":"Invalid authorization method."}
```
