OpenAPI Sepc 3.0.1 验证错误:不应有其他属性:类型

问题描述 投票:0回答:1

我收到 openapi 规范 3.0.1 的验证错误,错误为“不应该有附加属性 extraProperty :types” 我在“路径”部分和“组件”部分中看到此错误,下面是我看到此错误的代码片段:

CreateUnifiedInstanceInput:
  properties:
    default:
      type: object
      example: null
      types:
        - object
    params:
      type: object
      properties:
        processDefinitionId:
          type: string
          description: Process definition id of the process to initiate instance
          example: null
          default: dd4f9b64-7a2e-11ee-ad92-0242ac120025
        processDefinitionKey:
          type: string
          description: Process definition id of the process to initiate instance
          example: null
          types:
            - string
          default: MessageStartComplexDO-3.0--1.0--MyFormWithCOmplexDOProcess
        applicationName:
          type: string
          description: >-
            Name of the active application that contains the process to
            create the instance
          example: null
          default: MessageStartComplexDO-3.0
        applicationVersion:
          type: string
          description: >
            Version of the active application that contains the process to
            create the instance. If this is empty,

            the default version is used
          example: null
          default: '1.0'
        processName:
          type: string
          description: The name of the process to create the instance
          example: null
          types:
            - string
          default: MyFormWithCOmplexDOProcess
      example: null
    dataObject:
      properties:
        startFormBOArgs:
          $ref: '#/components/schemas/ec956219-9f08-34a8-a88b-e405767aa81c'
      example: null
  description: >
    To create a process instance provide params and data. For params object,
    provide one of "processDefId"

    or "processDefKey" or "applicationName, applicationVersion and
    processName". If createWith is "id", provide

    only "processDefinitionId". If it is "key", provide only
    "processDefinitionKey". If it is "app", provide

    "applicationName", "processName" and "applicationVersion".
    "applicationVersion" is optional. Assumes default

    version if not provided
  example: null
Instance:
  type: object
  example: null
  allOf:
    - $ref: '#/components/schemas/BaseInstance'
    - properties:
        processType:
          type: string
          description: The type of the process instance - STRUCTURED or DYNAMIC
          example: null
          types:
            - string
        parentProcessInstanceId:
          type: string
          description: >-
            The id of the parent process instance if the parent is a
            structured process
          example: null
          types:
            - string
        parentDPInstanceId:
          type: string
          description: >-
            The id of the parent process instance if the parent is a dynamic
            process
          example: null
          types:
            - string
        rootInstanceId:
          type: string
          description: >
            The id of the root process instance. The root process instance
            could either be a dynamic or a structured

            process.
          example: null
          types:
            - string
        applicationVersion:
          type: string
          description: >-
            The version of the application that this process instance
            belongs to.
          example: null
          types:
            - string
        hasChildProcesses:
          type: boolean
          description: >-
            Specifies if the process instance has associated active child
            process instance(s).
          example: null
          types:
            - boolean
      example: null`

以及路径:

`paths:
      /instances:
        get:
          tags:
            - Processes
          summary: List Process Instances
          description: >-
            List process instances user has access to including structured and
            dynamic processes
          operationId: getInstances
          parameters:
            - name: Accept-Language
              in: header
              description: Accept-Language header in IETF BCP 47
              required: false
              style: simple
              explode: false
              schema:
                type: string
                example: null
                types:
                  - string
            - name: keyword
              in: query
              description: >-
                Filter instances by keyword. This filters instances by partial
                matches of the keyword in the instance title
              required: false
              style: form
              explode: true
              schema:
                type: string
                example: null
                types:
                  - string
            - name: instanceId
              in: query
              description: Filter by process instance Ids
              required: false
              style: form
              explode: true
              schema:
                type: array
                example: null
                items:
                  type: string
                  example: null
                  types:
                    - string
                types:
                  - array
            - name: type
              in: query
              description: >
                Filter by the type of the process instance. Exact match. By default,
                both structured and dynamic processinstances will be returned
              required: false
              style: form
              explode: true
              schema:
                type: string
                example: null
                types:
                  - string
                enum:
                  - DYNAMIC
                  - STRUCTURED
            - name: processDefinitionId
              in: query
              description: Filter by process definition id. Exact match
              required: false
              style: form
              explode: false
              schema:
                type: array
                example: null
                items:
                  type: string
                  example: null
                  types:
                    - string
                types:
                  - array`

[enter image description here](https://i.stack.imgur.com/cYCzf.png)

要注意,此规范是使用 OpenAPIV3Parser 通过读取不具有此“类型的 yaml 文件来生成的: - 细绳” 不知何故,types: -string 被这个 openapi 生成器添加。 知道我应该看什么吗?

在 Swagger 编辑器上,当我删除
“类型:-字符串” 手动,错误得到解决。不知道为什么当我的原始 yaml 文件没有此条目时会添加此条目。

swagger openapi openapi-generator swagger-editor
1个回答
0
投票

听起来像是 OpenAPIV3Parser 包上的错误。相关问题

© www.soinside.com 2019 - 2024. All rights reserved.