-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
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: stringPs: 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: stringReactions are currently unavailable