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.

[BUG] invalid types generated (Array & Array<T>;)

See original GitHub issue

@openapitools/openapi-generator-cli: ^1.0.18-4.3.1 openapi: https://solver.314ecorp.tech/openapi?format=json command: node node_modules/@openapitools/openapi-generator-cli/bin/openapi-generator generate -i https://solver.314ecorp.tech/openapi?format=json -g typescript-axios --skip-validate-spec -o ./src/client/generatedApis

Types generated Array & Array<T> for some schema. Here for the 1st type Array there is no generic <T> making problem

/**
 * 
 * @export
 * @interface Unit
 */
export interface Unit {
    /**
     * 
     * @type {string}
     * @memberof Unit
     */
    id?: string;
    /**
     * 
     * @type {string}
     * @memberof Unit
     */
    name?: string;
    /**
     * 
     * @type {number}
     * @memberof Unit
     */
    physiciansToSmeRatioCeiling?: number;
    /**
     * 
     * @type {Array & Array<ApplicationSkill>}
     * @memberof Unit
     */
    requiredApplicationSkillSet: Array & Array<ApplicationSkill>;
    /**
     * 
     * @type {number}
     * @memberof Unit
     */
    usersToSmeRatioCeiling?: number;
}

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
karthik-hrcommented, Sep 28, 2020

version: 5.0.0-beta2 Array & Array<T> has been changed to Set & Set<T> Typescript compiler expecting generic <T> for Set

ERROR in [at-loader] ./submodules/roster-solver-redux/src/client/generatedApis/api.ts:409:26 
    TS2314: Generic type 'Set<T>' requires 1 type argument(s).
/**
 * 
 * @export
 * @interface Unit
 */
export interface Unit {
    /**
     * 
     * @type {string}
     * @memberof Unit
     */
    id?: string;
    /**
     * 
     * @type {string}
     * @memberof Unit
     */
    name?: string;
    /**
     * 
     * @type {number}
     * @memberof Unit
     */
    physiciansToSmeRatioCeiling?: number;
    /**
     * 
     * @type {Array & Array<ApplicationSkill>}
     * @memberof Unit
     */
    requiredApplicationSkillSet: Set & Set<ApplicationSkill>;
    /**
     * 
     * @type {number}
     * @memberof Unit
     */
    usersToSmeRatioCeiling?: number;
}
1reaction
evergreen-lee-campbellcommented, Jan 12, 2021

If it helps, I faced a similar issue just yesterday to do with the fact that the server itself was generating a definition for Set and Array without actually adding them to the definitions node in the generated JSON schema, because the server was running an old version of Springfox which did not handle Map<> types well. Upgrading Springfox to 3.0.0 on the server resolved the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: invalid types for array subscripts - c++ - Stack Overflow
error : invalid types for array subscripts ... When I compile I got this: pex.cpp: In function 'int main()': pex.cpp:25:31: error: invalid types...
Read more >
RangeError: invalid array length - JavaScript - MDN Web Docs
The JavaScript exception "Invalid array length" occurs when specifying an array length that is either negative, a floating number or exceeds ...
Read more >
Invalid type. Expected Object but got Array
Hi, Parse Json throws the error. I am not sure using what input we need to use to 'generate from sample'. Please advise....
Read more >
Arrays - D Programming Language
Void arrays cannot be converted back to the original type without using a cast, and it is an error to convert to an...
Read more >
How to Handle the Incompatible Types Error in Java - Rollbar
This might seem like a syntax error, but it is a logical error discovered in the semantic phase of compilation. The error message...
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