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
  • #3613
Closed
Open
Issue created Aug 12, 2019 by Administrator@rootContributor

[BUG] Composed properties are missing from allVars

Created by: glennschmidt

Description

When a model includes properties by composition (allOf, without a discriminator), these properties end up in the vars template variable but they are missing from the allVars variable.

I would expect allVars to include, at minimum, everything in vars. Some generators only iterate allVars when producing a model class, so they will be missing these composed properties.

openapi-generator version

4.1.0

OpenAPI declaration file content or url

https://gist.github.com/glennschmidt/d5e87fe518ac5afc7c39032ae1df479e

Command line used for generation

openapi-generator generate -i openapi.json -g swift4 -o apigen

Steps to reproduce
  1. Execute the above CLI with the schema from the linked gist
  2. Look at the generated output apigen/OpenAPIClient/Classes/OpenAPIs/Models/EventCollection.swift

It will contain

public struct EventCollection: Codable {


    public init() {
    }


}

ie. The EventCollection model has no properties, but it should have

  • page
  • page_count
  • page_size
  • total_items
  • events
Suggest a fix

In DefaultCodegen.fromModel(), when adding composed properties to properties, also add them to allProperties (i will submit a PR with this).

Assignee
Assign to
Time tracking