Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allOf not working properly #41

Open
konstantinschuette opened this issue Aug 1, 2022 · 0 comments
Open

allOf not working properly #41

konstantinschuette opened this issue Aug 1, 2022 · 0 comments

Comments

@konstantinschuette
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant