We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using oneOf in the schema and generating code using typescript-axios generator leads to it injecting NULL_SCHEMA_ERR in the interface declaration.
typescript-axios
NULL_SCHEMA_ERR
Moreover, it sends a warn log message:
[[rootLedger] assets/openapi/rootledger.yaml] [main] WARN o.o.codegen.DefaultCodegen - Null schema found. Default type to `NULL_SCHEMA_ERR`
7.8.0 stable
LedgerFilterBody: type: object oneOf: - required: - ledgerId properties: ledgerId: type: string description: Filter by ledger ID. example: "10120323" - required: - ledgerName properties: ledgerName: type: string description: Filter by ledger name. example: "myledger"
{ "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", "spaces": 2, "generator-cli": { "version": "7.8.0", "generators": { "rootLedger": { "generatorName": "typescript-axios", "inputSpec": "assets/openapi/rootledger.yaml", "output": "src/gen/rootledger", "additionalProperties": { "supportsES6": "true", "withInterfaces": true } } } } }
Generates a problematic interface:
/** * * @export * @interface LedgerFilterBody */ export interface LedgerFilterBody { [key: string]: NULL_SCHEMA_ERR; // -- why???? }
This leads to a build error because NULL_SCHEMA_ERR isn't defined.
Found a few, but none of them lead to NULL_SCHEMA_ERR
If I restructure my schema like below, it starts generating code fine:
LedgerFilterBody: type: object properties: ledgerId: type: string nullable: true description: Filter by ledger ID. ledgerName: type: string nullable: true description: Filter by ledger name. oneOf: - required: [ledgerId] - required: [ledgerName]
/** * * @export * @interface LedgerFilterBody */ export interface LedgerFilterBody { /** * Filter by ledger ID. * @type {string} * @memberof LedgerFilterBody */ 'ledgerId'?: string | null; /** * Filter by ledger name. * @type {string} * @memberof LedgerFilterBody */ 'ledgerName'?: string | null; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Bug Report Checklist
Description
Using oneOf in the schema and generating code using
typescript-axios
generator leads to it injectingNULL_SCHEMA_ERR
in the interface declaration.Moreover, it sends a warn log message:
openapi-generator version
7.8.0 stable
OpenAPI declaration file content or url
Generation Details
Generates a problematic interface:
This leads to a build error because
NULL_SCHEMA_ERR
isn't defined.Steps to reproduce
Related issues/PRs
Found a few, but none of them lead to
NULL_SCHEMA_ERR
Hint
If I restructure my schema like below, it starts generating code fine:
The text was updated successfully, but these errors were encountered: