Swagger 3.0 架构错误“不应具有其他属性”

pet*_*son 5 validation yaml swagger-editor openapi

下面这个错误是什么意思?(在 Swagger 编辑器中运行)

架构错误不应具有附加属性 additionalProperty: /buildinfo, /clearcache, /countries/{countryId}/cinemas/{theatreid}/screens/{screenid}/layout, /countries/{countryId}/cinemas/{theatreid}/screens跳到第 0 行

下面是我的 yaml 文件。

openapi: "3.0.1"
info:
  title: Mobile backend
  version: 1.0.0
  license:
    name: Apache 2.0
paths:
/buildinfo:
    get:
      description: Returns the build information (Version and Time stamp).
      operationId: getBuildInfo
      parameters:
        - name: LBPATH
          in: header
/clearcache:
    get:
      description: Clears the mobile backends cache (You need to be Admin to do this call)
      operationId: clearCache
      parameters:
        - name: LBPATH
          in: header
/countries/{countryId}/cinemas/{theatreid}/screens/{screenid}/layout:
    get:
      description: Returns a list of Auditoriums that is currently running in a specific city. Ordered by movie name in ascending order.
      operationId: getScreenLayout
      parameters:
        - name: theatreid
          in: path
        - name: screenid
          in: path
        - name: seatwidth
          in: query
        - name: seatheight
          in: query
        - name: Accept-Language
          in: header
        - name: LBPATH
          in: header
/countries/{countryId}/cinemas/{theatreid}/screens:
    get:
      description: Returns a list of Auditoriums that is currently running in a specific city. Ordered by movie name in ascending order.
      operationId: getAuditoriumsInTheatre
      parameters:
        - name: theatreid
          in: path
        - name: Accept-Language
          in: header
        - name: LBPATH
          in: header
components:
  schemas:
    ProfileNotifications:
      properties:
        iWantEmails:
          type: boolean
        iWantSMS:
          type: boolean
        iWantPushNotifications:
          type: boolean
    OfferActivateRequest:
      properties:
        offerId:
          type: int64
        osType:
          $ref: '#/components/schemas/OSType'
        mobileId:
          type: string
        activationDate:
          type: date
    Customer:
      properties:
        type:
          $ref: '#/components/schemas/TicketType'
        count:
          type: int32
    Profile$ProfileStatus:
      properties:
    Booking:
      properties:
        profileId:
          type: string
        remoteEntityIds:
          type: array
          items:
            string
        customers:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        showId:
          type: string
        seatsUnnumberedCount:
          type: int32
    ProfileFriend:
      properties:
        name:
          type: string
        profileReferenceCode:
          type: string
    OfferConsumeRequest:
      properties:
        offerId:
          type: int64
        osType:
          $ref: '#/components/schemas/OSType'
        mobileId:
          type: string
    Profile:
      properties:
        language:
          type: string
        children:
          type: array
          items:
            int32
        city:
          type: string
        memberSince:
          type: date
        status:
          $ref: '#/components/schemas/Profile$ProfileStatus'
        firstName:
          type: string
        lastName:
          type: string
        phonenumber:
          type: string
        socialSecurityNumber:
          type: string
        acceptedTermsAndConditionsOn:
          type: date
        acceptedGeneralDataProtectionRegulationOn:
          type: date
        profileId:
          type: string
        currentLevelId:
          type: string
        aztecCode:
          type: string
        allowSfBioToSendNewsletters:
          type: boolean
        favoriteMovies:
          type: array
          items:
            string
        spendingPointsWillExpire:
          type: array
          items:
            $ref: '#/components/schemas/SpendingPoint'
        friends:
          type: array
          items:
            $ref: '#/components/schemas/ProfileFriend'
        userEmail:
          type: string
        providerId:
          type: int32
        providerToken:
          type: string
        memberNumber:
          type: string
        userHasVerifiedThisAccount:
          type: boolean
        loyaltyLevelId:
          type: string
        loyaltyLevelName:
          type: string
        loyaltyLevelSince:
          type: date
        loyaltyLevelExpiration:
          type: date
        loyaltyPointsAvailableForSpending:
          type: int32
        loyaltyMoviesLeftToTheNextLevel:
          type: int32
        loyaltyPointsLeftToTheNextLevel:
          type: int32
        loyaltyPointsLevelToGetGoldMember:
          type: int32
        loyaltyMovieLevelToGetGoldMember:
          type: int32
        loyaltySpendingPointsExpireDate:
          type: date
        loyaltySpendingPointsExpireAmount:
          type: int32
        oldClubCardNumber:
          type: string
        loyaltyEndDate:
          type: date
    CardType$Type:
      properties:
        purchaseCard:
          type: boolean
    Card:
      properties:
        type:
          $ref: '#/components/schemas/CardType$Type'
        number:
          type: string
        requestedAmount:
          type: int32
        deductedAmount:
          type: int32
        isUsed:
          type: boolean
        balance:
          type: int32
        errorCode:
          type: int32
    LockSeats:
      properties:
        seatKeys:
          type: array
          items:
            $ref: '#/components/schemas/SeatKey'
        auditoriumSys99Code:
          type: string
        dateTime:
          type: int64
    SeatKey:
      properties:
        seatRow:
          type: int32
        seatSection:
          type: string
        seatId:
          type: int32
    ShowKey:
      properties:
    Payment:
      properties:
        email:
          type: string
        profileId:
          type: string
        serialVersionUID:
          type: int64
        ticketTypes:
          type: array
          items:
            $ref: '#/components/schemas/TicketType'
        easyPayment:
          $ref: '#/components/schemas/EasyPayment'
        reservationPayment:
          type: boolean
        reservationNumber:
          type: string
        cards:
          type: array
          items:
            $ref: '#/components/schemas/Card'
        showKey:
          $ref: '#/components/schemas/ShowKey'
        bookingId:
          type: int32
        redirectUrl:
          type: string
        transactionId:
          type: string
        customers:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        goggleCount:
          type: int32
        paymentResponseCode:
          type: string
    Reservation:
      properties:
        email:
          type: string
        profileId:
          type: string
        cards:
          type: array
          items:
            $ref: '#/components/schemas/Card'
        bookingId:
          type: int32
        customers:
          type: array
          items:
            $ref: '#/components/schemas/Customer'
        msisdn:
          type: string
        showId:
          type: string
        goggleCount:
          type: int32
        totalFee:
          type: int32
        adultTicketCount:
          type: int32
        childTicketCount:
          type: int32
        pensionerTicketCount:
          type: int32
        plusAndVipTicketCount:
          type: int32
        totalPlusAndVipTicketCost:
          type: int32
    SpendingPoint:
      properties:
        expireDate:
          type: date
        amount:
          type: int32
    ProfileMovies:
      properties:
        movies:
          type: array
          items:
            string
    OSType:
      properties:
    ProfileCinemas:
      properties:
        cinemas:
          type: array
          items:
            string
    LockSeatsUnnumbered:
      properties:
        auditoriumSys99Code:
          type: string
        dateTime:
          type: int64
        nrOfSeats:
          type: int32
    TicketType:
      properties:
    EasyPayment:
      properties:
        panHash:
          type: string
        truncPan:
          type: string
        userAccept:
          type: boolean
Run Code Online (Sandbox Code Playgroud)

Hel*_*len 4

路径缩进是错误的:

paths:
/buildinfo: # <-----
    get:
Run Code Online (Sandbox Code Playgroud)

它应该是:

paths:
  /buildinfo:
    get:
Run Code Online (Sandbox Code Playgroud)

您的规范还存在许多其他错误,例如缺少schema参数、缺少responses操作、type架构中的值错误等。请按照 Swagger 编辑器中的提示修复错误。


但我仍然收到错误,我不明白。“路径架构错误”“应该是数组”

     parameters:
       name: LBPATH
       in: header
       schema:
         type: string
         style: simple
Run Code Online (Sandbox Code Playgroud)

parameters是一个参数数组。在 YAML 中,数组项的格式以前导-. 也是style参数属性,而不是架构属性。

     parameters:
       name: LBPATH
       in: header
       schema:
         type: string
         style: simple
Run Code Online (Sandbox Code Playgroud)

要了解有关 OpenAPI 3.0 语法以及如何格式化内容的更多信息,请查看本指南:https ://swagger.io/docs/specification/basic-struct/