Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2438
Closed
Open
Issue created Mar 18, 2019 by Administrator@rootContributor

[BUG] [Javascript] Required properties of composed models not included in constructor parameters

Created by: kvsm

Description

Model schemas which use allOf to compose other schemas produce constructors which do not have parameters for the required properties of their composed classes. This results in invalid code which produces ReferenceErrors.

Example which reproduces this error: https://github.com/kvsm/test-api

The bug is evident at https://github.com/kvsm/test-api/blob/b9c2f82b283a6c6bd199eb40655c441081dd0680/client/src/Model/DescribedThing.js#L30 where ReferenceError: name is not defined will be thrown.

openapi-generator version

4.0.0-SNAPSHOT

OpenAPI declaration file content or url

https://github.com/kvsm/test-api/blob/master/TestAPI.json

Command line used for generation

docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate -i /local/TestAPI.json -g javascript -c /local/config-javascript.json -o /local/client

Steps to reproduce

See https://github.com/kvsm/test-api; or:

  1. Create an OpenAPI schema containing a model schema which composes one or more schemas having required properties.
  2. Generate javascript client with said schema.
  3. Execute npm install && npm run test in generated client project.
Expected output

Tests execute successfully.

Actual output

Tests fail with ReferenceError.

Assignee
Assign to
Time tracking