Yaml 正在为 HTTP GET 请求生成 requestBody

Yaml is generating requestBody for HTTP GET request

我有这个 GET 方法:

@GET
@Path("/getlisteclients")
@Operation(summary = "Récupération de la liste des clients", description = "Envoi de la liste de clients à MyIris")
@ApiResponses(value = {@ApiResponse(
        content = @Content(mediaType = "application/json",
                schema = @Schema(implementation = ResponseMouvementStockDTO.class)),
        responseCode = "200", description = "Liste de clients envoyée."
),
        @ApiResponse(
                content = @Content(mediaType = "application/json",
                        schema = @Schema(implementation = ErreurMouvementStockDTO.class)),
                description = "Une erreur technique est survenue.")})

@Produces("application/json")
@GetMapping("/mobile/getlisteclients")
public ResponseEntity<ResponseMouvementStockDTO> getListeDeClients(@RequestHeader HttpHeaders headers);

并在 mobile.yaml 文件中生成此部分:

/mobile/getlisteclients:
get:
  summary: Récupération de la liste des clients
  description: Envoi de la liste de clients à MyIris
  operationId: getListeDeClients
  requestBody:
    content:
      '*/*':
        schema:
          type: object
          properties:
            all:
              type: object
              additionalProperties:
                type: string
              writeOnly: true
            empty:
              type: boolean
            location:
              type: string
              format: uri
            host:
              type: object
              properties:
                address:
                  type: object
                  properties:
                    canonicalHostName:
                      type: string
                    hostAddress:
                      type: string
                    address:
                      type: array
                      items:
                        type: string
                        format: byte
                    hostName:
                      type: string
                    multicastAddress:
                      type: boolean
                    anyLocalAddress:
                      type: boolean
                    loopbackAddress:
                      type: boolean
                    linkLocalAddress:
                      type: boolean
                    siteLocalAddress:
                      type: boolean
                    mcglobal:
                      type: boolean
                    mcnodeLocal:
                      type: boolean
                    mclinkLocal:
                      type: boolean
                    mcsiteLocal:
                      type: boolean
                    mcorgLocal:
                      type: boolean
                port:
                  type: integer
                  format: int32
                unresolved:
                  type: boolean
                hostName:
                  type: string
                hostString:
                  type: string
            lastModified:
              type: integer
              format: int64
            contentType:
              $ref: '#/components/schemas/MediaType'
            contentLength:
              type: integer
              format: int64
            date:
              type: integer
              format: int64
            ifModifiedSince:
              type: integer
              format: int64
            connection:
              type: array
              items:
                type: string
            origin:
              type: string
            range:
              type: array
              items:
                $ref: '#/components/schemas/HttpRange'
            acceptLanguageAsLocales:
              type: array
              items:
                type: object
                properties:
                  language:
                    type: string
                  script:
                    type: string
                  country:
                    type: string
                  variant:
                    type: string
                  extensionKeys:
                    uniqueItems: true
                    type: array
                    items:
                      type: string
                  unicodeLocaleAttributes:
                    uniqueItems: true
                    type: array
                    items:
                      type: string
                  unicodeLocaleKeys:
                    uniqueItems: true
                    type: array
                    items:
                      type: string
                  iso3Language:
                    type: string
                  iso3Country:
                    type: string
                  displayLanguage:
                    type: string
                  displayScript:
                    type: string
                  displayCountry:
                    type: string
                  displayVariant:
                    type: string
                  displayName:
                    type: string
            accessControlAllowMethods:
              type: array
              items:
                type: string
                enum:
                - GET
                - HEAD
                - POST
                - PUT
                - PATCH
                - DELETE
                - OPTIONS
                - TRACE
            accessControlExposeHeaders:
              type: array
              items:
                type: string
            accessControlMaxAge:
              type: integer
              format: int64
            accessControlRequestMethod:
              type: string
              enum:
              - GET
              - HEAD
              - POST
              - PUT
              - PATCH
              - DELETE
              - OPTIONS
              - TRACE
            accessControlAllowHeaders:
              type: array
              items:
                type: string
            accessControlRequestHeaders:
              type: array
              items:
                type: string
            contentDisposition:
              $ref: '#/components/schemas/ContentDisposition'
            accessControlAllowCredentials:
              type: boolean
            accessControlAllowOrigin:
              type: string
            ifUnmodifiedSince:
              type: integer
              format: int64
            etag:
              type: string
            ifMatch:
              type: array
              items:
                type: string
            ifNoneMatch:
              type: array
              items:
                type: string
            acceptPatch:
              type: array
              items:
                $ref: '#/components/schemas/MediaType'
            accept:
              type: array
              items:
                $ref: '#/components/schemas/MediaType'
            expires:
              type: integer
              format: int64
            allow:
              uniqueItems: true
              type: array
              items:
                type: string
                enum:
                - GET
                - HEAD
                - POST
                - PUT
                - PATCH
                - DELETE
                - OPTIONS
                - TRACE
            cacheControl:
              type: string
            upgrade:
              type: string
            acceptLanguage:
              type: array
              items:
                type: object
                properties:
                  range:
                    type: string
                  weight:
                    type: number
                    format: double
            basicAuth:
              type: string
              writeOnly: true
            vary:
              type: array
              items:
                type: string
            bearerAuth:
              type: string
              writeOnly: true
            contentLanguage:
              type: object
              properties:
                language:
                  type: string
                script:
                  type: string
                country:
                  type: string
                variant:
                  type: string
                extensionKeys:
                  uniqueItems: true
                  type: array
                  items:
                    type: string
                unicodeLocaleAttributes:
                  uniqueItems: true
                  type: array
                  items:
                    type: string
                unicodeLocaleKeys:
                  uniqueItems: true
                  type: array
                  items:
                    type: string
                iso3Language:
                  type: string
                iso3Country:
                  type: string
                displayLanguage:
                  type: string
                displayScript:
                  type: string
                displayCountry:
                  type: string
                displayVariant:
                  type: string
                displayName:
                  type: string
            pragma:
              type: string
            acceptCharset:
              type: array
              items:
                type: object
                properties:
                  registered:
                    type: boolean
          additionalProperties:
            type: array
            items:
              type: string
  responses:
    "200":
      description: Liste de clients envoyée.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ResponseMouvementStockDTO'
    default:
      description: Une erreur technique est survenue.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErreurMouvementStockDTO'

当我将此 yaml 放入 Swagger 时出现此错误:

路径存在语义错误。/mobile/getlisteclients。get.requestBody GET 操作不能有 requestBody。

不知道这里为什么会生成一个requestBody。我已经尝试删除 @RequestHeader 然后 Maven clean install 但没有更改。

好的,所以我设法让它工作并通过添加 @Parameter@QueryParam 消除了 Swagger 上的错误:

@GET
@Path("/getlisteclients")
@Operation(summary = "Récupération de la liste des clients", description = "Envoi de la liste de clients à MyIris")
@ApiResponses(value = {@ApiResponse(
        content = @Content(mediaType = "application/json",
                schema = @Schema(implementation = ResponseMouvementStockDTO.class)),
        responseCode = "200", description = "Liste de clients envoyée."
),
        @ApiResponse(
                content = @Content(mediaType = "application/json",
                        schema = @Schema(implementation = ErreurMouvementStockDTO.class)),
                description = "Une erreur technique est survenue.")})

@Produces("application/json")
@GetMapping("/mobile/getlisteclients")
public ResponseEntity<ResponseMouvementStockDTO> getListeDeClients(@Parameter(description = "headers", required = true) @QueryParam("headers") @RequestHeader HttpHeaders headers);