UserType discrepancy between enum value and Graph API response

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
48/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
php
領域
api

調査の方向性

生成された Microsoft\Graph\Generated\Models\UserType enum から始め、その MEMBER 値を、issue に示されている Microsoft Graph user endpoint のレスポンスと比較します。他の SDK enum 定数についても、同じ種類の不一致がないか確認します。UserType が API と一致し、見つかった追加の不一致がすべて特定されて修正されれば完了です。

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

説明

service bug
Describe the bug

The following Microsoft Graph API endpoint:
https://graph.microsoft.com/v1.0/users/{{azureUserId}}?$select=userType

returns

{
  "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users(userType)/$entity",
  "userType": "Member"
}

However, the Microsoft\Graph\Generated\Models\UserType generated enum of the SDK contains
public const MEMBER = "member";

If an integration intends to proactively remove non-member type users from the system using code such as:

if ($azureUser->getUserType() !== UserType::MEMBER) {
    $azureUser->delete();
}

this risks removing all Azure users from the system, because an Azure user of user type member would satisfy this condition as well ('member' !== 'Member' is true).

Note: This discrepancy between the API response and the generated SDK has triggered an incident in a production environment of a software product, because the unit tests use the UserType value from the SDK.

Expected behavior

The UserType enum/const should have values capitalized.
Any other enum/consts contained in the SDK should be reviewed for correctness to be in-line with the actual API responses.

How to reproduce

See issue description. There's discrepancy between the API response and the SDK enum/const value.

SDK Version

"microsoft/microsoft-graph": "^2.3",

Latest version known to work for scenario above?

None.

Known Workarounds

Not using UserType, hardcoding sentence-cased value.

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_
主要言語
PHP
スター
669
フォーク
149
平均マージ
1日 4時間
マージ済み PR(30日)
5

環境構築

はじめの一歩

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

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

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

似ている issue

PHP の issue をもっと見る

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

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