octokit / source-generator

6 stars 3 forks source link

Hack: fix CreateDateOnlyFromDiscriminatorValue #19

Closed kfcampbell closed 7 months ago

kfcampbell commented 8 months ago

Kiota has something funky going on with these structs, and we require a find/replace in post-processing to fix the package names used to reference them:

https://github.com/octokit/source-generator/blob/d1c29eea0c06262a42cc119b3ab0304f5e8e67ef/post-processors/go/main.go#L237-L252

When this step is removed, the error given is versions/versions_request_builder.go:46:152: undefined: i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.CreateDateOnlyFromDiscriminatorValue.

We should bring this up to the Kiota team and see if there's anything we can do to fix it.

baywet commented 8 months ago

Could you provide the OpenAPI description for those operations please?

kfcampbell commented 8 months ago

Yep! It's the same endpoint as in #23:

"/versions": {
      "get": {
        "summary": "Get all API versions",
        "description": "Get all supported GitHub API versions.",
        "tags": [
          "meta"
        ],
        "operationId": "meta/get-all-versions",
        "externalDocs": {
          "description": "API method documentation",
          "url": "https://docs.github.com/rest/meta/meta#get-all-api-versions"
        },
        "responses": {
          "200": {
            "description": "Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "format": "date",
                    "example": "2021-01-01"
                  }
                },
                "examples": {
                  "default": {
                    "value": [
                      "2021-01-01",
                      "2021-06-01",
                      "2022-01-01"
                    ]
                  }
                }
              }
            }
          },
          "404": {
            "$ref": "#/components/responses/not_found"
          }
        },
        "x-github": {
          "githubCloudOnly": false,
          "enabledForGitHubApps": true,
          "category": "meta",
          "subcategory": "meta"
        }
      }
    },
baywet commented 8 months ago

looks like a bug to me, it seems that kiota is generating a call to SendCollection instead of SendPrimitiveCollection. Can you create an issue in kiota so we can address it please?