Skip to content

Silence creator and comment is required in the UI but not in the API #2998

Description

@gotjosh

When creating a silence in the UI and leaving the creator and comment empty, you're met with:
Screenshot 2022-07-11 at 14 34 03

However, if you try to execute a silence creation through the API (as long as you have the keys set the value would be empty).

## Create Silence
curl -X "POST" "http://localhost:9093/api/v2/silences" \
     -H 'Content-Type: application/json; charset=utf-8' \
     -d $'{
  "matchers": [
    {
      "value": "test",
      "isRegex": false,
      "isEqual": true,
      "name": "test"
    }
  ],
  "comment": "",
  "endsAt": "2022-07-11T15:37:27.659Z",
  "startsAt": "2022-07-11T13:37:27.659Z",
  "createdBy": ""
}'

This succeeds - and you get:

{
      "id":"73373e3f-a928-450a-ba75-e9254297b483",
      "status":{
         "state":"active"
      },
      "updatedAt":"2022-07-11T13:42:13.444Z",
      "comment":"",
      "createdBy":"",
      "endsAt":"2022-07-11T15:37:27.659Z",
      "matchers":[
         {
            "isEqual":true,
            "isRegex":false,
            "name":"test",
            "value":"test"
         }
      ],
      "startsAt":"2022-07-11T13:42:13.444Z"
   }

This doesn't seem right and it's kind of inconsistent with what the UI allows - should we validate at an API level that "" are not allowed?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions