Dependency Resolution Output

The output of the dependency resolution tool should be printed to standard output.

Output Schema

The schema of the dependency resolution output should be an array of Resolution objects, with the structure of each object being as follows.

// Resolution is the result of dependency resolution: either a successfully
// resolved target or an error.
type Resolution struct {
    // Raw is the original raw dep that this was resolution was attempted on.
    Raw interface{}

    // Target is the resolved dependency, if resolution succeeds.
    Target *ResolvedTarget `json:",omitempty"`

    // Error is the resolution error, if any.
    Error string `json:",omitempty"`
}

The Raw field is language specific, but the Target field follows the following format.

// ResolvedTarget represents a resolved dependency target.
type ResolvedTarget struct {
    // ToRepoCloneURL is the clone URL of the repository that is depended on.
    //
    // When graphers emit ResolvedDependencies, they should fill in this field,
    // not ToRepo, so that the dependent repository can be added if it doesn't
    // exist. The ToRepo URI alone does not specify enough information to add
    // the repository (because it doesn't specify the VCS type, scheme, etc.).
    ToRepoCloneURL string

    // ToUnit is the name of the source unit that is depended on.
    ToUnit string

    // ToUnitType is the type of the source unit that is depended on.
    ToUnitType string

    // ToVersion is the version of the dependent repository (if known),
    // according to whatever version string specifier is used by FromRepo's
    // dependency management system.
    ToVersionString string

    // ToRevSpec specifies the desired VCS revision of the dependent repository
    // (if known).
    ToRevSpec string
}

If an error occurred during resolution, a detailed description should be placed in the Error field.

Example: Depresolve on gorilla/mux

[
    {
        "Raw": "bytes",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "bytes",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "errors",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "errors",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "fmt",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "fmt",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "github.com/gorilla/context",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "github.com/gorilla/context",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "net/http",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "net/http",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "net/url",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "net/url",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "path",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "path",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "regexp",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "regexp",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "strings",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "strings",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    },
    {
        "Raw": "testing",
        "Target": {
            "ToRepoCloneURL": "",
            "ToUnit": "testing",
            "ToUnitType": "GoPackage",
            "ToVersionString": "",
            "ToRevSpec": ""
        }
    }
]