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.

Cannot read property 'key' of undefined / TypeError: Cannot read property 'key' of undefined

See original GitHub issue

Before filling a bug

  • have you checked the faq for known issues.
  • have you checked existing issues

Describe the bug I am attempting to generate a client from the rundeck api specs. My configuration file is pretty basic and likely to be incomplete, however the error indicates it doesn’t have knowledge of my input-files even though they’re loaded right before the output you see below. rundeck-api-specs

Please provide as much information as you can. This would be:

  • OpenAPI files having the issues
DEBUG [4.66 s]: openapi-document/loader-openapi - END [2.09 s]
DEBUG [4.66 s]: openapi-document/individual/transform - SKIPPING
DEBUG [4.66 s]: openapi-document/individual/schema-validator-openapi - SKIPPING
DEBUG [4.66 s]: swagger-document/loader-swagger - END [2.09 s]
DEBUG [4.66 s]: openapi-document/individual/identity - SKIPPING
DEBUG [4.66 s]: swagger-document/individual/transform - SKIPPING
DEBUG [4.66 s]: swagger-document/individual/schema-validator-swagger - SKIPPING
DEBUG [4.66 s]: swagger-document/identity - SKIPPING
DEBUG [4.66 s]: swagger-document/individual/identity - SKIPPING
DEBUG [4.66 s]: openapi-document/openapi-document-converter - SKIPPING
DEBUG [4.66 s]: openapi-document/transform - START inputs = 0
DEBUG [4.66 s]: openapi-document/transform - END [0 s]
DEBUG [4.66 s]: openapi-document/allof-cleaner - START inputs = 0
DEBUG [4.66 s]: openapi-document/allof-cleaner - END [0 s]
DEBUG [4.66 s]: openapi-document/tree-shaker - START inputs = 0
DEBUG [4.66 s]: openapi-document/tree-shaker - END [0 s]
DEBUG [4.66 s]: openapi-document/multi-api-merger - START inputs = 0
C:\Users\Chad.Robinson\.autorest\@autorest_core@3.1.3\node_modules\@autorest\core\dist\src_lib_autorest-core_ts.js - FAILURE {}
Process() cancelled due to exception : **Cannot read property 'key' of undefined / TypeError: Cannot read property 'key' of undefined**
    at MultiAPIMerger.get currentInputFilename [as currentInputFilename] (C:\Users\<insert_name_here>\.autorest\@autorestcore@3.1.3\node_modules\@autorest\core\dist\src_lib_autorest-corets.js:12732:31)
    at MultiAPIMerger.finish (C:\Users\<insert_name_here>\.autorest\@autorestcore@3.1.3\node_modules\@autorest\core\dist\src_lib_autorest-corets.js:3419:94)
    at MultiAPIMerger.runProcess (C:\Users\<insert_name_here>\.autorest\@autorestcore@3.1.3\node_modules\@autorest\core\dist\src_lib_autorest-corets.js:12741:24)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at MultiAPIMerger.getOutput (C:\Users\<insert_name_here>\.autorest\@autorestcore@3.1.3\node_modules\@autorest\core\dist\src_lib_autorest-corets.js:12672:9)
    at merge (C:\Users\<insert_name_here>\.autorest\@autorestcore@3.1.3\node_modules\@autorest\core\dist\src_lib_autorest-corets.js:3616:54)
    at ScheduleNode (C:\Users\<insert_name_here>\.autorest\@autorestcore@3.1.3\node_modules\@autorest\core\dist\src_lib_autorest-corets.js:1809:33)
  • Autorest command used
 autorest .\config-file.json --csharp --verbose --debug

Expected behavior The command should have finished for generating a csharp client.

Additional context AutoRest code generation utility [cli version: 3.4.2; node: v12.19.1]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
timotheeguerincommented, Nov 12, 2021

Well there is 3 ways you can go about it:

  • Use some kind of swagger emitter if you control the code(like swashbuckle for dotnet). You add anotation to the controllers and it will generate the swagger spec:
    • Pros:
      • Little work required
    • Cons:
      • Swagger is not meant to describe a SDK and those tools will most likely not generate optimal spec for describing a SDK which might result in bad experience for sdk user.
      • Much harded to noticed that you are producing breaking change to your SDK(if it matters)
  • Write the swagger specs by hand. This is the most tedious but recommended for the best SDK.
    • Pros:
      • You can define the spec in a correct manner that is more meaningful for a SDK.
      • As you have to define everything here you can pay more attention to breaking changes.
    • Cons:
      • Very tedious, swagger is very verbose, hard to write and validate.
  • Use an alternate language: Cadl (Or some other ones)
    • Pros:
      • all of the aboves
      • much nicer experience: provide live validation in vscode, strict compile, etc.
    • Cons:
      • another language to learn
      • not released yet, might be some breaking changes in the language as we move forward.
0reactions
krptodrcommented, Nov 12, 2021

Thank you, I can appreciate the time you took to help me out today. I will take a look into those options you provided.

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'key' of undefined · Issue #5838
If i remove one tr from the template, the problem goes away ! <template v-for="msg in messages"> <tr v-bind:key="msg.value">{{ ...
Read more >
Cannot read property 'key' of undefined - Stack Overflow
I have a few objects and I want to create a 'map' array to store the object with one field key as an...
Read more >
T285482 TypeError: Cannot read property 'key' of undefined
TypeError : Cannot read property 'key' of undefined. exception.trace. at setStatus <anonymous>:35:65 at Object.setBannerShown <anonymous>:38:528 at Object.
Read more >
typeerror: cannot read properties of undefined (reading 'key')
Firstly, the error means that whatever you're using .name on has a value of undefined. Typically this can happen if you're making an...
Read more >
“TypeError: Cannot read property 'key' of undefined” in vue
Error in nextTick: “TypeError: Cannot read property 'key' of undefined” in vue. I used same approach as https://streamable.com/zpk4m to make something ...
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