oasis-tcs / sarif-spec

OASIS SARIF TC: Repository for development of the draft standard, where requests for modification should be made via Github Issues
https://github.com/oasis-tcs/sarif-spec
Other
169 stars 47 forks source link

Clarification about ids of location objects below a *notification* #651

Closed davidmalcolm closed 4 months ago

davidmalcolm commented 4 months ago

"3.28.2 id property" (of location) states:

A location object MAY contain a property named id whose value is a non-negative integer that is unique among all location objects belonging to theResult. The value does not need to be unique across all result objects (§3.27) in theRun.

If id is absent, it SHALL default to -1, which indicates that the value is unknown (not set).

NOTE: Negative values are forbidden because their use would suggest some non-obvious semantic difference between positive and negative values.

EXAMPLE: Within a result object, the following property values (among others) are location objects, and no two of them can have the same value for id:

result.relatedLocations[0]

result.codeFlows[0].threadFlows[0].locations[0].location

result.stacks[0].frames[0].location

The id property has two purposes: to enable an embedded link (§3.11.6) within a message object (§3.11) to refer to thisObject, and to identify thisObject as the target of a locationRelationship (§3.34). If no message object within theResult refers to thisObject via an embedded link and no locationRelationship object within theResult specifies thisObject as its target, the id property does not need to appear.

i.e. there's a "namespace" of numeric ids for locations within each result object.

In #643 we're adding a "relatedLocations" property to notification objects.

Should this be generalized so that for any locations within a notification, any with ids must have unique ids within that notification?

KalleOlaviNiemitalo commented 4 months ago

Duplicate of https://github.com/oasis-tcs/sarif-spec/issues/540?

davidmalcolm commented 4 months ago

Duplicate of #540?

Yes; thanks for the link. Closing out as a duplicate.