OpenAPI / Swagger 规范路径中的哈希符号意味着什么?

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

例如,我在

yaml 文件
中看到 '/{Bucket}/{Key}#x-amz-copy-source':。我在为特定请求列出的参数中看到这一点,这可能是相关的? (我找不到任何docs):

- name: x-amz-copy-source
  in: header
  required: true
  description: '<p>Specifies the source object for the copy operation. You specify the value in one of two formats, depending on whether you want to access the source object through an <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/access-points.html">access point</a>:</p> <ul> <li> <p>For objects not accessed through an access point, specify the name of the source bucket and the key of the source object, separated by a slash (/). For example, to copy the object <code>reports/january.pdf</code> from the bucket <code>awsexamplebucket</code>, use <code>awsexamplebucket/reports/january.pdf</code>. The value must be URL encoded.</p> </li> <li> <p>For objects accessed through access points, specify the Amazon Resource Name (ARN) of the object as accessed through the access point, in the format <code>arn:aws:s3:&lt;Region&gt;:&lt;account-id&gt;:accesspoint/&lt;access-point-name&gt;/object/&lt;key&gt;</code>. For example, to copy the object <code>reports/january.pdf</code> through access point <code>my-access-point</code> owned by account <code>123456789012</code> in Region <code>us-west-2</code>, use the URL encoding of <code>arn:aws:s3:us-west-2:123456789012:accesspoint/my-access-point/object/reports/january.pdf</code>. The value must be URL encoded.</p> <note> <p>Amazon S3 supports copy operations using access points only when the source and destination buckets are in the same Amazon Web Services Region.</p> </note> <p>Alternatively, for objects accessed through Amazon S3 on Outposts, specify the ARN of the object as accessed in the format <code>arn:aws:s3-outposts:&lt;Region&gt;:&lt;account-id&gt;:outpost/&lt;outpost-id&gt;/object/&lt;key&gt;</code>. For example, to copy the object <code>reports/january.pdf</code> through outpost <code>my-outpost</code> owned by account <code>123456789012</code> in Region <code>us-west-2</code>, use the URL encoding of <code>arn:aws:s3-outposts:us-west-2:123456789012:outpost/my-outpost/object/reports/january.pdf</code>. The value must be URL encoded. </p> </li> </ul> <p>To copy a specific version of an object, append <code>?versionId=&lt;version-id&gt;</code> to the value (for example, <code>awsexamplebucket/reports/january.pdf?versionId=QUpfdndhfd8438MNFDN93jdnJFkdmqnh893</code>). If you don''t specify a version ID, Amazon S3 copies the latest version of the source object.</p>'
  schema:
    type: string
    pattern: \/.+\/.+

当哈希值

#
位于路径中时,此参数表示
in: header
。在这种情况下,哈希“参数”意味着什么?

还有更多,比如

'/{Bucket}/{Key}#uploads'
。这里,它是一个查询参数:

- name: uploads
  in: query
  required: true
  schema:
    type: boolean
    enum:
      - true
  allowEmptyValue: true

我不认为这意味着它是必需的,因为有一个

required
属性。任何帮助将不胜感激。

在另一种情况下,我们似乎有 2:

'/{Bucket}#analytics&id'
swagger openapi
1个回答
0
投票

OAS3 似乎只支持每个端点的每种操作类型(例如 POST)的一个请求,并且查询参数并不使端点唯一。 因此,在 API 规范中,您可以使用哈希符号创建唯一端点并添加更多文本,例如查询参数信息。但是哈希符号之后的信息将被丢弃,因此您需要将查询参数添加到端点。在第一个示例中,请求需要自定义标头,您应该将其添加到标头中。在其他示例中,您应该按照文档其余部分中的指导,在问号后面添加查询参数。

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