Skip to content

Wrong response type: string should be int #47

Closed

Description

@edoardottt

Hi google team.

@zaibon just opened an issue in my repo (edoardottt/depsdev#51) pointing out that the fields lineCount and lineCoverCount are strings now, but they should be integers following the docs (https://docs.deps.dev/api/v3alpha/#getproject).

Try this:

curl "https://api.deps.dev/v3alpha/projects/github.com%2Fklauspost%2Fcompress" | grep -i linecount
...
"ossFuzz":{"lineCount":"20711","lineCoverCount":"12156",
...

What are your thoughts on this? Will you change the docs or the APIs?

thanks

Activity

  1. added
    bugSomething isn't working
    documentationImprovements or additions to documentation
    on Jan 10, 2024
  2. sarnesjo commented on Jan 10, 2024

    @sarnesjo

    Thanks for reporting this. It is indeed a bug in the generated documentation for our the API.

    A bit of technical detail: Our API can be accessed via gRPC or as JSON-over-HTTP, with the latter being implemented in terms of the former. The canonical service definition can be found in api.proto, which uses int64 for these fields, which is encoded as string in JSON to avoid precision loss when used from JavaScript, whose number type only supports integers up to 2^53-1.

    As a short-term fix, we have updated our documentation generator and regenerated the documentation to correctly describe these fields as string. In a future version of the API, we will change their type to int32/number, but for now, we want to avoid breaking existing clients.

  3. edoardottt commented on Jan 10, 2024

    @edoardottt
    ContributorAuthor

    Thank you so much for the answer @sarnesjo.

    So I have to assume ALL number types in that docs mean string (e.g. edges[].fromNode: number in GetDependencies) or the ones having type uint32 are okay?

  4. added a commit that references this issue on May 16, 2024
    036be9c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocumentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions