@azure-tools/typespec-azure-core 0.30.0-dev.7 → 0.30.0-dev.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/lib.d.ts +65 -23
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +18 -6
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +4 -0
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/byos.d.ts +2 -0
- package/dist/src/rules/byos.d.ts.map +1 -0
- package/dist/src/rules/byos.js +27 -0
- package/dist/src/rules/byos.js.map +1 -0
- package/dist/src/rules/request-body-array.d.ts +2 -0
- package/dist/src/rules/request-body-array.d.ts.map +1 -0
- package/dist/src/rules/request-body-array.js +22 -0
- package/dist/src/rules/request-body-array.js.map +1 -0
- package/package.json +1 -1
package/dist/src/lib.d.ts
CHANGED
|
@@ -2,6 +2,12 @@ export declare const namespace = "Azure.Core";
|
|
|
2
2
|
export declare const libDef: {
|
|
3
3
|
readonly name: "@azure-tools/typespec-azure-core";
|
|
4
4
|
readonly diagnostics: {
|
|
5
|
+
readonly byos: {
|
|
6
|
+
readonly severity: "warning";
|
|
7
|
+
readonly messages: {
|
|
8
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
5
11
|
readonly "casing-style": {
|
|
6
12
|
readonly severity: "warning";
|
|
7
13
|
readonly messages: {
|
|
@@ -39,6 +45,12 @@ export declare const libDef: {
|
|
|
39
45
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
40
46
|
};
|
|
41
47
|
};
|
|
48
|
+
readonly "request-body-problem": {
|
|
49
|
+
readonly severity: "warning";
|
|
50
|
+
readonly messages: {
|
|
51
|
+
readonly array: "Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.";
|
|
52
|
+
};
|
|
53
|
+
};
|
|
42
54
|
readonly "response-property-invalid": {
|
|
43
55
|
readonly severity: "error";
|
|
44
56
|
readonly messages: {
|
|
@@ -63,12 +75,6 @@ export declare const libDef: {
|
|
|
63
75
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
64
76
|
};
|
|
65
77
|
};
|
|
66
|
-
readonly "client-definition-parameters-not-model": {
|
|
67
|
-
readonly severity: "error";
|
|
68
|
-
readonly messages: {
|
|
69
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
78
|
readonly "invalid-resource-type": {
|
|
73
79
|
readonly severity: "error";
|
|
74
80
|
readonly messages: {
|
|
@@ -197,9 +203,18 @@ export declare const libDef: {
|
|
|
197
203
|
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
198
204
|
};
|
|
199
205
|
};
|
|
206
|
+
readonly "invalid-body-schema": {
|
|
207
|
+
readonly severity: "warning";
|
|
208
|
+
readonly messages: {
|
|
209
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
210
|
+
};
|
|
211
|
+
};
|
|
200
212
|
};
|
|
201
213
|
};
|
|
202
214
|
export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
215
|
+
byos: {
|
|
216
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
217
|
+
};
|
|
203
218
|
"casing-style": {
|
|
204
219
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
205
220
|
};
|
|
@@ -219,6 +234,9 @@ export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
|
219
234
|
"request-parameter-invalid": {
|
|
220
235
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
221
236
|
};
|
|
237
|
+
"request-body-problem": {
|
|
238
|
+
readonly array: "Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.";
|
|
239
|
+
};
|
|
222
240
|
"response-property-invalid": {
|
|
223
241
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
224
242
|
};
|
|
@@ -231,9 +249,6 @@ export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
|
231
249
|
"operation-link-parameter-invalid": {
|
|
232
250
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
233
251
|
};
|
|
234
|
-
"client-definition-parameters-not-model": {
|
|
235
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
236
|
-
};
|
|
237
252
|
"invalid-resource-type": {
|
|
238
253
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
239
254
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -299,8 +314,14 @@ export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
|
299
314
|
"avoid-operation-id": {
|
|
300
315
|
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
301
316
|
};
|
|
317
|
+
"invalid-body-schema": {
|
|
318
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
319
|
+
};
|
|
302
320
|
}, Record<string, any>>;
|
|
303
|
-
export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-union-non-string" | "lro-status-property-invalid-type" | "lro-status-missing" | "bad-record-type" | "request-parameter-invalid" | "response-property-invalid" | "no-multiple-discriminator" | "no-fixed-enum-discriminator" | "operation-link-parameter-invalid" | "
|
|
321
|
+
export declare const reportDiagnostic: <C extends "byos" | "casing-style" | "lro-status-union-non-string" | "lro-status-property-invalid-type" | "lro-status-missing" | "bad-record-type" | "request-parameter-invalid" | "request-body-problem" | "response-property-invalid" | "no-multiple-discriminator" | "no-fixed-enum-discriminator" | "operation-link-parameter-invalid" | "invalid-resource-type" | "use-extensible-enum" | "use-standard-operations" | "no-format" | "no-rest-library-interfaces" | "no-unknown" | "documentation-required" | "key-visibility-required" | "long-running-polling-operation-required" | "rpc-operation-needs-route" | "invalid-trait-property-count" | "invalid-trait-property-type" | "invalid-trait-context" | "trait-property-without-location" | "expected-trait-missing" | "invalid-parameter" | "expected-success-response" | "lro-polling-data-missing-from-operation-response" | "no-object" | "property-name-conflict" | "avoid-operation-id" | "invalid-body-schema", M extends keyof {
|
|
322
|
+
byos: {
|
|
323
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
324
|
+
};
|
|
304
325
|
"casing-style": {
|
|
305
326
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
306
327
|
};
|
|
@@ -320,6 +341,9 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
320
341
|
"request-parameter-invalid": {
|
|
321
342
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
322
343
|
};
|
|
344
|
+
"request-body-problem": {
|
|
345
|
+
readonly array: "Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.";
|
|
346
|
+
};
|
|
323
347
|
"response-property-invalid": {
|
|
324
348
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
325
349
|
};
|
|
@@ -332,9 +356,6 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
332
356
|
"operation-link-parameter-invalid": {
|
|
333
357
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
334
358
|
};
|
|
335
|
-
"client-definition-parameters-not-model": {
|
|
336
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
337
|
-
};
|
|
338
359
|
"invalid-resource-type": {
|
|
339
360
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
340
361
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -400,7 +421,13 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
400
421
|
"avoid-operation-id": {
|
|
401
422
|
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
402
423
|
};
|
|
424
|
+
"invalid-body-schema": {
|
|
425
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
426
|
+
};
|
|
403
427
|
}[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
|
|
428
|
+
byos: {
|
|
429
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
430
|
+
};
|
|
404
431
|
"casing-style": {
|
|
405
432
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
406
433
|
};
|
|
@@ -420,6 +447,9 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
420
447
|
"request-parameter-invalid": {
|
|
421
448
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
422
449
|
};
|
|
450
|
+
"request-body-problem": {
|
|
451
|
+
readonly array: "Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.";
|
|
452
|
+
};
|
|
423
453
|
"response-property-invalid": {
|
|
424
454
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
425
455
|
};
|
|
@@ -432,9 +462,6 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
432
462
|
"operation-link-parameter-invalid": {
|
|
433
463
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
434
464
|
};
|
|
435
|
-
"client-definition-parameters-not-model": {
|
|
436
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
437
|
-
};
|
|
438
465
|
"invalid-resource-type": {
|
|
439
466
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
440
467
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -500,7 +527,13 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
500
527
|
"avoid-operation-id": {
|
|
501
528
|
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
502
529
|
};
|
|
503
|
-
|
|
530
|
+
"invalid-body-schema": {
|
|
531
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
532
|
+
};
|
|
533
|
+
}, C, M>) => void, createDiagnostic: <C extends "byos" | "casing-style" | "lro-status-union-non-string" | "lro-status-property-invalid-type" | "lro-status-missing" | "bad-record-type" | "request-parameter-invalid" | "request-body-problem" | "response-property-invalid" | "no-multiple-discriminator" | "no-fixed-enum-discriminator" | "operation-link-parameter-invalid" | "invalid-resource-type" | "use-extensible-enum" | "use-standard-operations" | "no-format" | "no-rest-library-interfaces" | "no-unknown" | "documentation-required" | "key-visibility-required" | "long-running-polling-operation-required" | "rpc-operation-needs-route" | "invalid-trait-property-count" | "invalid-trait-property-type" | "invalid-trait-context" | "trait-property-without-location" | "expected-trait-missing" | "invalid-parameter" | "expected-success-response" | "lro-polling-data-missing-from-operation-response" | "no-object" | "property-name-conflict" | "avoid-operation-id" | "invalid-body-schema", M extends keyof {
|
|
534
|
+
byos: {
|
|
535
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
536
|
+
};
|
|
504
537
|
"casing-style": {
|
|
505
538
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
506
539
|
};
|
|
@@ -520,6 +553,9 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
520
553
|
"request-parameter-invalid": {
|
|
521
554
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
522
555
|
};
|
|
556
|
+
"request-body-problem": {
|
|
557
|
+
readonly array: "Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.";
|
|
558
|
+
};
|
|
523
559
|
"response-property-invalid": {
|
|
524
560
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
525
561
|
};
|
|
@@ -532,9 +568,6 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
532
568
|
"operation-link-parameter-invalid": {
|
|
533
569
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
534
570
|
};
|
|
535
|
-
"client-definition-parameters-not-model": {
|
|
536
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
537
|
-
};
|
|
538
571
|
"invalid-resource-type": {
|
|
539
572
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
540
573
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -600,7 +633,13 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
600
633
|
"avoid-operation-id": {
|
|
601
634
|
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
602
635
|
};
|
|
636
|
+
"invalid-body-schema": {
|
|
637
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
638
|
+
};
|
|
603
639
|
}[C]>(diag: import("@typespec/compiler").DiagnosticReport<{
|
|
640
|
+
byos: {
|
|
641
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
642
|
+
};
|
|
604
643
|
"casing-style": {
|
|
605
644
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
606
645
|
};
|
|
@@ -620,6 +659,9 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
620
659
|
"request-parameter-invalid": {
|
|
621
660
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
622
661
|
};
|
|
662
|
+
"request-body-problem": {
|
|
663
|
+
readonly array: "Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.";
|
|
664
|
+
};
|
|
623
665
|
"response-property-invalid": {
|
|
624
666
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
625
667
|
};
|
|
@@ -632,9 +674,6 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
632
674
|
"operation-link-parameter-invalid": {
|
|
633
675
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
634
676
|
};
|
|
635
|
-
"client-definition-parameters-not-model": {
|
|
636
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
637
|
-
};
|
|
638
677
|
"invalid-resource-type": {
|
|
639
678
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
640
679
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -700,5 +739,8 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
700
739
|
"avoid-operation-id": {
|
|
701
740
|
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
702
741
|
};
|
|
742
|
+
"invalid-body-schema": {
|
|
743
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
744
|
+
};
|
|
703
745
|
}, C, M>) => import("@typespec/compiler").Diagnostic, createStateSymbol: (name: string) => symbol;
|
|
704
746
|
//# sourceMappingURL=lib.d.ts.map
|
package/dist/src/lib.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,eAAe,CAAC;AAEtC,eAAO,MAAM,MAAM
|
|
1
|
+
{"version":3,"file":"lib.d.ts","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,eAAe,CAAC;AAEtC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyNT,CAAC;AAEX,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uBAAgC,CAAC;AAClD,eAAO,MAAQ,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAE,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sDAAE,iBAAiB,0BAAS,CAAC"}
|
package/dist/src/lib.js
CHANGED
|
@@ -3,6 +3,12 @@ export const namespace = "Azure.Core";
|
|
|
3
3
|
export const libDef = {
|
|
4
4
|
name: "@azure-tools/typespec-azure-core",
|
|
5
5
|
diagnostics: {
|
|
6
|
+
byos: {
|
|
7
|
+
severity: "warning",
|
|
8
|
+
messages: {
|
|
9
|
+
default: paramMessage `The content type "${"contentType"}" indicates this operation is storing binary data. It is recommended to use the BYOS pattern for Azure Services. https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#bring-your-own-storage-byos`,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
6
12
|
"casing-style": {
|
|
7
13
|
severity: "warning",
|
|
8
14
|
messages: {
|
|
@@ -40,6 +46,12 @@ export const libDef = {
|
|
|
40
46
|
default: paramMessage `Request parameter '${"name"}' not found on request body model.`,
|
|
41
47
|
},
|
|
42
48
|
},
|
|
49
|
+
"request-body-problem": {
|
|
50
|
+
severity: "warning",
|
|
51
|
+
messages: {
|
|
52
|
+
array: "Request body should not be of raw array type. Consider creating a container model that can add properties over time to avoid introducing breaking changes.",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
43
55
|
"response-property-invalid": {
|
|
44
56
|
severity: "error",
|
|
45
57
|
messages: {
|
|
@@ -64,12 +76,6 @@ export const libDef = {
|
|
|
64
76
|
default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.",
|
|
65
77
|
},
|
|
66
78
|
},
|
|
67
|
-
"client-definition-parameters-not-model": {
|
|
68
|
-
severity: "error",
|
|
69
|
-
messages: {
|
|
70
|
-
default: `The value for "parameters" property must be a model type`,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
79
|
"invalid-resource-type": {
|
|
74
80
|
severity: "error",
|
|
75
81
|
messages: {
|
|
@@ -198,6 +204,12 @@ export const libDef = {
|
|
|
198
204
|
default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.",
|
|
199
205
|
},
|
|
200
206
|
},
|
|
207
|
+
"invalid-body-schema": {
|
|
208
|
+
severity: "warning",
|
|
209
|
+
messages: {
|
|
210
|
+
array: "Body schema should not be of raw array type.",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
201
213
|
},
|
|
202
214
|
};
|
|
203
215
|
export const $lib = createTypeSpecLibrary(libDef);
|
package/dist/src/lib.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lib.js","sourceRoot":"","sources":["../../src/lib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEzE,MAAM,CAAC,MAAM,SAAS,GAAG,YAAY,CAAC;AAEtC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,IAAI,EAAE,kCAAkC;IACxC,WAAW,EAAE;QACX,cAAc,EAAE;YACd,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OA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CAAA,mBAAmB,OAAO,iBAAiB,SAAS,EAAE;aAC5E;SACF;QACD,mBAAmB,EAAE;YACnB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,sBAAsB,cAAc,aAAa,MAAM,aAAa;aAC1F;SACF;QACD,2BAA2B,EAAE;YAC3B,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,4CAA4C;aACtD;SACF;QACD,kDAAkD,EAAE;YAClD,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,+EAA+E;aACzF;SACF;QACD,WAAW,EAAE;YACX,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EACL,oIAAoI;aACvI;SACF;QACD,wBAAwB,EAAE;YACxB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,aAAa,cAAc,yMAAyM;gBACzP,aAAa,EAAE,YAAY,CAAA,sCAAsC,cAAc,iBAAiB,cAAc,kGAAkG;aACjN;SACF;QACD,oBAAoB,EAAE;YACpB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,OAAO,EACL,uGAAuG;aAC1G;SACF;QACD,qBAAqB,EAAE;YACrB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,KAAK,EAAE,8CAA8C;aACtD;SACF;KACF;CACO,CAAC;AAEX,MAAM,CAAC,MAAM,IAAI,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;AAClD,MAAM,CAAC,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC"}
|
package/dist/src/linter.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"linter.d.ts","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAgD7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAM3C"}
|
package/dist/src/linter.js
CHANGED
|
@@ -2,6 +2,7 @@ import { getLinter } from "@typespec/lint";
|
|
|
2
2
|
import { checkRpcRoutes } from "./decorators.js";
|
|
3
3
|
import { $lib } from "./lib.js";
|
|
4
4
|
import { avoidOperationIdRule } from "./rules/avoid-operation-id.js";
|
|
5
|
+
import { byosRule } from "./rules/byos.js";
|
|
5
6
|
import { casingRule } from "./rules/casing.js";
|
|
6
7
|
import { extensibleEnumRule } from "./rules/extensible-enums.js";
|
|
7
8
|
import { longRunningOperationsRequirePollingOperation } from "./rules/lro-polling-operation.js";
|
|
@@ -13,12 +14,15 @@ import { preventRestLibraryInterfaces } from "./rules/prevent-rest-library.js";
|
|
|
13
14
|
import { preventUnknownType } from "./rules/prevent-unknown.js";
|
|
14
15
|
import { propertyNameRule } from "./rules/property-naming.js";
|
|
15
16
|
import { recordTypeRule } from "./rules/record-types.js";
|
|
17
|
+
import { bodyArrayRule } from "./rules/request-body-array.js";
|
|
16
18
|
import { requireDocumentation } from "./rules/require-docs.js";
|
|
17
19
|
import { requireKeyVisibility } from "./rules/require-key-visibility.js";
|
|
18
20
|
import { useStandardOperations } from "./rules/use-standard-ops.js";
|
|
19
21
|
const linter = getLinter($lib);
|
|
20
22
|
linter.registerRules([
|
|
21
23
|
avoidOperationIdRule,
|
|
24
|
+
bodyArrayRule,
|
|
25
|
+
byosRule,
|
|
22
26
|
casingRule,
|
|
23
27
|
extensibleEnumRule,
|
|
24
28
|
useStandardOperations,
|
package/dist/src/linter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,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E,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,MAAM,MAAM,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAC/B,MAAM,CAAC,aAAa,CAClB;IACE,oBAAoB;IACpB,aAAa;IACb,QAAQ;IACR,UAAU;IACV,kBAAkB;IAClB,qBAAqB;IACrB,4BAA4B;IAC5B,YAAY;IACZ,gBAAgB;IAChB,4BAA4B;IAC5B,4BAA4B;IAC5B,kBAAkB;IAClB,cAAc;IACd,gBAAgB;IAChB,oBAAoB;IACpB,oBAAoB;IACpB,4CAA4C;CAC7C,EACD;IACE,UAAU,EAAE,IAAI;CACjB,CACF,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,OAAgB;IAC1C,MAAM,CAAC,eAAe,EAAE,CAAC;IACzB,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAE/B,wBAAwB;IACxB,cAAc,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byos.d.ts","sourceRoot":"","sources":["../../../src/rules/byos.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,mCAoBnB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ignoreDiagnostics } from "@typespec/compiler";
|
|
2
|
+
import { getHttpOperation } from "@typespec/http";
|
|
3
|
+
import { createRule } from "@typespec/lint";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
const binaryContentTypes = new Set(["application/octet-stream", "multipart/form-data"]);
|
|
6
|
+
export const byosRule = createRule({
|
|
7
|
+
name: "byos",
|
|
8
|
+
create({ program }) {
|
|
9
|
+
return {
|
|
10
|
+
operation: (operation) => {
|
|
11
|
+
const httpOperation = ignoreDiagnostics(getHttpOperation(program, operation));
|
|
12
|
+
if (httpOperation.parameters.body !== undefined) {
|
|
13
|
+
for (const contentType of httpOperation.parameters.body.contentTypes) {
|
|
14
|
+
if (binaryContentTypes.has(contentType)) {
|
|
15
|
+
reportDiagnostic(program, {
|
|
16
|
+
code: "byos",
|
|
17
|
+
format: { contentType },
|
|
18
|
+
target: operation,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=byos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byos.js","sourceRoot":"","sources":["../../../src/rules/byos.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAa,MAAM,oBAAoB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,CAAC,0BAA0B,EAAE,qBAAqB,CAAC,CAAC,CAAC;AACxF,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;IACjC,IAAI,EAAE,MAAM;IACZ,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,MAAM,aAAa,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC,CAAC;gBAC9E,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,KAAK,SAAS,EAAE;oBAC/C,KAAK,MAAM,WAAW,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE;wBACpE,IAAI,kBAAkB,CAAC,GAAG,CAAC,WAAW,CAAC,EAAE;4BACvC,gBAAgB,CAAC,OAAO,EAAE;gCACxB,IAAI,EAAE,MAAM;gCACZ,MAAM,EAAE,EAAE,WAAW,EAAE;gCACvB,MAAM,EAAE,SAAS;6BAClB,CAAC,CAAC;yBACJ;qBACF;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-body-array.d.ts","sourceRoot":"","sources":["../../../src/rules/request-body-array.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,aAAa,mCAiBxB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isBody } from "@typespec/http";
|
|
2
|
+
import { createRule } from "@typespec/lint";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
export const bodyArrayRule = createRule({
|
|
5
|
+
name: "request-body-array",
|
|
6
|
+
create({ program }) {
|
|
7
|
+
return {
|
|
8
|
+
operation: (op) => {
|
|
9
|
+
for (const prop of op.parameters.properties.values()) {
|
|
10
|
+
if (isBody(program, prop) && prop.type.kind === "Model" && prop.type.name === "Array") {
|
|
11
|
+
reportDiagnostic(program, {
|
|
12
|
+
code: "request-body-problem",
|
|
13
|
+
target: prop,
|
|
14
|
+
messageId: "array",
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=request-body-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-body-array.js","sourceRoot":"","sources":["../../../src/rules/request-body-array.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC;IACtC,IAAI,EAAE,oBAAoB;IAC1B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,EAAa,EAAE,EAAE;gBAC3B,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,MAAM,EAAE,EAAE;oBACpD,IAAI,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;wBACrF,gBAAgB,CAAC,OAAO,EAAE;4BACxB,IAAI,EAAE,sBAAsB;4BAC5B,MAAM,EAAE,IAAI;4BACZ,SAAS,EAAE,OAAO;yBACnB,CAAC,CAAC;qBACJ;iBACF;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED