[Schema Inaccuracy] secret scanning alerts have no required fields

Open
#4,804 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
openapi, typescript
Domain
api

Research direction

Start by locating the secret-scanning-alert schema component and compare its fields with the code-scanning-alert and dependabot_alert components. Use the TypeScript reproduction with secretScanning.getAlert to determine which fields are always returned and which should remain nullable; done means the schema declares the appropriate required fields so those values are no longer typed as possibly undefined.

Written by the indexing model from the issue text.

Description

feature

Schema Inaccuracy

The secret-scanning-alert schema component does not define any required fields, even though some fields are always present (e.g. primary keys). I can't tell on my end what the full list of fields that should be required are, but some obvious ones include:

  • number - unique ID for the alert
  • created_at
  • updated_at
  • url
  • html_url
  • state
  • secret_type
  • secret_type_display_name
  • secret
  • validity

Some fields are also marked nullable: true, so it's possible all fields are actually required (e.g. returned in a "GetAlert" response) with some being nullable instead.

For comparison, the code-scanning-alert and dependabot_alert (similar APIs also part of GitHub Advanced Security) have required fields.

Expected

The secret-scanning-alert schema component should define required fields.

Reproduction Steps

import { Octokit } from 'octokit';

const octokit = new Octokit({ auth: 'personal-access-token-here' });

const { data: alert } = await octokit.rest.secretScanning.getAlert({
    owner: 'sample-owner', 
    repo: 'sample-repo',
    alert_number: 1234
});

Using TypeScript, review type of fields in alert - they will all include | undefined.

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.