Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported type definition #3

Closed
ruschka opened this issue Sep 3, 2018 · 2 comments
Closed

Unsupported type definition #3

ruschka opened this issue Sep 3, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@ruschka
Copy link

ruschka commented Sep 3, 2018

Hi,
consider following swagger example:

{
    ...
    definitions: {
        Abc: {
            properties: {
                id: {
                type: "string"
            }
        },
        ArrayOfAbc: {
            type: "array",
            items: {
                $ref: "#/definitions/Abc"
            }
        }
    },
    ...
}

Method createDefinitionClass in definitionCodegen.ts expects all types have property properties, but array doesn't. Generation with such swagger file fails with error:

(node:16624) UnhandledPromiseRejectionWarning: TypeError: Cannot convert undefined or null to object
    at Function.entries (<anonymous>)
    at createDefinitionClass (C:\Data\node\logio-promo-pricing\node_modules\swagger-axios-codegen\dist\definitionCodegen.js:65:39)
    at Object.definitionsCodeGen (C:\Data\node\logio-promo-pricing\node_modules\swagger-axios-codegen\dist\definitionCodegen.js:101:34)
    at codegen (C:\Data\node\logio-promo-pricing\node_modules\swagger-axios-codegen\dist\index.js:56:38)
    at Object.<anonymous> (C:\Data\node\logio-promo-pricing\packages\data-pump\src\swagger\codegen.js:3:1)
    at Module._compile (module.js:649:14)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
@Manweill
Copy link
Owner

Manweill commented Sep 4, 2018

It is usually not like this, you can see example.
But, I will fix this issue in next version

@Manweill Manweill added the bug Something isn't working label Sep 4, 2018
@Manweill
Copy link
Owner

fix in 0.3

Manweill pushed a commit that referenced this issue Jan 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants