openapi-generator
openapi-generator copied to clipboard
[BUG][dart-dio] Using oneOf together with allOf does not generate properties
Bug Report Checklist
- [x] Have you provided a full/minimal spec to reproduce the issue?
- [x] Have you validated the input using an OpenAPI validator (example)?
- [x] Have you tested with the latest master to confirm the issue still exists?
- [x] Have you searched for related issues/PRs?
- [x] What's the actual output vs expected output?
- [ ] [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
dart-dio does not generate properties for models when using oneOf together with allOf. The schema posted below generates the following code:
// ...
/// Dog
///
/// Properties:
/// * [petType]
/// * [hunts]
/// * [age]
/// * [bark]
/// * [breed]
@BuiltValue()
abstract class Dog implements Pet, Built<Dog, DogBuilder> {
Dog._();
factory Dog([void updates(DogBuilder b)]) = _$Dog;
@BuiltValueHook(initializeBuilder: true)
static void _defaults(DogBuilder b) => b..petType=b.discriminatorValue;
@BuiltValueSerializer(custom: true)
static Serializer<Dog> get serializer => _$DogSerializer();
}
// ...
I'd expect that it generates all properties related to Dog (petType, bark and breed).
openapi-generator version
7.4.0
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: pet
version: 0.0.1
paths:
/pets:
patch:
requestBody:
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
discriminator:
propertyName: pet_type
responses:
'200':
description: Updated
components:
schemas:
Pet:
type: object
required:
- pet_type
properties:
pet_type:
type: string
discriminator:
propertyName: pet_type
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
Dog:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
bark:
type: boolean
breed:
type: string
enum: [Dingo, Husky, Retriever, Shepherd]
Cat:
allOf:
- $ref: '#/components/schemas/Pet'
- type: object
properties:
hunts:
type: boolean
age:
type: integer
Steps to reproduce
openapi-generator-cli generate -i pet.yaml -g dart-dio -o ./pet
Hi there,
Just wanted to gently nudge this issue in case you haven't had a chance to look at it yet. I'm happy to provide any additional information that might be helpful.
Thanks!
@jaumard @josh-burton @amondnet @sbu-WBT @kuhnroyal @agilob @ahmednfwela