Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove ruleset objects, various description updates #367

Closed
wants to merge 38 commits into from

Conversation

octokitbot
Copy link
Contributor

I found new changes in GitHub's official OpenAPI specifications and thought I'd let you know about it 👋🤖

I can't tell if the changes include fixes, features, breaking changes or just cache updates, you'll have to figure that out on yourself and adapt the commit messages accordingly to trigger the right release, see our commit message conventions.

@octokitbot octokitbot added the Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR label Jun 10, 2023
@kfcampbell kfcampbell changed the title 🤖📯 GitHub OpenAPI Update feat: remove ruleset objects, various description updates Jun 27, 2023
@kfcampbell
Copy link
Member

Interestingly, the tests are failing due to an invalid JSON description. Here's the offending material in generated/api.github.com.deref.json

JSON snippet

   "/orgs/{org}/blocks/{username}": {
      "get": {
        "summary": "Check if a user is blocked by an organization",
        "description": "Returns a 204 if the given user is blocked by the given organization. Returns a 404 if the organization is not blocking the user, or if the user account has been identified as spam by GitHub.",
        "tags": [
          "orgs"
        ],
        "operationId": "orgs/check-blocked-user",
        "externalDocs": {
          "description": "API method documentation",
          "url": "https://docs.github.com/rest/reference/orgs#check-if-a-user-is-blocked-by-an-organization"
        },
        "parameters": [
          {
            "name": "org",
            "description": "The organization name. The name is not case sensitive.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          "304": {
            "description": "Not modified"
          },
          "401": {
            "description": "Requires authentication",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Basic Error",
                  "description": "Basic Error",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "documentation_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },
        "x-github": {
          "githubCloudOnly": false,
          "enabledForGitHubApps": true,
          "category": "orgs",
          "subcategory": "blocking"
        },
        "x-octokit": {}
      },
      "put": {
        "summary": "Block a user from an organization",
        "description": "Blocks the given user on behalf of the specified organization and returns a 204. If the organization cannot block the given user a 422 is returned.",
        "tags": [
          "orgs"
        ],
        "operationId": "orgs/block-user",
        "externalDocs": {
          "description": "API method documentation",
          "url": "https://docs.github.com/rest/reference/orgs#block-a-user-from-an-organization"
        },
        "parameters": [
          {
            "name": "org",
            "description": "The organization name. The name is not case sensitive.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          "404": {
            "description": "Resource not found",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Basic Error",
                  "description": "Basic Error",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "documentation_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "500": {
            "description": "Internal Error",
            "content": {
              "application/json": {
                "schema": {
                  "title": "Basic Error",
                  "description": "Basic Error",
                  "type": "object",
                  "properties": {
                    "message": {
                      "type": "string"
                    },
                    "documentation_url": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        },

Here's the other offense, from generated/ghec.deref.json:

JSON snippet

"/orgs/{org}/packages": {
      "get": {
        "summary": "List packages for an organization",
        "description": "Lists packages in an organization readable by the user.\n\nTo use this endpoint, you must authenticate using an access token with the `read:packages` scope. If the `package_type` belongs to a registry that only supports repository-scoped permissions, your token must also include the `repo` scope. For the list of GitHub Packages registries that only support repository-scoped permissions, see \"[About permissions for GitHub Packages](https://docs.github.com/enterprise-cloud@latest//packages/learn-github-packages/about-permissions-for-github-packages#permissions-for-repository-scoped-packages).\"",
        "tags": [
          "packages"
        ],
        "operationId": "packages/list-packages-for-organization",
        "externalDocs": {
          "description": "API method documentation",
          "url": "https://docs.github.com/enterprise-cloud@latest//rest/reference/packages#list-packages-for-an-organization"
        },
        "parameters": [
          {
            "name": "package_type",
            "description": "The type of supported package. Packages in GitHub's Gradle registry have the type `maven`. Docker images pushed to GitHub's Container registry (`ghcr.io`) have the type `container`. You can use the type `docker` to find images that were pushed to GitHub's Docker registry (`docker.pkg.github.com`), even if these have now been migrated to the Container registry.",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "npm",
                "maven",
                "rubygems",
                "docker",
                "nuget",
                "container"
              ]
            }
          },
          {
            "name": "org",
            "description": "The organization name. The name is not case sensitive.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "visibility",
            "description": "The selected visibility of the packages.  This parameter is optional and only filters an existing result set.\n\nThe `internal` visibility is only supported for GitHub Packages registries that allow for granular permissions. For other ecosystems `internal` is synonymous with `private`.\nFor the list of GitHub Packages registries that support granular permissions, see \"[About permissions for GitHub Packages](https://docs.github.com/enterprise-cloud@latest//packages/learn-github-packages/about-permissions-for-github-packages#granular-permissions-for-userorganization-scoped-packages).\"",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "public",
                "private",
                "internal"
              ]
            }
          },
          {
            "name": "page",
            "description": "Page number of the results to fetch.",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 1
            }
          },
          {
            "name": "per_page",
            "description": "The number of results per page (max 100).",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 30
            }
          }
        },
        "responses": {

These are both org endpoints, though they are different ones so it seems unlikely the error is due to a root schema issue. More investigation here is required.

@kfcampbell
Copy link
Member

@gr2m I'd like to ask you for advice about how I might troubleshoot this further if that's okay!

@gr2m
Copy link
Contributor

gr2m commented Jun 28, 2023

The problem seems to be that the path paths."/orgs/{org}/packages/{package_type}/{package_name}/restore" exists twice and that is forbidden is forbidden in JSON Schema

@gr2m
Copy link
Contributor

gr2m commented Jun 28, 2023

@gr2m
Copy link
Contributor

gr2m commented Jun 28, 2023

Also this is invalid JSON:

        "parameters": [
          {
            "$ref": "#/components/parameters/package-type"
          },
          {
            "$ref": "#/components/parameters/package-name"
          },
          "422": {
            "$ref": "#/components/responses/validation_failed"
          },
          "500": {
            "$ref": "#/components/responses/internal_error"
          }
        },

An array item can be "422": { ... } without being wrapped in braces { "422": { ... } }

@gr2m
Copy link
Contributor

gr2m commented Jun 28, 2023

Running npm run download resolves that problem, but also seems to introduce lots of new changes that will need to be reviewed :(

@ollie-iterators
Copy link

Perhaps #364 should be merged before this PR is merged.

@nickfloyd
Copy link
Contributor

nickfloyd commented Jul 18, 2023

There appear to be more issues with ghes-3.8-diff-to-ghes-3.9.json.

@wolfy1339 wolfy1339 closed this Sep 9, 2023
@wolfy1339 wolfy1339 deleted the update branch September 9, 2023 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Maintenance Any dependency, housekeeping, and clean up Issue or PR
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

6 participants