Skip to content

[Storage] Access.Internal not being respected for several headers #940

@vincenttran-msft

Description

@vincenttran-msft

Take, for example: (Rust PR) (TypeSpec PR)

We have this defined (Access.internal):

alias StructuredBodyParameter = {
  /** Required if the request body is a structured message. Specifies the message schema version and properties. */
  @access(Access.internal)
  @header("x-ms-structured-body")
  structuredBodyType?: string;
};

And lets look at append_block in routes.tsp:

AppendBlock is StorageOperationRequestBody<
    {
      /** The data to upload. */
      ...BodyParameter;

      ...TimeoutParameter;
      ...ContentLengthParameter;
      ...ContentMd5Parameter;
      ...ContentCrc64Parameter;
      ...LeaseIdOptionalParameter;
      ...BlobConditionMaxSizeParameter;
      ...BlobConditionAppendPosParameter;
      ...EncryptionKeyParameter;
      ...EncryptionKeySha256Parameter;
      ...EncryptionAlgorithmParameter;
      ...EncryptionScopeParameter;
      ...IfModifiedSinceParameter;
      ...IfUnmodifiedSinceParameter;
      ...IfNoneMatchParameter;
      ...IfMatchParameter;
      ...IfTagsParameter;
      ...StructuredBodyParameter;
      ...StructuredContentLengthParameter;
    },

(thus Access.internal) and so now looking at the Rust impl:

pub async fn append_block(
        &self,
        body: RequestContent<Bytes, NoFormat>,
        content_length: u64,
        options: Option<AppendBlobClientAppendBlockOptions<'_>>,
    ) -> Result<Response<AppendBlobClientAppendBlockResult, NoFormat>> {
...
...
        if let Some(structured_body_type) = options.structured_body_type.as_ref() {
            request.insert_header("x-ms-structured-body", structured_body_type);
        }
...
...

Because it still is being generated (associated options bag):

pub struct AppendBlobClientAppendBlockOptions<'a> {
...
...

    /// Required if the request body is a structured message. Specifies the message schema version and properties.
    pub structured_body_type: Option<String>,

    /// Required if the request body is a structured message. Specifies the length of the blob/file content inside the message
    /// body. Will always be smaller than Content-Length.
    pub structured_content_length: Option<u64>,
...
...
}

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    CodeGenIssues that relate to code generationblocking-releaseBlocks release

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions