swagger-api / swagger-api/swagger-codegen

[Typescript-Angular2] Token must be defined in AOT

Open
#6,202 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Hello

i am trying to build my angular / ionic app with generated code from swagger. In JIT mode everything works fine.
Using AOT i get following error

main.js:formatted:304 ERROR Error: Uncaught (in promise): Error: Token must be defined!
Error: Token must be defined!
    at new t (main.js:formatted:3624)
    at t.get (main.js:formatted:3655)
    at Function.t.get (main.js:formatted:3634)
    at t.get (main.js:formatted:3980)
    at e.get [as _UserApi_74] (main.js:formatted:33500)  
    at e.get [as _LoginProvider_97] (main.js:formatted:33652)
    at e.getInternal (

For me it looks like as _UserApi_74, which is a generated artefact produces the error

Swagger-codegen version

2.2.3

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.

Research direction

Start by reproducing the reported Swagger Codegen 2.2.3 output in an Angular AOT build, comparing it with the working JIT build. Trace the generated _UserApi_74 and _LoginProvider_97 entries from the stack trace to the token error. Done means the generated TypeScript client builds and runs under AOT without "Token must be defined!".

Written by the indexing model from the issue text.

Assessment

Tech stack
angular, typescript
Domain
frontend, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.