Skip to content

x/pkgsite The OpenAPI spec for pkg.go.dev/v1beta is incomplete #79989

@yuce

Description

@yuce

Hello,

I think the OpenAPI spec for pkg.go.dev/v1beta is incomplete.
The PackageInfo type at http://pkg.go.dev/v1beta/openapi.yaml is not linked to anything.
So, clients generated from the OpenAPI spec don't return the full package information, such as the synopsis.
The following is the JSON document corresponding to the Package value for golang.org/x/time/rate:

{
        "goarch": "all",
        "goos": "all",
        "isLatest": true,
        "isStandardLibrary": false,
        "modulePath": "golang.org/x/time",
        "version": "v0.15.0"
}

It's consistent with the pkgsite.internal.api.Package type: https://pkg.go.dev/golang.org/x/pkgsite/internal/api#Package

But the https://pkg.go.dev/v1beta endpoint returns more fields (such as synopsis, and name) which are from the PackageInfo type:

$ curl -sL https://pkg.go.dev/v1beta/package/golang.org/x/time/rate | jq
{
  "modulePath": "golang.org/x/time",
  "version": "v0.15.0",
  "isLatest": true,
  "isStandardLibrary": false,
  "goos": "all",
  "goarch": "all",
  "path": "golang.org/x/time/rate",
  "name": "rate",
  "synopsis": "Package rate provides a rate limiter.",
  "isRedistributable": true
}

Also, the documentation for the /v1beta/package/{path} endpoint at https://pkg.go.dev/v1beta/api is confusing.
Although the example response on the right is correct for the example request the fields on the left are different from what the Package type contains (I had to add a screenshot since I couldn't get an anchor to it)

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions