Skip to content

Commit 34b32bd

Browse files
authored
support encode for modular (#2006)
* add-encode-test-case-for-modular * try fix modular encoding * resolve issues in modular bytes encoding and datetime encoding * reserve work * reserve work * works for duration and bytes * works for datetime * try fix ci * undo unnecessary changes * fix integration test * fix ci * fix integrationgit * use auto imports * datetime ut * fix ci * add more ut * add header utcDateTime default encoding ut
1 parent e6a1d96 commit 34b32bd

91 files changed

Lines changed: 6181 additions & 275 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

packages/rlc-common/src/buildIndexFile.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -311,7 +311,8 @@ function generateRLCIndex(file: SourceFile, model: RLCModel) {
311311
hasMultiCollection(model) ||
312312
hasSsvCollection(model) ||
313313
hasPipeCollection(model) ||
314-
hasTsvCollection(model)
314+
hasTsvCollection(model) ||
315+
hasCsvCollection(model)
315316
) {
316317
file.addExportDeclarations([
317318
{

packages/typespec-test/test/contentsafety_modular/generated/typespec-ts/src/api/operations.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,12 @@ export function _addOrUpdateBlockItemsSend(
325325
)
326326
.post({
327327
...operationOptionsToRequestParameters(options),
328-
body: { blockItems: blockItems },
328+
body: {
329+
blockItems: (blockItems ?? []).map((p) => ({
330+
description: p["description"],
331+
text: p["text"],
332+
})),
333+
},
329334
});
330335
}
331336

packages/typespec-test/test/eventgrid_modular/generated/typespec-ts/src/api/operations.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ export function _publishCloudEventSend(
6363
? uint8ArrayToString(event["dataBase64"], "base64")
6464
: undefined,
6565
type: event["type"],
66-
time:
67-
event["time"] !== undefined ? new Date(event["time"]) : undefined,
66+
time: event["time"]?.toISOString(),
6867
specversion: event["specversion"],
6968
dataschema: event["dataschema"],
7069
datacontenttype: event["datacontenttype"],
@@ -123,7 +122,7 @@ export function _publishCloudEventsSend(
123122
? uint8ArrayToString(p["dataBase64"], "base64")
124123
: undefined,
125124
type: p["type"],
126-
time: p["time"] !== undefined ? new Date(p["time"]) : undefined,
125+
time: p["time"]?.toISOString(),
127126
specversion: p["specversion"],
128127
dataschema: p["dataschema"],
129128
datacontenttype: p["datacontenttype"],

packages/typespec-test/test/loadtesting_modular/generated/typespec-ts/review/load-testing.api.md

Lines changed: 39 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ export interface CreateOrUpdateAppComponentsOptions extends OperationOptions {
3737
// (undocumented)
3838
contentType?: string;
3939
createdBy?: string;
40-
createdDateTime?: any;
40+
createdDateTime?: Date;
4141
lastModifiedBy?: string;
42-
lastModifiedDateTime?: any;
42+
lastModifiedDateTime?: Date;
4343
testId?: string;
4444
}
4545

@@ -48,9 +48,9 @@ export interface CreateOrUpdateServerMetricsConfigOptions extends OperationOptio
4848
// (undocumented)
4949
contentType?: string;
5050
createdBy?: string;
51-
createdDateTime?: any;
51+
createdDateTime?: Date;
5252
lastModifiedBy?: string;
53-
lastModifiedDateTime?: any;
53+
lastModifiedDateTime?: Date;
5454
metrics?: Record<string, ResourceMetric>;
5555
testId?: string;
5656
}
@@ -61,15 +61,15 @@ export interface CreateOrUpdateTestOptions extends OperationOptions {
6161
// (undocumented)
6262
contentType?: string;
6363
createdBy?: string;
64-
createdDateTime?: any;
64+
createdDateTime?: Date;
6565
description?: string;
6666
displayName?: string;
6767
environmentVariables?: Record<string, string>;
6868
inputArtifacts?: TestInputArtifacts;
6969
keyvaultReferenceIdentityId?: string;
7070
keyvaultReferenceIdentityType?: string;
7171
lastModifiedBy?: string;
72-
lastModifiedDateTime?: any;
72+
lastModifiedDateTime?: Date;
7373
loadTestConfiguration?: LoadTestConfiguration;
7474
passFailCriteria?: PassFailCriteria;
7575
secrets?: Record<string, Secret>;
@@ -114,7 +114,7 @@ export interface ErrorDetails {
114114

115115
// @public
116116
export interface FileInfo {
117-
expireDateTime?: any;
117+
expireDateTime?: Date;
118118
fileName?: string;
119119
fileType?: FileType;
120120
url?: string;
@@ -187,8 +187,8 @@ export interface ListTestFilesOptions extends OperationOptions {
187187

188188
// @public (undocumented)
189189
export interface ListTestRunsOptions extends OperationOptions {
190-
executionFrom?: any;
191-
executionTo?: any;
190+
executionFrom?: Date;
191+
executionTo?: Date;
192192
maxpagesize?: number;
193193
orderby?: string;
194194
search?: string;
@@ -198,8 +198,8 @@ export interface ListTestRunsOptions extends OperationOptions {
198198

199199
// @public (undocumented)
200200
export interface ListTestsOptions extends OperationOptions {
201-
lastModifiedEndTime?: any;
202-
lastModifiedStartTime?: any;
201+
lastModifiedEndTime?: Date;
202+
lastModifiedStartTime?: Date;
203203
maxpagesize?: number;
204204
orderby?: string;
205205
search?: string;
@@ -289,9 +289,9 @@ export interface LoadTestRunClientCreateOrUpdateAppComponentsOptions extends Ope
289289
// (undocumented)
290290
contentType?: string;
291291
createdBy?: string;
292-
createdDateTime?: any;
292+
createdDateTime?: Date;
293293
lastModifiedBy?: string;
294-
lastModifiedDateTime?: any;
294+
lastModifiedDateTime?: Date;
295295
testRunId?: string;
296296
}
297297

@@ -300,9 +300,9 @@ export interface LoadTestRunClientCreateOrUpdateServerMetricsConfigOptions exten
300300
// (undocumented)
301301
contentType?: string;
302302
createdBy?: string;
303-
createdDateTime?: any;
303+
createdDateTime?: Date;
304304
lastModifiedBy?: string;
305-
lastModifiedDateTime?: any;
305+
lastModifiedDateTime?: Date;
306306
metrics?: Record<string, LoadTestRunClientResourceMetric>;
307307
testRunId?: string;
308308
}
@@ -332,7 +332,7 @@ export interface LoadTestRunClientErrorDetails {
332332

333333
// @public
334334
export interface LoadTestRunClientFileInfo {
335-
expireDateTime?: any;
335+
expireDateTime?: Date;
336336
fileName?: string;
337337
fileType?: LoadTestRunClientFileType;
338338
url?: string;
@@ -475,15 +475,15 @@ export type LoadTestRunClientStatus = string;
475475
export interface LoadTestRunClientTest {
476476
certificate?: LoadTestRunClientCertificateMetadata;
477477
readonly createdBy?: string;
478-
readonly createdDateTime?: any;
478+
readonly createdDateTime?: Date;
479479
description?: string;
480480
displayName?: string;
481481
environmentVariables?: Record<string, string>;
482482
readonly inputArtifacts?: LoadTestRunClientTestInputArtifacts;
483483
keyvaultReferenceIdentityId?: string;
484484
keyvaultReferenceIdentityType?: string;
485485
readonly lastModifiedBy?: string;
486-
readonly lastModifiedDateTime?: any;
486+
readonly lastModifiedDateTime?: Date;
487487
loadTestConfiguration?: LoadTestRunClientLoadTestConfiguration;
488488
passFailCriteria?: LoadTestRunClientPassFailCriteria;
489489
secrets?: Record<string, LoadTestRunClientSecret>;
@@ -504,21 +504,21 @@ export interface LoadTestRunClientTestInputArtifacts {
504504
export interface LoadTestRunClientTestRun {
505505
certificate?: LoadTestRunClientCertificateMetadata;
506506
readonly createdBy?: string;
507-
readonly createdDateTime?: any;
507+
readonly createdDateTime?: Date;
508508
description?: string;
509509
displayName?: string;
510510
readonly duration?: number;
511-
readonly endDateTime?: any;
511+
readonly endDateTime?: Date;
512512
environmentVariables?: Record<string, string>;
513513
readonly errorDetails?: LoadTestRunClientErrorDetails[];
514-
readonly executedDateTime?: any;
514+
readonly executedDateTime?: Date;
515515
readonly lastModifiedBy?: string;
516-
readonly lastModifiedDateTime?: any;
516+
readonly lastModifiedDateTime?: Date;
517517
loadTestConfiguration?: LoadTestRunClientLoadTestConfiguration;
518518
passFailCriteria?: LoadTestRunClientPassFailCriteria;
519519
readonly portalUrl?: string;
520520
secrets?: Record<string, LoadTestRunClientSecret>;
521-
readonly startDateTime?: any;
521+
readonly startDateTime?: Date;
522522
readonly status?: LoadTestRunClientStatus;
523523
readonly subnetId?: string;
524524
readonly testArtifacts?: LoadTestRunClientTestRunArtifacts;
@@ -699,15 +699,15 @@ export interface StopTestRunOptions extends OperationOptions {
699699
export interface Test {
700700
certificate?: CertificateMetadata;
701701
readonly createdBy?: string;
702-
readonly createdDateTime?: any;
702+
readonly createdDateTime?: Date;
703703
description?: string;
704704
displayName?: string;
705705
environmentVariables?: Record<string, string>;
706706
readonly inputArtifacts?: TestInputArtifacts;
707707
keyvaultReferenceIdentityId?: string;
708708
keyvaultReferenceIdentityType?: string;
709709
readonly lastModifiedBy?: string;
710-
readonly lastModifiedDateTime?: any;
710+
readonly lastModifiedDateTime?: Date;
711711
loadTestConfiguration?: LoadTestConfiguration;
712712
passFailCriteria?: PassFailCriteria;
713713
secrets?: Record<string, Secret>;
@@ -719,9 +719,9 @@ export interface Test {
719719
export interface TestAppComponents {
720720
components: Record<string, AppComponent>;
721721
readonly createdBy?: string;
722-
readonly createdDateTime?: any;
722+
readonly createdDateTime?: Date;
723723
readonly lastModifiedBy?: string;
724-
readonly lastModifiedDateTime?: any;
724+
readonly lastModifiedDateTime?: Date;
725725
readonly testId?: string;
726726
}
727727

@@ -738,21 +738,21 @@ export interface TestInputArtifacts {
738738
export interface TestRun {
739739
certificate?: CertificateMetadata;
740740
readonly createdBy?: string;
741-
readonly createdDateTime?: any;
741+
readonly createdDateTime?: Date;
742742
description?: string;
743743
displayName?: string;
744744
readonly duration?: number;
745-
readonly endDateTime?: any;
745+
readonly endDateTime?: Date;
746746
environmentVariables?: Record<string, string>;
747747
readonly errorDetails?: ErrorDetails[];
748-
readonly executedDateTime?: any;
748+
readonly executedDateTime?: Date;
749749
readonly lastModifiedBy?: string;
750-
readonly lastModifiedDateTime?: any;
750+
readonly lastModifiedDateTime?: Date;
751751
loadTestConfiguration?: LoadTestConfiguration;
752752
passFailCriteria?: PassFailCriteria;
753753
readonly portalUrl?: string;
754754
secrets?: Record<string, Secret>;
755-
readonly startDateTime?: any;
755+
readonly startDateTime?: Date;
756756
readonly status?: Status;
757757
readonly subnetId?: string;
758758
readonly testArtifacts?: TestRunArtifacts;
@@ -783,22 +783,22 @@ export interface TestRunOptions extends OperationOptions {
783783
certificate?: LoadTestRunClientCertificateMetadata;
784784
contentType?: string;
785785
createdBy?: string;
786-
createdDateTime?: any;
786+
createdDateTime?: Date;
787787
description?: string;
788788
displayName?: string;
789789
duration?: number;
790-
endDateTime?: any;
790+
endDateTime?: Date;
791791
environmentVariables?: Record<string, string>;
792792
errorDetails?: LoadTestRunClientErrorDetails[];
793-
executedDateTime?: any;
793+
executedDateTime?: Date;
794794
lastModifiedBy?: string;
795-
lastModifiedDateTime?: any;
795+
lastModifiedDateTime?: Date;
796796
loadTestConfiguration?: LoadTestRunClientLoadTestConfiguration;
797797
oldTestRunId?: string;
798798
passFailCriteria?: LoadTestRunClientPassFailCriteria;
799799
portalUrl?: string;
800800
secrets?: Record<string, LoadTestRunClientSecret>;
801-
startDateTime?: any;
801+
startDateTime?: Date;
802802
status?: LoadTestRunClientStatus;
803803
subnetId?: string;
804804
testArtifacts?: LoadTestRunClientTestRunArtifacts;
@@ -835,9 +835,9 @@ export interface TestRunStatistics {
835835
// @public
836836
export interface TestServerMetricConfig {
837837
readonly createdBy?: string;
838-
readonly createdDateTime?: any;
838+
readonly createdDateTime?: Date;
839839
readonly lastModifiedBy?: string;
840-
readonly lastModifiedDateTime?: any;
840+
readonly lastModifiedDateTime?: Date;
841841
metrics?: Record<string, ResourceMetric>;
842842
readonly testId?: string;
843843
}

0 commit comments

Comments
 (0)