Skip to content

[Schema Inaccuracy] Artifact.Id is missing int64 format #7266

Description

@bstordrup

Schema Inaccuracy

When I use Kiota to generate clients for the GitHub API, I get a deserialization error when retreiving artifacts through the API. The value for the Artifact.Id is simply too large and exceeds an Int32.

Expected

It should not result in deserialization errors.

Problem

In the api.github.com.json file, the Actor.Id is defined as:

      "artifact": {
        "title": "Artifact",
        "description": "An artifact",
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 5
          },

This makes Kiota belive that it can use an integer deserializer:

        public virtual IDictionary<string, Action<IParseNode>> GetFieldDeserializers()
        {
            return new Dictionary<string, Action<IParseNode>>
            {
                { "archive_download_url", n => { ArchiveDownloadUrl = n.GetStringValue(); } },
                { "created_at", n => { CreatedAt = n.GetDateTimeOffsetValue(); } },
                { "digest", n => { Digest = n.GetStringValue(); } },
                { "expired", n => { Expired = n.GetBoolValue(); } },
                { "expires_at", n => { ExpiresAt = n.GetDateTimeOffsetValue(); } },
--->            { "id", n => { Id = n.GetIntValue(); } },
                { "name", n => { Name = n.GetStringValue(); } },
                { "node_id", n => { NodeId = n.GetStringValue(); } },
                { "size_in_bytes", n => { SizeInBytes = n.GetIntValue(); } },
                { "updated_at", n => { UpdatedAt = n.GetDateTimeOffsetValue(); } },
                { "url", n => { Url = n.GetStringValue(); } },
                { "workflow_run", n => { WorkflowRun = n.GetObjectValue<global::GitPackagesManager.ApiClient.Models.Artifact_workflow_run>(global::GitPackagesManager.ApiClient.Models.Artifact_workflow_run.CreateFromDiscriminatorValue); } },
            };
        }

If the Artifact.Id had been defined as

      "artifact": {
        "title": "Artifact",
        "description": "An artifact",
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "example": 5,
            "format": "int64"
          },

the 'Id' line in the generated GetFieldDeserializers() method would use n.GetLongValue() instead of n.GetIntValue()

Activity

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions