swagger OpenAPI Sepc 3.0.1验证错误:不应该有额外的属性:类型

7xllpg7q  于 11个月前  发布在  其他
关注(0)|答案(1)|浏览(119)

我收到OpenAPI规范3.0.1的验证错误,错误为“should not have additional properties additionalProperty:types”。
我在Paths部分和Components部分看到了这个错误。下面是我看到这个错误的片段:

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:

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


x1c 0d1x的数据
需要注意的是,此规范是使用OpenAPIV3Parser通过阅读一个没有此

types:
  - string


types: -string被这个解析器添加了进去。知道我应该看什么吗?
在Swagger编辑器中,当我手动删除“types:- string”时,错误得到解决。不知道为什么当我的原始YAML文件没有这个条目时,会添加这个。

tvmytwxo

tvmytwxo1#

听起来像是OpenAPIV3Parser包上的一个bug。相关issue

相关问题