@azure-tools/typespec-azure-core 0.61.0-dev.5 → 0.61.0-dev.7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-operation-request-body.d.ts","sourceRoot":"","sources":["../../../src/rules/rpc-operation-request-body.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc-operation-request-body.d.ts","sourceRoot":"","sources":["../../../src/rules/rpc-operation-request-body.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,2BAA2B;;;EAyCtC,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { createRule, paramMessage } from "@typespec/compiler";
|
|
2
|
-
import { getHttpOperation } from "@typespec/http";
|
|
3
|
-
import { isAzureSubNamespace, isExcludedCoreType } from "./utils.js";
|
|
2
|
+
import { getHttpOperation, isBodyIgnore } from "@typespec/http";
|
|
4
3
|
export const rpcOperationRequestBodyRule = createRule({
|
|
5
4
|
name: "rpc-operation-request-body",
|
|
6
5
|
description: "Warning for RPC body problems.",
|
|
@@ -12,12 +11,8 @@ export const rpcOperationRequestBodyRule = createRule({
|
|
|
12
11
|
create(context) {
|
|
13
12
|
return {
|
|
14
13
|
operation: (operation) => {
|
|
15
|
-
if (isExcludedCoreType(context.program, operation))
|
|
16
|
-
return;
|
|
17
14
|
if (operation.node?.templateParameters.length !== 0)
|
|
18
15
|
return;
|
|
19
|
-
if (!isAzureSubNamespace(context.program, operation.namespace))
|
|
20
|
-
return;
|
|
21
16
|
const originalOperation = operation;
|
|
22
17
|
while (operation.sourceOperation) {
|
|
23
18
|
operation = operation.sourceOperation;
|
|
@@ -25,7 +20,9 @@ export const rpcOperationRequestBodyRule = createRule({
|
|
|
25
20
|
operation.namespace?.name === "Core" &&
|
|
26
21
|
operation.namespace?.namespace?.name === "Azure") {
|
|
27
22
|
const httpOperation = getHttpOperation(context.program, originalOperation)[0];
|
|
28
|
-
const bodyParam = httpOperation.parameters.body
|
|
23
|
+
const bodyParam = httpOperation.parameters.properties.find((p) => p.kind === "body" ||
|
|
24
|
+
p.kind === "bodyRoot" ||
|
|
25
|
+
(p.kind === "bodyProperty" && isBodyIgnore(context.program, p.property) === false));
|
|
29
26
|
const verb = httpOperation.verb.toLowerCase();
|
|
30
27
|
if ((verb === "get" || verb === "delete") && bodyParam !== undefined) {
|
|
31
28
|
context.reportDiagnostic({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-operation-request-body.js","sourceRoot":"","sources":["../../../src/rules/rpc-operation-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"rpc-operation-request-body.js","sourceRoot":"","sources":["../../../src/rules/rpc-operation-request-body.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEhE,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,CAAC;IACpD,IAAI,EAAE,4BAA4B;IAClC,WAAW,EAAE,gCAAgC;IAC7C,QAAQ,EAAE,SAAS;IACnB,QAAQ,EAAE;QACR,OAAO,EAAE,uDAAuD;QAChE,aAAa,EAAE,YAAY,CAAA,uBAAuB,MAAM,uBAAuB;KAChF;IACD,MAAM,CAAC,OAAO;QACZ,OAAO;YACL,SAAS,EAAE,CAAC,SAAoB,EAAE,EAAE;gBAClC,IAAI,SAAS,CAAC,IAAI,EAAE,kBAAkB,CAAC,MAAM,KAAK,CAAC;oBAAE,OAAO;gBAE5D,MAAM,iBAAiB,GAAG,SAAS,CAAC;gBACpC,OAAO,SAAS,CAAC,eAAe,EAAE,CAAC;oBACjC,SAAS,GAAG,SAAS,CAAC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