microsoft / Power-Fx

Power Fx low-code programming language
MIT License
3.18k stars 318 forks source link

Connectors: AzureDevOps.HttpRequest #2121

Open MikeStall opened 9 months ago

MikeStall commented 9 months ago

These expressions work in Power Apps, but not in Fx Connectors:

Set(_r, AzureDevOps.HttpRequest("msazure", "GET", "/OneAgile/_apis/git/repositories/PowerApps-Client/items?path=/src/Language/PowerFxVersion.props&api-version=7.1-preview.1&includeContent=true&$format=json"))

Text(_r.content)

HttpRequest returns an Untyped object with json body this:

{
       "objectId": "cf70d4db49fc9148cc473f51cb9d87013b06ad6b",
        "gitObjectType": "blob",
        "commitId": "e10d0512ef1a948386473879fabef847cc24da99",
        "path": "/src/Language/PowerFxVersion.props",
        "content": "<Project>\n    <PropertyGroup>\n\t\t<!-- PowerFx Commit -->\n\t\t<!-- https://github.com/microsoft/Power-Fx/commit/137078ecae3042833bdab27bcf1a2ac9a21c6692 -->\n\t\t<!-- To find the build # given a commit id, go to https://aka.ms/PowerFxEngSys and find the\n\t\tcorresponding commit/Nuget version -->\n\t\t<PowerFxVersion>1.2.0-build.20231213-1002</PowerFxVersion>\n\t</PropertyGroup>\n</Project>\n",
        "url": "https://dev.azure.com/msazure/db635de9-6980-4e4a-9a68-c3252d82e537/_apis/git/repositories/8e69880b-41c2-4031-a2c6-f0af88baecd7/items?path=%2Fsrc%2FLanguage%2FPowerFxVersion.props&versionType=Branch&versionOptions=None",
        "_links": {
          "self": {
            "href": "https://dev.azure.com/msazure/db635de9-6980-4e4a-9a68-c3252d82e537/_apis/git/repositories/8e69880b-41c2-4031-a2c6-f0af88baecd7/items?path=%2Fsrc%2FLanguage%2FPowerFxVersion.props&versionType=Branch&versionOptions=None"
          },
          "repository": {
            "href": "https://dev.azure.com/msazure/db635de9-6980-4e4a-9a68-c3252d82e537/_apis/git/repositories/8e69880b-41c2-4031-a2c6-f0af88baecd7"
          },
          "blob": {
            "href": "https://dev.azure.com/msazure/db635de9-6980-4e4a-9a68-c3252d82e537/_apis/git/repositories/8e69880b-41c2-4031-a2c6-f0af88baecd7/blobs/cf70d4db49fc9148cc473f51cb9d87013b06ad6b"
          }
        }

Todo:

  1. At design time, the signature should return UntypedObject.
  2. At runtime, we see the response is json, and create a json impl of the untyped object.
LucGenetier commented 6 months ago

Not supported yet as the swagger defines a Dictionary in the return type, which we don't support https://swagger.io/docs/specification/data-models/dictionaries/

LucGenetier commented 6 months ago

This part of the swagger (additionalProperties)

    "_links": {
      "description": "Collection of links relevant to resource.",
      "type": "object",
      **"additionalProperties": {
        "$ref": "#/definitions/GenericLink"
      }**,
      "x-ms-summary": "Links",
      "x-ms-visibility": "advanced"
    },
LucGenetier commented 6 months ago

Notes Json payload contains \u0026 which should be & Server returns 500