Skip to content

[BUG]: JSON syntax error in version 17.0.0 #473

@ezzatron

Description

@ezzatron

What happened?

Importing version 17.0.0 of this module produces a JSON syntax error:

undefined:63777
          "422": {
               ^

SyntaxError: /path/to/project/node_modules/@octokit/openapi/generated/api.github.com.deref.json: Expected ',' or ']' after array element in JSON at position 3097449
    at parse (<anonymous>)
    at Module._extensions..json (node:internal/modules/cjs/loader:1566:39)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/path/to/project/node_modules/@octokit/openapi/index.js:3:31)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)

Node.js v20.18.0

Looking into the source of generated/api.github.com.deref.json on line 63777 you can see that it's not valid JSON. There's an array, but it seems like something is trying to add in object properties:

{
  "paths": {
    "/orgs/{org}/codespaces/secrets/{secret_name}": {
      "get": {
        "summary": "Get an organization secret",
        "description": "Gets an organization development environment secret without revealing its encrypted value.\n\nOAuth app tokens and personal access tokens (classic) need the `admin:org` scope to use this endpoint.",
        "tags": [
          "codespaces"
        ],
        "operationId": "codespaces/get-org-secret",
        "externalDocs": {
          "description": "API method documentation",
          "url": "https://docs.github.com/rest/codespaces/organization-secrets#get-an-organization-secret"
        },
        "parameters": [
          {
            "name": "org",
            "description": "The organization name. The name is not case sensitive.",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          "422": {
            "description": "Validation failed, or the endpoint has been spammed.",
            "content": {

Versions

  • @octokit/openapi@17.0.0
  • Node.js v20.18.0

Relevant log output

$ node -e 'require("@octokit/openapi");'
node:internal/modules/cjs/loader:1569
    throw err;
    ^

SyntaxError: /path/to/project/node_modules/@octokit/openapi/generated/api.github.com.deref.json: Expected ',' or ']' after array element in JSON at position 3097449
    at parse (<anonymous>)
    at Module._extensions..json (node:internal/modules/cjs/loader:1566:39)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/path/to/project/node_modules/@octokit/openapi/index.js:3:31)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)

Node.js v20.18.0

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type: BugSomething isn't working as documented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions