in packages/rulesets/src/native/utilities/arm-helper.ts [283:321]
public getAllResources(includeGet: boolean = false, useArmResources: boolean = true, includeListOperationPath: boolean = false) {
if (useArmResources && this.armResources) {
return this.armResources
}
if (useArmResources) {
this.populateResources(this.innerDoc, this.specPath)
}
const references = this.inventory.referencesOf(this.specPath)
for (const [specPath, reference] of Object.entries(references)) {
this.populateResources(reference, specPath)
}
const localResourceModels = this.resources.filter((re) => re.specPath === this.specPath)
const resWithXmsRes = localResourceModels.filter(
(re) => this.XmsResources.has(re.modelName) && !this.BaseResourceModelNames.includes(re.modelName.toLowerCase()),
)
const resWithPutOrPatch = includeGet
? localResourceModels.filter((re) =>
re.operations.some(
(op) =>
(op.httpMethod === "get" && (includeListOperationPath ? true : !isListOperationPath(op.apiPath))) ||
op.httpMethod === "put" ||
op.httpMethod === "patch",
),
)
: localResourceModels.filter((re) => re.operations.some((op) => op.httpMethod === "put" || op.httpMethod == "patch"))
const reWithPostOnly = resWithXmsRes.filter((re) => re.operations.every((op) => op.httpMethod === "post"))
const resources = _.uniqWith(
resWithXmsRes.filter((re) => !reWithPostOnly.some((re1) => re1.modelName === re.modelName)).concat(resWithPutOrPatch),
_.isEqual,
)
// remove the resource only return by post , and add the resources return by put or patch
if (useArmResources) {
this.armResources = resources
}
return resources
}