private populateOperations()

in packages/rulesets/src/native/utilities/arm-helper.ts [94:117]


  private populateOperations(doc: any, specPath: string) {
    const paths = { ...(doc.paths || {}), ...(doc["x-ms-paths"] || {}) }
    const operations: Operation[] = []
    for (const [key, value] of Object.entries(paths)) {
      for (const [method, operation] of Object.entries(value as any)) {
        if (method !== "parameters") {
          const op = operation as any
          const response = op?.responses?.["200"] || op?.responses?.["201"]
          const requestBodyParameter = this.getBodyParameter(op.parameters)
          if (response) {
            operations.push({
              specPath,
              apiPath: key,
              httpMethod: method,
              requestBodyParameter,
              responseSchema: response.schema,
              operationId: op?.operationId,
            })
          }
        }
      }
    }
    return operations
  }