Handle discriminator for transformers
Description
Hi, here is a pretty common openapi.yaml using a simple discriminator, and it would be great if the transformer could handle the getPets that can output cats and dogs with each one their own date fields.
for now it output a transformer for the endpoint getCats of cats only, but not the pets one for cats or dogs
openapi.yaml
openapi: 3.0.0
info:
title: (title)
version: 0.0.0
tags: []
paths:
/cats:
get:
operationId: getCats
parameters: []
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Cat'
/pets:
get:
operationId: getPets
parameters: []
responses:
'200':
description: The request has succeeded.
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Pet'
components:
schemas:
Cat:
type: object
required:
- type
- napDate
properties:
type:
type: string
enum:
- cat
napDate:
type: string
format: date-time
allOf:
- type: object
required:
- type
- name
- birthDate
properties:
type:
type: string
enum:
- cat
name:
type: string
birthDate:
type: string
format: date-time
Dog:
type: object
required:
- type
- walkDate
properties:
type:
type: string
enum:
- dog
walkDate:
type: string
format: date-time
allOf:
- type: object
required:
- type
- name
- birthDate
properties:
type:
type: string
enum:
- dog
name:
type: string
birthDate:
type: string
format: date-time
Pet:
type: object
oneOf:
- $ref: '#/components/schemas/Cat'
- $ref: '#/components/schemas/Dog'
discriminator:
propertyName: type
mapping:
cat: '#/components/schemas/Cat'
dog: '#/components/schemas/Dog'
PetType:
type: string
enum:
- cat
- dog
This is a duplicate of #2808
Technically he was first, but interesting you had the same idea few minutes apart
@mrlubos both are duplicates of each other :) It doesn't matter which stays open :), all that matters is that here is one :)
Kinda crazy we had the same idea in matters of minutes, and all about cats and dogs endpoints too.