intellij-openapi-generator
intellij-openapi-generator copied to clipboard
allOf not working properly
I'm using the webstorm plugin: https://plugins.jetbrains.com/plugin/8433-openapi-generator
I got the following .yaml:
openapi: 3.0.3
info:
title: API
description: Description
version: 1.0.0
contact:
name: API Support
url: 'https://test.de'
servers:
- url: 'https://localhost:1443/dispatch'
description: 'Test'
paths:
/protocols/{protocolId}/addendum/{id}:
get:
security:
- bearerAuth: []
operationId: getProtocolAddendumById
summary: Get all addenda corresponding to the protocol
description: |
Get all addenda corresponding to the protocol
tags:
- Protocol
parameters:
- $ref: '#/components/parameters/protocolId'
- name: id
in: path
required: true
schema:
type: integer
responses:
'200':
description: Addendum
content:
application/json:
schema:
$ref: '#/components/schemas/AddendumDetail'
default:
description: Unexpected error
content:
text/plain:
schema:
$ref: '#/components/schemas/Error'
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
bearerFormat: JWT
parameters:
id:
name: id
in: path
required: true
description: The ID of the data set we want to work with
schema:
type: integer
minimum: 1
protocolId:
name: protocolId
in: path
required: true
description: The ID of the protocol data set we want to work with
schema:
type: integer
minimum: 1
schemas:
Addendum:
type: object
properties:
id:
type: integer
format: int32
nullable: true
protocolId:
type: integer
format: int32
nullable: false
userId:
type: integer
format: int32
nullable: false
timeStamp:
type: string
format: date-time
nullable: false
text:
type: string
nullable: true
required:
- protocolId
- userId
- timeStamp
AddendumDetail:
type: object
allOf:
- $ref: '#/components/schemas/Addendum'
- type: object
properties:
missionDate:
type: string
format: date
nullable: true
protocolNumber:
type: string
nullable: false
missionNumber:
type: string
nullable: true
nidaId:
type: string
nullable: true
lastname:
type: string
nullable: true
firstname:
type: string
nullable: true
username:
type: string
nullable: true
Error:
type: object
properties:
code:
type: integer
format: int64
message:
type: string
fields:
type: string
I'm exporting with the default settings to typescript-angular:
addendum.model.ts
export interface Addendum {
protocolId: number;
userId: number;
timeStamp: string;
id?: number | null;
text?: string | null;
}
addendum-detail.model.ts
import { Addendum } from './addendum.model';
export interface AddendumDetail {
protocolId: number;
userId: number;
timeStamp: string;
id?: number | null;
text?: string | null;
}
It seems like the additional properties of AddendumDetail will be ignored and only the props of allOf will be used.