Skip to content

Fix NotNullViolation in issues API

Vasilii Iakliushin requested to merge 393030_fix_null_violation_error into master

What does this MR do and why?

Contributes to #393030 (closed)

Sentry error: https://new-sentry.gitlab.net/organizations/gitlab/issues/1915

Problem

It's possible to provide an empty value for "confidential" field. It raises an exception because of constraint violation.

Solution

Use allow_blank to prevent the submission of empty values for confidential field.

How to set up and validate locally

curl --request POST --header "PRIVATE-TOKEN: <your_access_token>" "http://127.0.0.1:3000/api/v4/projects/2/issues?title=issue&confidential="

Before

{"message":"500 Internal Server Error"}

After

{"error":"confidential is empty"}

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Vasilii Iakliushin

Merge request reports

Loading