question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Issues with latest package

See original GitHub issue

My Swagger JSON is as follows:

{
  "openapi": "3.0.1",
  "info": {
    "title": "General",
    "version": "v1"
  },
  "paths": {
    "/health": {
      "get": {
        "tags": [
          "General"
        ],
        "operationId": "healthGet",
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/sponsors/{beneficiaryId}": {
      "get": {
        "tags": [
          "General"
        ],
        "operationId": "api/sponsors/{beneficiaryId}Get",
        "parameters": [
          {
            "name": "beneficiaryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.Beneficiary.Request"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.Beneficiary.Request"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.Beneficiary.Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.Beneficiary.Response"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.Beneficiary.Response"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.Beneficiary.Response"
                }
              }
            }
          }
        }
      }
    },
    "/api/sponsors/{beneficiaryId}/{reference}": {
      "post": {
        "tags": [
          "General"
        ],
        "operationId": "api/sponsors/{beneficiaryId}/{reference}Post",
        "parameters": [
          {
            "name": "beneficiaryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Post.Request"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Post.Request"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Post.Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      },
      "get": {
        "tags": [
          "General"
        ],
        "operationId": "api/sponsors/{beneficiaryId}/{reference}Get",
        "parameters": [
          {
            "name": "beneficiaryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Request"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Request"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Response"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Response"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Response"
                }
              }
            }
          }
        }
      }
    },
    "/api/signup/from-github": {
      "post": {
        "tags": [
          "General"
        ],
        "operationId": "api/signup/from-githubPost",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.FromGitHub.Request"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.FromGitHub.Request"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.FromGitHub.Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.FromGitHub.Response"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.FromGitHub.Response"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.FromGitHub.Response"
                }
              }
            }
          }
        }
      }
    },
    "/api/signup/as-beneficiary": {
      "post": {
        "tags": [
          "General"
        ],
        "operationId": "api/signup/as-beneficiaryPost",
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/signup/activate-stripe-account/{userId}": {
      "get": {
        "tags": [
          "General"
        ],
        "operationId": "api/signup/activate-stripe-account/{userId}Get",
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.ActivateStripeAccountUserId.Request"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.ActivateStripeAccountUserId.Request"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Signup.ActivateStripeAccountUserId.Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/browser/{beneficiaryId}/{reference}": {
      "get": {
        "tags": [
          "General"
        ],
        "operationId": "api/browser/{beneficiaryId}/{reference}Get",
        "parameters": [
          {
            "name": "beneficiaryId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "reference",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Browser.BeneficiaryIdReference.Request"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Browser.BeneficiaryIdReference.Request"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Browser.BeneficiaryIdReference.Request"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Sponsorkit.Domain.Api.Browser.BeneficiaryIdReference.Request": {
        "type": "object",
        "properties": {
          "beneficiaryId": {
            "type": "string",
            "format": "uuid"
          },
          "reference": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Signup.ActivateStripeAccountUserId.Request": {
        "type": "object",
        "properties": {
          "userId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Signup.FromGitHub.Request": {
        "type": "object",
        "properties": {
          "gitHubAuthenticationCode": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Signup.FromGitHub.Response": {
        "type": "object",
        "properties": {
          "token": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.Beneficiary.Request": {
        "type": "object",
        "properties": {
          "beneficiaryId": {
            "type": "string",
            "format": "uuid"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.Beneficiary.Response": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "gitHubId": {
            "type": "integer",
            "format": "int64",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.DonationsResponse": {
        "type": "object",
        "properties": {
          "totalInHundreds": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "monthlyInHundreds": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorResponse": {
        "type": "object",
        "properties": {
          "monthlyAmountInHundreds": {
            "type": "integer",
            "format": "int32",
            "nullable": true,
            "readOnly": true
          },
          "totalAmountInHundreds": {
            "type": "integer",
            "format": "int32",
            "readOnly": true
          },
          "startedAtUtc": {
            "type": "string",
            "format": "date-time",
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorsByAmountResponse": {
        "type": "object",
        "properties": {
          "most": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorResponse"
            },
            "readOnly": true
          },
          "least": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorResponse"
            },
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorsByDateResponse": {
        "type": "object",
        "properties": {
          "latest": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorResponse"
            },
            "readOnly": true
          },
          "oldest": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorResponse"
            },
            "readOnly": true
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorsResponse": {
        "type": "object",
        "properties": {
          "current": {
            "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorResponse"
          },
          "byAmount": {
            "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorsByAmountResponse"
          },
          "byDate": {
            "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorsByDateResponse"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Request": {
        "type": "object",
        "properties": {
          "beneficiaryId": {
            "type": "string",
            "format": "uuid"
          },
          "reference": {
            "type": "string"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Response": {
        "type": "object",
        "properties": {
          "donations": {
            "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.DonationsResponse"
          },
          "sponsors": {
            "$ref": "#/components/schemas/Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Get.Models.Sponsor.SponsorsResponse"
          }
        },
        "additionalProperties": false
      },
      "Sponsorkit.Domain.Api.Sponsors.BeneficiaryIdReference.Post.Request": {
        "type": "object",
        "properties": {
          "beneficiaryId": {
            "type": "string",
            "format": "uuid"
          },
          "reference": {
            "type": "string"
          },
          "amountInHundreds": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "email": {
            "type": "string",
            "nullable": true
          },
          "stripeCardId": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    }
  }
}

Now, I am generating my client with the following command-line:

autorest --reset && autorest --clear-output-folder --use-core-v2 --package-name=@sponsorkit/client --v3 --markOpenAPI3ErrorsAsWarning --typescript --input-file=http://localhost:5000/swagger/v1/swagger.json --output-folder=./src/api/openapi && cd ./src/api/openapi && npm i && npm run build

But when I try to use it, with the code:

import { General } from "./openapi/src/general";

export const apiClient = new General(
{
    getToken: async () => ({token: "dummy", expiresOnTimestamp: 13371337})
},
"");

Then I get the error:

image

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
sarangan12commented, Jun 3, 2021

It is the same as the issue reported in https://github.com/Azure/autorest.typescript/issues/1004. I am able to reproduce the issue locally.

Now, when I use the same test file within the V6 SDK Generator package as one of the integration test case, I do not get this error. It works fine.

But, when I use the released @autorest/typescript package and then use it for the same swagger, I get this error. Now, the problem is not with the code itself (if so, it will occur in both cases). I suspect, that the way it is compiled (setting the target, moduleresolution, etc) is the one thats causing the problem.

I have not found a solution yet for this problem. I will update this issue once I have a solution.

2reactions
ramya-rao-acommented, Jun 2, 2021

Thanks for reporting @ffMathy

@sarangan12 Can you please take a look?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrading R: package compatibility issues - Amazon AWS
There are two possible sources of problems with R version upgrades, both of which are related to package libraries. (A library is a...
Read more >
[BUG] npx won't execute the latest version of a package #5262
This issue exists in the latest npm version ... I expect npx <package>@latest to always run the latest version of a package.
Read more >
Package Manager Issues (Pop!_OS) - System76 Support
Here are ways to fix update, upgrade, and other package manager issues.
Read more >
Challenges in Package Management | R-bloggers
So let's look at some of the common challenges associated with package management, understand why it's difficult, and how we can do better....
Read more >
Fix Package Manager Issues - Zorin Help
Here are ways to resolve installation, update, upgrade, and other package-related issues.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found