带有 Id 的 Swagger Openapi 链接不起作用

问题描述

我正在拼命地尝试让我的 put 服务发挥作用。 我无法让 movieId 工作的链接。 我想将 movieId 链接到 post(addMovie) 服务或 getMovieById 服务的响应。 但是每次我收到 500 错误

/movies/{id}:
    parameters:
      - name: id
        in: path
        required: true
        type: string
    get:
      tags:
      - "Movie"
      summary: "Finds Movie by id"
      description: "Show movie details"
      produces:
      - "application/json"
      parameters:
      - name: "id"
        in: "path"
        description: "This is the unique identifier for the specific movie"
        required: true
        type: "string"
      responses:
        "200":
          description: "Successfully fetched Movie."
          links:
            GetMovieById:
              operationId: getMovieId2
              parameters:
                id: "$response.body#/id"
        "404":
          description: "Movie not found!"
        "500":
          description: "Fetching movie Failed!"
    put:
      tags:
      - "Movie"
      summary: "Edit and update the selected movie"
      description: "This can only be done by the logged in user."
      operationId: getMovieId
      consumes:
      - "application/json"
      - "application/x-www-form-urlencoded"
      - "multipart/form-data"
      produces:
      - "application/json"
      parameters:
      - name: "id"
        in: "path"
        description: "This is the unique identifier for the specific movie"
        required: true
        type: "string"
      - name: "title"
        in: "formData"
        description: "movie title"
        required: true
        type: "string"
      - name: "director"
        in: "formData"
        description: "movie director"
        required: true
        type: "string"
      - name: "genre"
        in: "formData"
        description: "movie genre"
        required: true
        type: "string"
      - name: "year"
        in: "formData"
        description: "year of release"
        required: true
        type: "string"
      - name: "poster"
        in: "formData"
        description: "movie poster"
        required: false
        type: "file"
      responses:
        "200":
          description: "Successfully updated!"
        "500":
          description: "Couldn't udpate the movie!"

我的定义:

deFinitions:
  Movie:
    type: "object"
    properties:
      title:
        type: "string"
      director:
        type: "string"
      genre:
        type: "string"
      year:
        type: "string"
      posterPath:
        type: "string"

所以 post /movies 和 get /movies 和 get /movies/{id} 正在工作 只有 put 还没有工作。 请问有人可以帮忙吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)