CWE API Client - v1.0.1
    Preparing search index...

    Class WeaknessResource

    Represents a CWE weakness resource, providing access to weakness details and its position in the CWE hierarchy.

    Implements PromiseLike<CweWeakness> so it can be awaited directly to fetch the full weakness, while also exposing hierarchy methods.

    // Await directly to get full weakness data
    const weakness = await cwe.weakness(79);

    // Or call .get() explicitly
    const weakness = await cwe.weakness(79).get();

    // Navigate the hierarchy
    const parents = await cwe.weakness(74).parents(1000);
    const children = await cwe.weakness(74).children(1000);
    const ancestors = await cwe.weakness(74).ancestors(1000);
    const descendants = await cwe.weakness(74).descendants(1000);
    Index

    Methods

    • Fetches the direct parents of this weakness in a given view.

      GET /cwe/{id}/parents?view={viewId}

      Parameters

      • OptionalviewId: number

        CWE view ID to scope the hierarchy (e.g. 1000)

      Returns Promise<CweRelationEntry[]>

      Array of direct parent entries

      const parents = await cwe.weakness(74).parents(1000);
      
    • Fetches the direct children of this weakness in a given view.

      GET /cwe/{id}/children?view={viewId}

      Parameters

      • OptionalviewId: number

        CWE view ID to scope the hierarchy (e.g. 1000)

      Returns Promise<CweRelationEntry[]>

      Array of direct child entries

      const children = await cwe.weakness(74).children(1000);
      
    • Fetches the full ancestor tree of this weakness in a given view.

      GET /cwe/{id}/ancestors?view={viewId}

      Parameters

      • OptionalviewId: number

        CWE view ID to scope the hierarchy (e.g. 1000)

      Returns Promise<CweAncestorNode[]>

      Recursive ancestor tree from this node up to the view root

      const tree = await cwe.weakness(74).ancestors(1000);
      
    • Fetches the full descendant tree of this weakness in a given view.

      GET /cwe/{id}/descendants?view={viewId}

      Parameters

      • OptionalviewId: number

        CWE view ID to scope the hierarchy (e.g. 1000)

      Returns Promise<CweDescendantNode[]>

      Recursive descendant tree from this node down to leaf entries

      const tree = await cwe.weakness(74).descendants(1000);