@azure-tools/typespec-azure-core 0.30.0-dev.1 → 0.30.0-dev.10
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 +155 -23
- package/dist/src/lib.d.ts.map +1 -1
- package/dist/src/lib.js +43 -6
- package/dist/src/lib.js.map +1 -1
- package/dist/src/linter.d.ts.map +1 -1
- package/dist/src/linter.js +12 -0
- package/dist/src/linter.js.map +1 -1
- package/dist/src/rules/avoid-operation-id.d.ts +2 -0
- package/dist/src/rules/avoid-operation-id.d.ts.map +1 -0
- package/dist/src/rules/avoid-operation-id.js +23 -0
- package/dist/src/rules/avoid-operation-id.js.map +1 -0
- 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/no-fixed-enum-discriminator.d.ts +2 -0
- package/dist/src/rules/no-fixed-enum-discriminator.d.ts.map +1 -0
- package/dist/src/rules/no-fixed-enum-discriminator.js +29 -0
- package/dist/src/rules/no-fixed-enum-discriminator.js.map +1 -0
- package/dist/src/rules/no-nullable.d.ts +2 -0
- package/dist/src/rules/no-nullable.d.ts.map +1 -0
- package/dist/src/rules/no-nullable.js +22 -0
- package/dist/src/rules/no-nullable.js.map +1 -0
- package/dist/src/rules/property-naming.d.ts +2 -0
- package/dist/src/rules/property-naming.d.ts.map +1 -0
- package/dist/src/rules/property-naming.js +40 -0
- package/dist/src/rules/property-naming.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/lib/foundations.tsp +1 -0
- package/package.json +9 -8
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: {
|
|
@@ -51,16 +63,16 @@ export declare const libDef: {
|
|
|
51
63
|
readonly default: import("@typespec/compiler").CallableMessage<["name", "values"]>;
|
|
52
64
|
};
|
|
53
65
|
};
|
|
54
|
-
readonly "
|
|
55
|
-
readonly severity: "
|
|
66
|
+
readonly "no-fixed-enum-discriminator": {
|
|
67
|
+
readonly severity: "warning";
|
|
56
68
|
readonly messages: {
|
|
57
|
-
readonly default: "
|
|
69
|
+
readonly default: import("@typespec/compiler").CallableMessage<["enumName"]>;
|
|
58
70
|
};
|
|
59
71
|
};
|
|
60
|
-
readonly "
|
|
72
|
+
readonly "operation-link-parameter-invalid": {
|
|
61
73
|
readonly severity: "error";
|
|
62
74
|
readonly messages: {
|
|
63
|
-
readonly default: "
|
|
75
|
+
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
64
76
|
};
|
|
65
77
|
};
|
|
66
78
|
readonly "invalid-resource-type": {
|
|
@@ -172,15 +184,43 @@ export declare const libDef: {
|
|
|
172
184
|
readonly default: "At least one operation response must contain a field marked with `@lroStatus`";
|
|
173
185
|
};
|
|
174
186
|
};
|
|
187
|
+
readonly "no-nullable": {
|
|
188
|
+
readonly severity: "warning";
|
|
189
|
+
readonly messages: {
|
|
190
|
+
readonly default: "Don't use `| null`. If you meant to have an optional property, use `?`. (e.g. `myProp?: string`)";
|
|
191
|
+
};
|
|
192
|
+
};
|
|
175
193
|
readonly "no-object": {
|
|
176
|
-
readonly severity: "
|
|
194
|
+
readonly severity: "warning";
|
|
177
195
|
readonly messages: {
|
|
178
196
|
readonly default: "Don't use 'object'.\n - If you want an object with any properties, use `Record<unknown>`\n - If you meant anything, use `unknown`.";
|
|
179
197
|
};
|
|
180
198
|
};
|
|
199
|
+
readonly "property-name-conflict": {
|
|
200
|
+
readonly severity: "warning";
|
|
201
|
+
readonly messages: {
|
|
202
|
+
readonly default: import("@typespec/compiler").CallableMessage<["propertyName"]>;
|
|
203
|
+
readonly projectedName: import("@typespec/compiler").CallableMessage<["propertyName", "propertyName"]>;
|
|
204
|
+
};
|
|
205
|
+
};
|
|
206
|
+
readonly "avoid-operation-id": {
|
|
207
|
+
readonly severity: "warning";
|
|
208
|
+
readonly messages: {
|
|
209
|
+
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
readonly "invalid-body-schema": {
|
|
213
|
+
readonly severity: "warning";
|
|
214
|
+
readonly messages: {
|
|
215
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
216
|
+
};
|
|
217
|
+
};
|
|
181
218
|
};
|
|
182
219
|
};
|
|
183
220
|
export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
221
|
+
byos: {
|
|
222
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
223
|
+
};
|
|
184
224
|
"casing-style": {
|
|
185
225
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
186
226
|
};
|
|
@@ -200,18 +240,21 @@ export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
|
200
240
|
"request-parameter-invalid": {
|
|
201
241
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
202
242
|
};
|
|
243
|
+
"request-body-problem": {
|
|
244
|
+
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.";
|
|
245
|
+
};
|
|
203
246
|
"response-property-invalid": {
|
|
204
247
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
205
248
|
};
|
|
206
249
|
"no-multiple-discriminator": {
|
|
207
250
|
readonly default: import("@typespec/compiler").CallableMessage<["name", "values"]>;
|
|
208
251
|
};
|
|
252
|
+
"no-fixed-enum-discriminator": {
|
|
253
|
+
readonly default: import("@typespec/compiler").CallableMessage<["enumName"]>;
|
|
254
|
+
};
|
|
209
255
|
"operation-link-parameter-invalid": {
|
|
210
256
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
211
257
|
};
|
|
212
|
-
"client-definition-parameters-not-model": {
|
|
213
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
214
|
-
};
|
|
215
258
|
"invalid-resource-type": {
|
|
216
259
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
217
260
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -267,11 +310,27 @@ export declare const $lib: import("@typespec/compiler").TypeSpecLibrary<{
|
|
|
267
310
|
"lro-polling-data-missing-from-operation-response": {
|
|
268
311
|
readonly default: "At least one operation response must contain a field marked with `@lroStatus`";
|
|
269
312
|
};
|
|
313
|
+
"no-nullable": {
|
|
314
|
+
readonly default: "Don't use `| null`. If you meant to have an optional property, use `?`. (e.g. `myProp?: string`)";
|
|
315
|
+
};
|
|
270
316
|
"no-object": {
|
|
271
317
|
readonly default: "Don't use 'object'.\n - If you want an object with any properties, use `Record<unknown>`\n - If you meant anything, use `unknown`.";
|
|
272
318
|
};
|
|
319
|
+
"property-name-conflict": {
|
|
320
|
+
readonly default: import("@typespec/compiler").CallableMessage<["propertyName"]>;
|
|
321
|
+
readonly projectedName: import("@typespec/compiler").CallableMessage<["propertyName", "propertyName"]>;
|
|
322
|
+
};
|
|
323
|
+
"avoid-operation-id": {
|
|
324
|
+
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
325
|
+
};
|
|
326
|
+
"invalid-body-schema": {
|
|
327
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
328
|
+
};
|
|
273
329
|
}, Record<string, any>>;
|
|
274
|
-
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" | "
|
|
330
|
+
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-nullable" | "no-object" | "property-name-conflict" | "avoid-operation-id" | "invalid-body-schema", M extends keyof {
|
|
331
|
+
byos: {
|
|
332
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
333
|
+
};
|
|
275
334
|
"casing-style": {
|
|
276
335
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
277
336
|
};
|
|
@@ -291,18 +350,21 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
291
350
|
"request-parameter-invalid": {
|
|
292
351
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
293
352
|
};
|
|
353
|
+
"request-body-problem": {
|
|
354
|
+
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.";
|
|
355
|
+
};
|
|
294
356
|
"response-property-invalid": {
|
|
295
357
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
296
358
|
};
|
|
297
359
|
"no-multiple-discriminator": {
|
|
298
360
|
readonly default: import("@typespec/compiler").CallableMessage<["name", "values"]>;
|
|
299
361
|
};
|
|
362
|
+
"no-fixed-enum-discriminator": {
|
|
363
|
+
readonly default: import("@typespec/compiler").CallableMessage<["enumName"]>;
|
|
364
|
+
};
|
|
300
365
|
"operation-link-parameter-invalid": {
|
|
301
366
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
302
367
|
};
|
|
303
|
-
"client-definition-parameters-not-model": {
|
|
304
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
305
|
-
};
|
|
306
368
|
"invalid-resource-type": {
|
|
307
369
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
308
370
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -358,10 +420,26 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
358
420
|
"lro-polling-data-missing-from-operation-response": {
|
|
359
421
|
readonly default: "At least one operation response must contain a field marked with `@lroStatus`";
|
|
360
422
|
};
|
|
423
|
+
"no-nullable": {
|
|
424
|
+
readonly default: "Don't use `| null`. If you meant to have an optional property, use `?`. (e.g. `myProp?: string`)";
|
|
425
|
+
};
|
|
361
426
|
"no-object": {
|
|
362
427
|
readonly default: "Don't use 'object'.\n - If you want an object with any properties, use `Record<unknown>`\n - If you meant anything, use `unknown`.";
|
|
363
428
|
};
|
|
429
|
+
"property-name-conflict": {
|
|
430
|
+
readonly default: import("@typespec/compiler").CallableMessage<["propertyName"]>;
|
|
431
|
+
readonly projectedName: import("@typespec/compiler").CallableMessage<["propertyName", "propertyName"]>;
|
|
432
|
+
};
|
|
433
|
+
"avoid-operation-id": {
|
|
434
|
+
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
435
|
+
};
|
|
436
|
+
"invalid-body-schema": {
|
|
437
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
438
|
+
};
|
|
364
439
|
}[C]>(program: import("@typespec/compiler").Program, diag: import("@typespec/compiler").DiagnosticReport<{
|
|
440
|
+
byos: {
|
|
441
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
442
|
+
};
|
|
365
443
|
"casing-style": {
|
|
366
444
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
367
445
|
};
|
|
@@ -381,18 +459,21 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
381
459
|
"request-parameter-invalid": {
|
|
382
460
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
383
461
|
};
|
|
462
|
+
"request-body-problem": {
|
|
463
|
+
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.";
|
|
464
|
+
};
|
|
384
465
|
"response-property-invalid": {
|
|
385
466
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
386
467
|
};
|
|
387
468
|
"no-multiple-discriminator": {
|
|
388
469
|
readonly default: import("@typespec/compiler").CallableMessage<["name", "values"]>;
|
|
389
470
|
};
|
|
471
|
+
"no-fixed-enum-discriminator": {
|
|
472
|
+
readonly default: import("@typespec/compiler").CallableMessage<["enumName"]>;
|
|
473
|
+
};
|
|
390
474
|
"operation-link-parameter-invalid": {
|
|
391
475
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
392
476
|
};
|
|
393
|
-
"client-definition-parameters-not-model": {
|
|
394
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
395
|
-
};
|
|
396
477
|
"invalid-resource-type": {
|
|
397
478
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
398
479
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -448,10 +529,26 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
448
529
|
"lro-polling-data-missing-from-operation-response": {
|
|
449
530
|
readonly default: "At least one operation response must contain a field marked with `@lroStatus`";
|
|
450
531
|
};
|
|
532
|
+
"no-nullable": {
|
|
533
|
+
readonly default: "Don't use `| null`. If you meant to have an optional property, use `?`. (e.g. `myProp?: string`)";
|
|
534
|
+
};
|
|
451
535
|
"no-object": {
|
|
452
536
|
readonly default: "Don't use 'object'.\n - If you want an object with any properties, use `Record<unknown>`\n - If you meant anything, use `unknown`.";
|
|
453
537
|
};
|
|
454
|
-
|
|
538
|
+
"property-name-conflict": {
|
|
539
|
+
readonly default: import("@typespec/compiler").CallableMessage<["propertyName"]>;
|
|
540
|
+
readonly projectedName: import("@typespec/compiler").CallableMessage<["propertyName", "propertyName"]>;
|
|
541
|
+
};
|
|
542
|
+
"avoid-operation-id": {
|
|
543
|
+
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
544
|
+
};
|
|
545
|
+
"invalid-body-schema": {
|
|
546
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
547
|
+
};
|
|
548
|
+
}, 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-nullable" | "no-object" | "property-name-conflict" | "avoid-operation-id" | "invalid-body-schema", M extends keyof {
|
|
549
|
+
byos: {
|
|
550
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
551
|
+
};
|
|
455
552
|
"casing-style": {
|
|
456
553
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
457
554
|
};
|
|
@@ -471,18 +568,21 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
471
568
|
"request-parameter-invalid": {
|
|
472
569
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
473
570
|
};
|
|
571
|
+
"request-body-problem": {
|
|
572
|
+
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.";
|
|
573
|
+
};
|
|
474
574
|
"response-property-invalid": {
|
|
475
575
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
476
576
|
};
|
|
477
577
|
"no-multiple-discriminator": {
|
|
478
578
|
readonly default: import("@typespec/compiler").CallableMessage<["name", "values"]>;
|
|
479
579
|
};
|
|
580
|
+
"no-fixed-enum-discriminator": {
|
|
581
|
+
readonly default: import("@typespec/compiler").CallableMessage<["enumName"]>;
|
|
582
|
+
};
|
|
480
583
|
"operation-link-parameter-invalid": {
|
|
481
584
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
482
585
|
};
|
|
483
|
-
"client-definition-parameters-not-model": {
|
|
484
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
485
|
-
};
|
|
486
586
|
"invalid-resource-type": {
|
|
487
587
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
488
588
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -538,10 +638,26 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
538
638
|
"lro-polling-data-missing-from-operation-response": {
|
|
539
639
|
readonly default: "At least one operation response must contain a field marked with `@lroStatus`";
|
|
540
640
|
};
|
|
641
|
+
"no-nullable": {
|
|
642
|
+
readonly default: "Don't use `| null`. If you meant to have an optional property, use `?`. (e.g. `myProp?: string`)";
|
|
643
|
+
};
|
|
541
644
|
"no-object": {
|
|
542
645
|
readonly default: "Don't use 'object'.\n - If you want an object with any properties, use `Record<unknown>`\n - If you meant anything, use `unknown`.";
|
|
543
646
|
};
|
|
647
|
+
"property-name-conflict": {
|
|
648
|
+
readonly default: import("@typespec/compiler").CallableMessage<["propertyName"]>;
|
|
649
|
+
readonly projectedName: import("@typespec/compiler").CallableMessage<["propertyName", "propertyName"]>;
|
|
650
|
+
};
|
|
651
|
+
"avoid-operation-id": {
|
|
652
|
+
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
653
|
+
};
|
|
654
|
+
"invalid-body-schema": {
|
|
655
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
656
|
+
};
|
|
544
657
|
}[C]>(diag: import("@typespec/compiler").DiagnosticReport<{
|
|
658
|
+
byos: {
|
|
659
|
+
readonly default: import("@typespec/compiler").CallableMessage<["contentType"]>;
|
|
660
|
+
};
|
|
545
661
|
"casing-style": {
|
|
546
662
|
readonly default: import("@typespec/compiler").CallableMessage<["type", "casing"]>;
|
|
547
663
|
};
|
|
@@ -561,18 +677,21 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
561
677
|
"request-parameter-invalid": {
|
|
562
678
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
563
679
|
};
|
|
680
|
+
"request-body-problem": {
|
|
681
|
+
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.";
|
|
682
|
+
};
|
|
564
683
|
"response-property-invalid": {
|
|
565
684
|
readonly default: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
566
685
|
};
|
|
567
686
|
"no-multiple-discriminator": {
|
|
568
687
|
readonly default: import("@typespec/compiler").CallableMessage<["name", "values"]>;
|
|
569
688
|
};
|
|
689
|
+
"no-fixed-enum-discriminator": {
|
|
690
|
+
readonly default: import("@typespec/compiler").CallableMessage<["enumName"]>;
|
|
691
|
+
};
|
|
570
692
|
"operation-link-parameter-invalid": {
|
|
571
693
|
readonly default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.";
|
|
572
694
|
};
|
|
573
|
-
"client-definition-parameters-not-model": {
|
|
574
|
-
readonly default: "The value for \"parameters\" property must be a model type";
|
|
575
|
-
};
|
|
576
695
|
"invalid-resource-type": {
|
|
577
696
|
readonly missingKey: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
578
697
|
readonly missingSegment: import("@typespec/compiler").CallableMessage<["name"]>;
|
|
@@ -628,8 +747,21 @@ export declare const reportDiagnostic: <C extends "casing-style" | "lro-status-u
|
|
|
628
747
|
"lro-polling-data-missing-from-operation-response": {
|
|
629
748
|
readonly default: "At least one operation response must contain a field marked with `@lroStatus`";
|
|
630
749
|
};
|
|
750
|
+
"no-nullable": {
|
|
751
|
+
readonly default: "Don't use `| null`. If you meant to have an optional property, use `?`. (e.g. `myProp?: string`)";
|
|
752
|
+
};
|
|
631
753
|
"no-object": {
|
|
632
754
|
readonly default: "Don't use 'object'.\n - If you want an object with any properties, use `Record<unknown>`\n - If you meant anything, use `unknown`.";
|
|
633
755
|
};
|
|
756
|
+
"property-name-conflict": {
|
|
757
|
+
readonly default: import("@typespec/compiler").CallableMessage<["propertyName"]>;
|
|
758
|
+
readonly projectedName: import("@typespec/compiler").CallableMessage<["propertyName", "propertyName"]>;
|
|
759
|
+
};
|
|
760
|
+
"avoid-operation-id": {
|
|
761
|
+
readonly default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.";
|
|
762
|
+
};
|
|
763
|
+
"invalid-body-schema": {
|
|
764
|
+
readonly array: "Body schema should not be of raw array type.";
|
|
765
|
+
};
|
|
634
766
|
}, C, M>) => import("@typespec/compiler").Diagnostic, createStateSymbol: (name: string) => symbol;
|
|
635
767
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgOT,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: {
|
|
@@ -52,16 +64,16 @@ export const libDef = {
|
|
|
52
64
|
default: paramMessage `Class hierarchy for '${"name"}' should only have, at most, one discriminator, but found: ${"values"}.`,
|
|
53
65
|
},
|
|
54
66
|
},
|
|
55
|
-
"
|
|
56
|
-
severity: "
|
|
67
|
+
"no-fixed-enum-discriminator": {
|
|
68
|
+
severity: "warning",
|
|
57
69
|
messages: {
|
|
58
|
-
default:
|
|
70
|
+
default: paramMessage `Discriminator shouldn't be a fixed enum. A discriminated model is likely to expand over time. Removed "@fixed" from "${"enumName"}" enum.`,
|
|
59
71
|
},
|
|
60
72
|
},
|
|
61
|
-
"
|
|
73
|
+
"operation-link-parameter-invalid": {
|
|
62
74
|
severity: "error",
|
|
63
75
|
messages: {
|
|
64
|
-
default:
|
|
76
|
+
default: "Parameters must be of template type RequestParameter<T> or ResponseProperty<T>.",
|
|
65
77
|
},
|
|
66
78
|
},
|
|
67
79
|
"invalid-resource-type": {
|
|
@@ -173,12 +185,37 @@ export const libDef = {
|
|
|
173
185
|
default: "At least one operation response must contain a field marked with `@lroStatus`",
|
|
174
186
|
},
|
|
175
187
|
},
|
|
188
|
+
"no-nullable": {
|
|
189
|
+
severity: "warning",
|
|
190
|
+
messages: {
|
|
191
|
+
default: "Don't use `| null`. If you meant to have an optional property, use `?`. (e.g. `myProp?: string`)",
|
|
192
|
+
},
|
|
193
|
+
},
|
|
176
194
|
"no-object": {
|
|
177
|
-
severity: "
|
|
195
|
+
severity: "warning",
|
|
178
196
|
messages: {
|
|
179
197
|
default: "Don't use 'object'.\n - If you want an object with any properties, use `Record<unknown>`\n - If you meant anything, use `unknown`.",
|
|
180
198
|
},
|
|
181
199
|
},
|
|
200
|
+
"property-name-conflict": {
|
|
201
|
+
severity: "warning",
|
|
202
|
+
messages: {
|
|
203
|
+
default: paramMessage `Property '${"propertyName"}' having the same name as its enclosing model will cause problems with C# code generation. Consider renaming the property directly or using the @projectedName decorator to rename the property for C#.`,
|
|
204
|
+
projectedName: paramMessage `Use of @projectedName on property '${"propertyName"}' results in '${"propertyName"}' having the same name as its enclosing type in C#. Please use a different @projectedName value.`,
|
|
205
|
+
},
|
|
206
|
+
},
|
|
207
|
+
"avoid-operation-id": {
|
|
208
|
+
severity: "warning",
|
|
209
|
+
messages: {
|
|
210
|
+
default: "Operation ID is automatically generated by the OpenAPI emitters and should not normally be specified.",
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
"invalid-body-schema": {
|
|
214
|
+
severity: "warning",
|
|
215
|
+
messages: {
|
|
216
|
+
array: "Body schema should not be of raw array type.",
|
|
217
|
+
},
|
|
218
|
+
},
|
|
182
219
|
},
|
|
183
220
|
};
|
|
184
221
|
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,OAAO,EAAE,YAAY,CAAA,gBAAgB,MAAM,mBAAmB,QAAQ,EAAE;aACzE;SACF;QACD,6BAA6B,EAAE;YAC7B,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,wCAAwC,MAAM,GAAG;aACvE;SACF;QACD,kCAAkC,EAAE;YAClC,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,sDAAsD;aAChE;SACF;QACD,oBAAoB,EAAE;YACpB,QAAQ,EAAE,OAAO;YACjB,QAAQ,EAAE;gBACR,OAAO,EAAE,YAAY,CAAA,uDAAuD,QAAQ,GAAG;aACxF;SACF;QACD,iBAAiB,EAAE;YACjB,QAAQ,EAAE,SAAS;YACnB,QAAQ,EAAE;gBACR,aAAa,EAAE,YAAY,CAAA,GAAG,MAAM,oBAAoB,SAAS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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;AAkD7C,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,QAM3C"}
|
package/dist/src/linter.js
CHANGED
|
@@ -1,29 +1,41 @@
|
|
|
1
1
|
import { getLinter } from "@typespec/lint";
|
|
2
2
|
import { checkRpcRoutes } from "./decorators.js";
|
|
3
3
|
import { $lib } from "./lib.js";
|
|
4
|
+
import { avoidOperationIdRule } from "./rules/avoid-operation-id.js";
|
|
5
|
+
import { byosRule } from "./rules/byos.js";
|
|
4
6
|
import { casingRule } from "./rules/casing.js";
|
|
5
7
|
import { extensibleEnumRule } from "./rules/extensible-enums.js";
|
|
6
8
|
import { longRunningOperationsRequirePollingOperation } from "./rules/lro-polling-operation.js";
|
|
9
|
+
import { noFixedEnumDiscriminatorRule } from "./rules/no-fixed-enum-discriminator.js";
|
|
10
|
+
import { noNullableRule } from "./rules/no-nullable.js";
|
|
7
11
|
import { noObjectRule } from "./rules/no-object.js";
|
|
8
12
|
import { preventFormatUse } from "./rules/prevent-format.js";
|
|
9
13
|
import { preventMultipleDiscriminator } from "./rules/prevent-multiple-discriminator.js";
|
|
10
14
|
import { preventRestLibraryInterfaces } from "./rules/prevent-rest-library.js";
|
|
11
15
|
import { preventUnknownType } from "./rules/prevent-unknown.js";
|
|
16
|
+
import { propertyNameRule } from "./rules/property-naming.js";
|
|
12
17
|
import { recordTypeRule } from "./rules/record-types.js";
|
|
18
|
+
import { bodyArrayRule } from "./rules/request-body-array.js";
|
|
13
19
|
import { requireDocumentation } from "./rules/require-docs.js";
|
|
14
20
|
import { requireKeyVisibility } from "./rules/require-key-visibility.js";
|
|
15
21
|
import { useStandardOperations } from "./rules/use-standard-ops.js";
|
|
16
22
|
const linter = getLinter($lib);
|
|
17
23
|
linter.registerRules([
|
|
24
|
+
avoidOperationIdRule,
|
|
25
|
+
bodyArrayRule,
|
|
26
|
+
byosRule,
|
|
18
27
|
casingRule,
|
|
19
28
|
extensibleEnumRule,
|
|
20
29
|
useStandardOperations,
|
|
30
|
+
noFixedEnumDiscriminatorRule,
|
|
31
|
+
noNullableRule,
|
|
21
32
|
noObjectRule,
|
|
22
33
|
preventFormatUse,
|
|
23
34
|
preventMultipleDiscriminator,
|
|
24
35
|
preventRestLibraryInterfaces,
|
|
25
36
|
preventUnknownType,
|
|
26
37
|
recordTypeRule,
|
|
38
|
+
propertyNameRule,
|
|
27
39
|
requireDocumentation,
|
|
28
40
|
requireKeyVisibility,
|
|
29
41
|
longRunningOperationsRequirePollingOperation,
|
package/dist/src/linter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linter.js","sourceRoot":"","sources":["../../src/linter.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE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AClB,qBAAqB;IACrB,4BAA4B;IAC5B,cAAc;IACd,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":"avoid-operation-id.d.ts","sourceRoot":"","sources":["../../../src/rules/avoid-operation-id.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,oBAAoB,mCAgB/B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createRule } from "@typespec/lint";
|
|
2
|
+
import { getOperationId } from "@typespec/openapi";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
import { isExcludedCoreType } from "./utils.js";
|
|
5
|
+
export const avoidOperationIdRule = createRule({
|
|
6
|
+
name: "avoid-operation-id",
|
|
7
|
+
create({ program }) {
|
|
8
|
+
return {
|
|
9
|
+
operation: (operation) => {
|
|
10
|
+
if (isExcludedCoreType(program, operation))
|
|
11
|
+
return;
|
|
12
|
+
if (getOperationId(program, operation)) {
|
|
13
|
+
reportDiagnostic(program, {
|
|
14
|
+
code: "avoid-operation-id",
|
|
15
|
+
format: { operationId: operation.name },
|
|
16
|
+
target: operation,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=avoid-operation-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"avoid-operation-id.js","sourceRoot":"","sources":["../../../src/rules/avoid-operation-id.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;IAC7C,IAAI,EAAE,oBAAoB;IAC1B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,IAAI,kBAAkB,CAAC,OAAO,EAAE,SAAS,CAAC;oBAAE,OAAO;gBACnD,IAAI,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,EAAE;oBACtC,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,oBAAoB;wBAC1B,MAAM,EAAE,EAAE,WAAW,EAAE,SAAS,CAAC,IAAI,EAAE;wBACvC,MAAM,EAAE,SAAS;qBAClB,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,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":"no-fixed-enum-discriminator.d.ts","sourceRoot":"","sources":["../../../src/rules/no-fixed-enum-discriminator.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,4BAA4B,mCAyBvC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { getDiscriminator } from "@typespec/compiler";
|
|
2
|
+
import { createRule } from "@typespec/lint";
|
|
3
|
+
import { isFixed } from "../decorators.js";
|
|
4
|
+
import { reportDiagnostic } from "../lib.js";
|
|
5
|
+
export const noFixedEnumDiscriminatorRule = createRule({
|
|
6
|
+
name: "no-fixed-enum-discriminator",
|
|
7
|
+
create({ program }) {
|
|
8
|
+
return {
|
|
9
|
+
model: (model) => {
|
|
10
|
+
const discriminator = getDiscriminator(program, model);
|
|
11
|
+
if (discriminator === undefined) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
const property = model.properties.get(discriminator.propertyName);
|
|
15
|
+
if (property === undefined || property.type.kind !== "Enum") {
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (isFixed(program, property.type)) {
|
|
19
|
+
reportDiagnostic(program, {
|
|
20
|
+
code: "no-fixed-enum-discriminator",
|
|
21
|
+
format: { enumName: property.type.name },
|
|
22
|
+
target: property,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
//# sourceMappingURL=no-fixed-enum-discriminator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-fixed-enum-discriminator.js","sourceRoot":"","sources":["../../../src/rules/no-fixed-enum-discriminator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAS,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,4BAA4B,GAAG,UAAU,CAAC;IACrD,IAAI,EAAE,6BAA6B;IACnC,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,KAAK,EAAE,CAAC,KAAY,EAAE,EAAE;gBACtB,MAAM,aAAa,GAAG,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;gBACvD,IAAI,aAAa,KAAK,SAAS,EAAE;oBAC/B,OAAO;iBACR;gBAED,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;gBAClE,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,EAAE;oBAC3D,OAAO;iBACR;gBAED,IAAI,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;oBACnC,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,6BAA6B;wBACnC,MAAM,EAAE,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,CAAC,IAAI,EAAE;wBACxC,MAAM,EAAE,QAAQ;qBACjB,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-nullable.d.ts","sourceRoot":"","sources":["../../../src/rules/no-nullable.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,mCAiBzB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { isNullType } from "@typespec/compiler";
|
|
2
|
+
import { createRule } from "@typespec/lint";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
export const noNullableRule = createRule({
|
|
5
|
+
name: "no-nullable",
|
|
6
|
+
create({ program }) {
|
|
7
|
+
return {
|
|
8
|
+
modelProperty: (property) => {
|
|
9
|
+
if (property.type.kind !== "Union") {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
if ([...property.type.variants.values()].some((x) => isNullType(x.type))) {
|
|
13
|
+
reportDiagnostic(program, {
|
|
14
|
+
code: "no-nullable",
|
|
15
|
+
target: property,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=no-nullable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"no-nullable.js","sourceRoot":"","sources":["../../../src/rules/no-nullable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;IACvC,IAAI,EAAE,aAAa;IACnB,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAuB,EAAE,EAAE;gBACzC,IAAI,QAAQ,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAAE;oBAClC,OAAO;iBACR;gBACD,IAAI,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE;oBACxE,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,aAAa;wBACnB,MAAM,EAAE,QAAQ;qBACjB,CAAC,CAAC;iBACJ;YACH,CAAC;SACF,CAAC;IACJ,CAAC;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-naming.d.ts","sourceRoot":"","sources":["../../../src/rules/property-naming.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,gBAAgB,mCAgC3B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { getProjectedNames } from "@typespec/compiler";
|
|
2
|
+
import { createRule } from "@typespec/lint";
|
|
3
|
+
import { reportDiagnostic } from "../lib.js";
|
|
4
|
+
import { isExcludedCoreType } from "./utils.js";
|
|
5
|
+
export const propertyNameRule = createRule({
|
|
6
|
+
name: "property-name-conflict",
|
|
7
|
+
create({ program }) {
|
|
8
|
+
return {
|
|
9
|
+
modelProperty: (property) => {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
if (isExcludedCoreType(program, property))
|
|
12
|
+
return;
|
|
13
|
+
const projectedNames = getProjectedNames(program, property);
|
|
14
|
+
const modelName = (_a = property.model) === null || _a === void 0 ? void 0 : _a.name.toLocaleLowerCase();
|
|
15
|
+
const propertyName = property.name.toLocaleLowerCase();
|
|
16
|
+
const csharpProjection = (_b = projectedNames === null || projectedNames === void 0 ? void 0 : projectedNames.get("csharp")) === null || _b === void 0 ? void 0 : _b.toLocaleLowerCase();
|
|
17
|
+
const clientProjection = (_c = projectedNames === null || projectedNames === void 0 ? void 0 : projectedNames.get("client")) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase();
|
|
18
|
+
if (csharpProjection === modelName || // csharp projection conflicts with model name
|
|
19
|
+
(clientProjection === modelName && !csharpProjection) // client projection conflicts with model name and there is no csharp projection
|
|
20
|
+
) {
|
|
21
|
+
reportDiagnostic(program, {
|
|
22
|
+
code: "property-name-conflict",
|
|
23
|
+
messageId: "projectedName",
|
|
24
|
+
format: { propertyName: property.name },
|
|
25
|
+
target: property,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
else if (propertyName === modelName && !(csharpProjection || clientProjection)) {
|
|
29
|
+
// warning if the property name conflicts with the model name and there is no csharp or client projected name
|
|
30
|
+
reportDiagnostic(program, {
|
|
31
|
+
code: "property-name-conflict",
|
|
32
|
+
format: { propertyName: property.name },
|
|
33
|
+
target: property,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=property-naming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"property-naming.js","sourceRoot":"","sources":["../../../src/rules/property-naming.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAiB,MAAM,oBAAoB,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC;IACzC,IAAI,EAAE,wBAAwB;IAC9B,MAAM,CAAC,EAAE,OAAO,EAAE;QAChB,OAAO;YACL,aAAa,EAAE,CAAC,QAAuB,EAAE,EAAE;;gBACzC,IAAI,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC;oBAAE,OAAO;gBAClD,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;gBAC5D,MAAM,SAAS,GAAG,MAAA,QAAQ,CAAC,KAAK,0CAAE,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBAC3D,MAAM,YAAY,GAAG,QAAQ,CAAC,IAAI,CAAC,iBAAiB,EAAE,CAAC;gBACvD,MAAM,gBAAgB,GAAG,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,GAAG,CAAC,QAAQ,CAAC,0CAAE,iBAAiB,EAAE,CAAC;gBAC5E,MAAM,gBAAgB,GAAG,MAAA,cAAc,aAAd,cAAc,uBAAd,cAAc,CAAE,GAAG,CAAC,QAAQ,CAAC,0CAAE,iBAAiB,EAAE,CAAC;gBAC5E,IACE,gBAAgB,KAAK,SAAS,IAAI,8CAA8C;oBAChF,CAAC,gBAAgB,KAAK,SAAS,IAAI,CAAC,gBAAgB,CAAC,CAAC,gFAAgF;kBACtI;oBACA,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,wBAAwB;wBAC9B,SAAS,EAAE,eAAe;wBAC1B,MAAM,EAAE,EAAE,YAAY,EAAE,QAAQ,CAAC,IAAI,EAAE;wBACvC,MAAM,EAAE,QAAQ;qBACjB,CAAC,CAAC;iBACJ;qBAAM,IAAI,YAAY,KAAK,SAAS,IAAI,CAAC,CAAC,gBAAgB,IAAI,gBAAgB,CAAC,EAAE;oBAChF,6GAA6G;oBAC7G,gBAAgB,CAAC,OAAO,EAAE;wBACxB,IAAI,EAAE,wBAAwB;wBAC9B,MAAM,EAAE,EAAE,YAAY,EAAE,QAAQ,CAAC,IAAI,EAAE;wBACvC,MAAM,EAAE,QAAQ;qBACjB,CAAC,CAAC;iBACJ;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/lib/foundations.tsp
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@azure-tools/typespec-azure-core",
|
|
3
|
-
"version": "0.30.0-dev.
|
|
3
|
+
"version": "0.30.0-dev.10",
|
|
4
4
|
"author": "Microsoft Corporation",
|
|
5
5
|
"description": "TypeSpec Azure Core library",
|
|
6
6
|
"homepage": "https://azure.github.io/typespec-azure",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
],
|
|
44
44
|
"peerDependencies": {
|
|
45
45
|
"@typespec/compiler": ">=0.43.0",
|
|
46
|
-
"@typespec/http": ">=0.43.
|
|
46
|
+
"@typespec/http": ">=0.43.1",
|
|
47
47
|
"@typespec/rest": ">=0.43.0"
|
|
48
48
|
},
|
|
49
49
|
"dependencies": {
|
|
@@ -51,21 +51,22 @@
|
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@typespec/compiler": ">=0.43.0",
|
|
54
|
-
"@typespec/http": ">=0.43.
|
|
54
|
+
"@typespec/http": ">=0.43.1",
|
|
55
55
|
"@typespec/rest": ">=0.43.0",
|
|
56
56
|
"@typespec/eslint-config-typespec": ">=0.6.0",
|
|
57
57
|
"@typespec/library-linter": ">=0.43.0",
|
|
58
58
|
"@typespec/eslint-plugin": ">=0.43.0",
|
|
59
|
+
"@typespec/openapi": ">=0.43.0",
|
|
59
60
|
"@typespec/versioning": ">=0.43.0",
|
|
60
61
|
"@types/mocha": "~10.0.0",
|
|
61
62
|
"@types/node": "~18.11.9",
|
|
62
|
-
"eslint": "^8.
|
|
63
|
-
"mocha": "~10.
|
|
63
|
+
"eslint": "^8.36.0",
|
|
64
|
+
"mocha": "~10.2.0",
|
|
64
65
|
"mocha-junit-reporter": "~2.2.0",
|
|
65
66
|
"mocha-multi-reporters": "~1.5.1",
|
|
66
|
-
"c8": "~7.
|
|
67
|
-
"rimraf": "~
|
|
68
|
-
"typescript": "~
|
|
67
|
+
"c8": "~7.13.0",
|
|
68
|
+
"rimraf": "~5.0.0",
|
|
69
|
+
"typescript": "~5.0.2"
|
|
69
70
|
},
|
|
70
71
|
"scripts": {
|
|
71
72
|
"clean": "rimraf ./dist ./temp",
|