microsoft / microsoft/typespec

http-client-python: @override models not being honored

Open
#9,589 2 comments 0 reactions 1 assignee Claimed by @msyyc View on GitHub
emitter:client:python
Dominant language
Java
Stars
5.9k
Forks
394
Avg merge
1d 23h
Merged PRs (30d)
104

Description

For [azure-storage-blobs](https://github.com/Azure/azure-rest-api-specs/blob/feature/blob-tsp-xlang/specification/storage/Microsoft.BlobStorage/routes.tsp#L1594) I am doing the following in the client.tsp:

```
/** Parameter group for lease access conditions */
model LeaseAccessConditions {
/** If specified, the operation only succeeds if the resource's lease is active and matches this ID. */
leaseId?: string;
}

/** Parameter group for modified access conditions */
model ModifiedAccessConditions {
/** Specify this header value to operate only on a blob if it has been modified since the specified date/time. */
ifModifiedSince?: utcDateTime;

/** Specify this header value to operate only on a blob if it has not been modified since the specified date/time. */
ifUnmodifiedSince?: utcDateTime;

/** Specify an ETag value to operate only on blobs with a matching value. */
ifMatch?: string;

/** Specify an ETag value to operate only on blobs without a matching value. */
ifNoneMatch?: string;

/** Specify a SQL where clause on blob tags to operate only on blobs with a matching value. */
ifTags?: string;
}

/** Parameter group for customer-provided encryption key information */
model CpkInfo {
/** The encryption key. */
encryptionKey?: string;

/** The SHA-256 hash of the encryption key. */
encryptionKeySha256?: string;

/** The algorithm used to produce the encryption key hash. */
encryptionAlgorithm?: EncryptionAlgorithmType;
}

/** Custom download operation with grouped parameters for Python SDK */
op downloadCustom(
/** Specifies the version of the operation to use for this request. */
@apiVersion
@access(Access.internal)
@header("x-ms-version")
version: string,

...SnapshotParameter,

...VersionIdParameter,
...TimeoutParameter,
...RangeParameter,

/** When set to true and specified together with the Range, the service returns the MD5 hash for the range, as long as the range is less than or equal to 4 MB in size. */
@header("x-ms-range-get-content-md5")
rangeGetContentMd5?: boolean,

/** Optional. When this header is set to true and specified together with the Range header, the service returns the CRC64 hash for the range, as long as the range is less than or equal to 4 MB in size. */
@header("x-ms-range-get-content-crc64")
rangeGetContentCrc64?: boolean,

/** Specifies the response content should be returned as a structured message and specifies the message schema version and properties. */
@access(Access.internal)
@header("x-ms-structured-body")
structuredBodyType?: string,

cpkInfo?: CpkInfo,
modifiedAccessConditions?: ModifiedAccessConditions,
leaseAccessConditions?: LeaseAccessConditions,
): void;

@@override(Storage.Blob.Blob.download, downloadCustom, "python");
```

and when I generate I see the models getting generated, but the operation itself is missing the new params for those models:

Image

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.