Is it really correct that the Javascript version of the graph SDK doesn't offer typed requests?

オープン
#2,004 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
42/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
静か
技術スタック
javascript, typescript

調査の方向性

Start with the JavaScript tab in the linked Microsoft Graph search-query documentation and inspect the client.api('/search/query') request and response behavior. Compare that with the typed C# sample; done means establishing whether typed request and response support exists in this SDK and documenting or scoping the gap clearly.

索引モデルが issue の本文から書いたものです。

説明

status:waiting-for-triage

I'm coming from a C# background so forgive me if I'm wrong on this, but from the documentation it seems for example that doing a graph search in C# is fully typed, e.g:


var requestBody = new QueryPostRequestBody
{
	Requests = new List<SearchRequest>
	{
		new SearchRequest
		{
			EntityTypes = new List<EntityType?>
			{
				EntityType.ExternalItem,
			},
			ContentSources = new List<string>
			{
				"/external/connections/connectionfriendlyname",
			},
			Region = "US",
			Query = new SearchQuery
			{
				QueryString = "contoso product",
			},
			From = 0,
			Size = 25,
			Fields = new List<string>
			{
				"title",
				"description",
			},
		},
	},
};

var result = await graphClient.Search.Query.PostAsQueryPostResponseAsync(requestBody);

Which is fine, give you a SearchResponse object.

whereas in javascript you need to use the "magic string" /search/query for example:


const searchResponse = {
  requests: [
    {
      entityTypes: [
        'externalItem'
      ],
      contentSources: [
        '/external/connections/connectionfriendlyname'
      ],
       region: 'US',
       query: {
        queryString: 'contoso product'
      },
      from: 0,
      size: 25,
      fields: [
        'title',
        'description'
      ]
    }
  ]
};

await client.api('/search/query')
	.post(searchResponse);

And this returns an any type, so you have to know/guess the response?

Both samples taken from https://learn.microsoft.com/en-us/graph/api/search-query?view=graph-rest-1.0&utm_source=chatgpt.com&tabs=javascript

Is this actually correct?

主要言語
TypeScript
スター
833
フォーク
240
PR マージ指標
30日以内にマージされた PR はありません

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoftgraph/msgraph-sdk-javascript のほかの issue

microsoftgraph/msgraph-sdk-javascript の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。