Skip to content

[Schema Inaccuracy] Webhook field definitions are missing "type" #3432

Open
@ksitze

Description

@ksitze

Schema Inaccuracy

As part of digging through the Webhooks schemas I'm finding several dozen errors where schema types are missing.

Here are a few examples:

jq ."gpg-key".properties.subkeys.items.properties.subkeys.items < schemas.json
{}

jq ."webhook-code-scanning-alert-created".properties.alert.properties.dismissed_at
{
  "description": "The time that the alert was dismissed in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.",
  "nullable": true
}

jq ."webhook-code-scanning-alert-created".properties.alert.properties.dismissed_by
{
  "nullable": true
}

jq ."webhook-code-scanning-alert-created".properties.alert.properties.dismissed_reason
{
  "description": "The reason for dismissing or closing the alert. Can be one of: `false positive`, `won't fix`, and `used in tests`.",
  "nullable": true
}

jq ."webhook-code-scanning-alert-created".properties.alert.properties.fixed_at
{
  "nullable": true
}

Expected

The attached jq.paths.log file contains all entities detected to be missing a type field. The paths are all relative to the .components.schema definitions in the 11MB OpenAPI file api.github.com.json as found in the GitHub repository github/rest-api-description.

Reproduction Steps

Download the attached file:

jq.paths.log

Download GitHub's JSON formatted OpenAPI definition file.

% curl --output api.github.com.json \
     https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json

Extract out the schema section:

% jq '.components.schemas' < api.github.com.json > schemas.json

The relevant JSON paths in jq.paths.log can be explored.

while read line
do
    printf "\njq '%s'\n" "${line}"
    jq "${line}" schemas.json
done < jq.paths.log

Each of the indicated JSON paths reference a schema element missing a type declaration. Most are likely "type": "string" (with a corresponding format (e.g., date-time)) but it is not obvious in certain cases what the correct values are.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions