[Schema Inaccuracy] code_scanning_alert fixed webhook: alert.state typed as null | "fixed" but GitHub sends "dismissed"

Open Beginner friendly
#6,059 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
64/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
openapi
Domain
api

Research direction

Locate the OpenAPI schema for the code_scanning_alert webhook with action "fixed". Compare its alert.state definition with the appeared_in_branch, reopened, and updated_assignment actions, then update the schema so valid dismissed payloads are accepted. Validate the changed specification against the webhook example or schema checks available in the repository.

Written by the indexing model from the issue text.

Description

feature

Expected

In the code_scanning_alert webhook event with action: "fixed", the alert.state property should permit "dismissed" in addition to null and "fixed":

state:
  description: >-
    State of a code scanning alert. Events for alerts found outside the
    default branch will return a `null` value until they are dismissed or
    fixed.
  oneOf:
    - type: "null"
    - enum:
        - fixed
        - dismissed
      type: string

This would be consistent with how the appeared_in_branch, reopened, and updated_assignment actions already define alert.state as null | "open" | "dismissed" | "fixed".

Actual

The webhook schema for code_scanning_alert (action fixed) defines alert.state as only null | "fixed", rejecting the value "dismissed".

Reproduction Steps

  1. Configure a repository webhook (or GitHub App) to receive code_scanning_alert events.
  2. Have a code scanning alert that has been dismissed (e.g., marked as "won't fix").
  3. Merge a PR that fixes the underlying code issue for that dismissed alert.
  4. GitHub delivers a code_scanning_alert webhook with action: "fixed", but the alert.state field is "dismissed" (not "fixed"), because the alert's canonical state remains dismissed.
  5. Attempt to validate this payload against a client generated from the OpenAPI spec. Validation fails because the schema only permits null or "fixed" for alert.state.

Impact

Any strongly-typed client generated from this spec (e.g., githubkit for Python, Octokit for TypeScript) will reject valid code_scanning_alert fixed webhook payloads when the alert was previously dismissed, because "dismissed" does not conform to the null | "fixed" schema.

Error

pydantic_core._pydantic_core.ValidationError: 1 validation error for
tagged-union[...,WebhookCodeScanningAlertFixed,...]
fixed.alert.state
  Input should be 'fixed' [type=literal_error, input_value='dismissed', input_type=str]

Reference

Dominant language
No language data
Stars
1.6k
Forks
342
Avg merge
3h 33m
Merged PRs (30d)
51

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from github/rest-api-description

All issues in github/rest-api-description

Similar issues

More Backend & API Design issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.