Bug Report Checklist
Description
allVars does not contain the properties when the properties are on the same level as the allOf
Simlar to Object3 in issue_16797.yaml
openapi-generator version
7.4
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: OpenAPI definition
version: '1.0'
paths:
/pets:
get:
summary: Get all pets
operationId: getAllPets
responses:
default:
description: ok
components:
schemas:
Pet:
type: object
properties:
petType:
type: string
discriminator:
propertyName: petType
Cat:
allOf:
- $ref: '#/components/schemas/Pet'
type: object
properties:
name:
type: string
Ps: the issue also exists if there is no discriminator
Generation Details
Spring generator (probably all generators that support inheritance)
Steps to reproduce
use this templates/pojo.mustache for demonstration
/**
allVars
=======
{{#allVars}}{{name}} {{/allVars}}
vars
=======
{{#vars}}{{name}} {{/vars}}
parentVars
========
{{#parentVars}}{{name}} {{/parentVars}}
*/
openapi-generator-cli generate -g spring -i allvarSample.yaml -o out -t templates
Cat.java has an invalid allVars. It should contain name.
/**
allVars
========
petType
vars
========
name
parentVars
========
petType
*/
Related issues/PRs
Suggest a fix
Add a normalizer that transforms the model into
Cat:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
name:
type: string
Bug Report Checklist
Description
allVars does not contain the properties when the properties are on the same level as the allOf
Simlar to Object3 in issue_16797.yaml
openapi-generator version
7.4
OpenAPI declaration file content or url
Ps: the issue also exists if there is no discriminator
Generation Details
Spring generator (probably all generators that support inheritance)
Steps to reproduce
use this templates/pojo.mustache for demonstration
openapi-generator-cli generate -g spring -i allvarSample.yaml -o out -t templates
Cat.java has an invalid allVars. It should contain name.
Related issues/PRs
Suggest a fix
Add a normalizer that transforms the model into