diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index aa02237..400d0ef 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -50,3 +50,24 @@ From the root folder `/msgraph-bicep-types` run the following PowerShell script ``` After running the scripts the new types will be available in [/generated](./generated) folder. + +### Regenerate an existing version from its Swagger snapshot + +For an explicitly approved correction to an existing version, update that version's +YAML configuration and the corresponding versioned Swagger snapshots under both +`src/swagger-generation/output` and `swagger/specification`. Preserve unrelated +schema shapes: regenerating historical Swagger from the current metadata can +introduce unrelated changes. + +After building `src/autorest.bicep`, run from `src/generator`: + +```powershell +npm run generate -- --specs-dir ..\..\swagger --single-path microsoftgraph --extension-version 1.0.0 +npm run generate -- --specs-dir ..\..\swagger --single-path microsoftgraph --extension-version 1.1.0-preview +``` + +Omitting `--extension-version` retains the default latest-configured-version +behavior. Explicit selection supports `1.0.0` and `1.1.0-preview` only; older +versions can have incompatible index shapes. Compare the resulting serialized graphs with the original versions, +test both API versions, and validate compiler diagnostics and emitted deployment +inputs before publishing. Source changes do not replace published packages. diff --git a/docs/getting-started.md b/docs/getting-started.md index a8cef7c..7fd2120 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -1,3 +1,23 @@ # Getting started Go to [Bicep templates for Microsoft Graph](https://aka.ms/graphbicep). + +## Read-only authoring corrections in 1.0.0 and 1.1.0-preview + +The 1.0.0 and 1.1.0-preview type definitions correct ordinary resource-body writes for these properties in both the `v1.0` and `beta` API versions: + +| Resource | Read-only properties | +|---|---| +| `Microsoft.Graph/groups` | `isManagementRestricted`, `serviceProvisioningErrors` | +| `Microsoft.Graph/applications` | `disabledByMicrosoftStatus`, `verifiedPublisher` | +| `Microsoft.Graph/servicePrincipals` | `disabledByMicrosoftStatus` | + +These properties remain available for reads and outputs. Assignments produce read-only warnings with Bicep 0.48.1; builds still succeed, but custom gates that reject warnings can fail. Remove these assignments from resource declarations. This corrects the authoring contract, not the underlying service behavior or permissions, and preserves each version's existing relationship shapes. Updating these source artifacts does not replace already-published or cached extension packages. + +`isManagementRestricted` reflects restricted-management administrative-unit membership; it is not a switch for placing a group in an administrative unit. `serviceProvisioningErrors` is service-produced diagnostic state. See the [group contract](https://learn.microsoft.com/en-us/graph/api/resources/group?view=graph-rest-1.0) and the [confirmed provisioning-error annotation gap](https://github.com/microsoftgraph/msgraph-bicep-types/issues/257#issuecomment-3184478843). + +`disabledByMicrosoftStatus` is Microsoft-controlled status, not a way to enable or disable an application. See [application](https://learn.microsoft.com/en-us/graph/api/resources/application?view=graph-rest-1.0) and [service principal](https://learn.microsoft.com/en-us/graph/api/resources/serviceprincipal?view=graph-rest-1.0) contracts and the [confirmed read-only behavior](https://github.com/microsoftgraph/msgraph-bicep-types/issues/260). + +Application publisher verification requires the separate [setVerifiedPublisher action](https://learn.microsoft.com/en-us/graph/api/application-setverifiedpublisher?view=graph-rest-1.0); setting `verifiedPublisher` in a Bicep resource body is not supported. This patch does not add that action or app-only verification. + +Service-principal `appRoles`, `addIns`, supported URLs, and `servicePrincipalNames` are deliberately not made globally read-only. Writability depends on the property, service-principal type, and whether values originate from the backing application. In particular, inherited application roles differ from service-principal-local roles, and additional service-principal names have hybrid-application restrictions. See [update servicePrincipal](https://learn.microsoft.com/en-us/graph/api/serviceprincipal-update?view=graph-rest-1.0) and [appRole](https://learn.microsoft.com/en-us/graph/api/resources/approle?view=graph-rest-1.0). diff --git a/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.json b/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.json index 76ec980..5490633 100644 --- a/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.json +++ b/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.json @@ -103,7 +103,7 @@ "$ref": "#/7" }, "flags": 2, - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit." + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management)." }, "mail": { "type": { @@ -255,7 +255,7 @@ "type": { "$ref": "#/14" }, - "flags": 0, + "flags": 2, "description": "Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object." }, "theme": { @@ -588,7 +588,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { @@ -763,7 +763,7 @@ "type": { "$ref": "#/69" }, - "flags": 0, + "flags": 2, "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification." }, "web": { @@ -1843,7 +1843,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { diff --git a/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.md b/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.md index ceccdc2..bb9e4e3 100644 --- a/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.md +++ b/generated/microsoftgraph/microsoft.graph/beta/1.0.0/types.md @@ -13,7 +13,7 @@ * **defaultRedirectUri**: string: The default redirect URI. If specified and there's no explicit redirect URI in the sign-in request for SAML and OIDC flows, Microsoft Entra ID sends the token to this redirect URI. Microsoft Entra ID also sends the token to this default URI in SAML IdP-initiated single sign-on. The value must match one of the configured redirect URIs for the application. * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide a description of the application object to end users. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string (Required): The display name for the application. Maximum length is 256 characters. * **groupMembershipClaims**: string: Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following string values: None, SecurityGroup (for security groups and Microsoft Entra roles), All (this gets all security groups, distribution groups, and Microsoft Entra directory roles that the signed-in user is a member of). * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. @@ -42,7 +42,7 @@ * **tokenEncryptionKeyId**: string {minLength: 36, maxLength: 36, pattern: "^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"}: Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * **type**: 'Microsoft.Graph/applications' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to an application and used as an alternate key. Immutable. -* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. +* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher) (ReadOnly): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. * **web**: [MicrosoftGraphWebApplication](#microsoftgraphwebapplication): Specifies settings for a web application. * **windows**: [MicrosoftGraphWindowsApplication](#microsoftgraphwindowsapplication): Specifies settings for apps running Microsoft Windows and published in the Microsoft Store or Xbox games store. @@ -90,7 +90,7 @@ * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. * **infoCatalogs**: string[]: Identifies the info segments assigned to the group. * **isAssignableToRole**: bool: Indicates whether this group can be assigned to a Microsoft Entra role. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group cannot be a dynamic group (that is, groupTypes can't contain DynamicMembership). Only callers with at least the Privileged Role Administrator role can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Microsoft Entra role assignmentsUsing this feature requires a Microsoft Entra ID P1 license. -* **isManagementRestricted**: bool (ReadOnly): Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. +* **isManagementRestricted**: bool (ReadOnly): Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). * **mail**: string (ReadOnly): The SMTP address for the group, for example, 'serviceadmins@contoso.com'. Read-only. * **mailEnabled**: bool (Required): Specifies whether the group is mail-enabled. Required. * **mailNickname**: string (Required): The mail alias for the group, unique for Microsoft 365 groups in the organization. Maximum length is 64 characters. This property can contain only characters in the ASCII character set 0 - 127 except the following: @ () / [] ' ; : <> , SPACE. @@ -114,7 +114,7 @@ * **resourceProvisioningOptions**: string[]: Specifies the group resources that are associated with the Microsoft 365 group. The possible value is Team. For more information, see Microsoft 365 group behaviors and provisioning options. * **securityEnabled**: bool (Required): Specifies whether the group is a security group. * **securityIdentifier**: string (ReadOnly): Security identifier of the group, used in Windows scenarios. Read-only. -* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[]: Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object. +* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[] (ReadOnly): Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object. * **theme**: string: Specifies a Microsoft 365 group's color theme. Possible values are Teal, Purple, Green, Blue, Pink, Orange or Red. * **type**: 'Microsoft.Graph/groups' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to a group and used as an alternate key. Immutable. @@ -229,7 +229,7 @@ * **appRoles**: [MicrosoftGraphAppRole](#microsoftgraphapprole)[]: The roles exposed by the application, which this service principal represents. For more information, see the appRoles property definition on the application entity. Not nullable. * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide an internal end-user facing description of the service principal. End-user portals such MyApps displays the application description in this field. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string: The display name for the service principal. * **homepage**: string: Home page or landing page of the application. * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. diff --git a/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.json b/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.json index 54f3dce..970690b 100644 --- a/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.json +++ b/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.json @@ -103,7 +103,7 @@ "$ref": "#/7" }, "flags": 2, - "description": "Indicates whether the group is a member of a restricted management administrative unit. The default value is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit." + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management)." }, "mail": { "type": { @@ -255,7 +255,7 @@ "type": { "$ref": "#/14" }, - "flags": 0, + "flags": 2, "description": "Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object." }, "theme": { @@ -636,7 +636,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { @@ -811,7 +811,7 @@ "type": { "$ref": "#/70" }, - "flags": 0, + "flags": 2, "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification." }, "web": { @@ -1891,7 +1891,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { diff --git a/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.md b/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.md index ad32672..707a001 100644 --- a/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.md +++ b/generated/microsoftgraph/microsoft.graph/beta/1.1.0-preview/types.md @@ -13,7 +13,7 @@ * **defaultRedirectUri**: string: The default redirect URI. If specified and there's no explicit redirect URI in the sign-in request for SAML and OIDC flows, Microsoft Entra ID sends the token to this redirect URI. Microsoft Entra ID also sends the token to this default URI in SAML IdP-initiated single sign-on. The value must match one of the configured redirect URIs for the application. * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide a description of the application object to end users. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string (Required): The display name for the application. Maximum length is 256 characters. * **groupMembershipClaims**: string: Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following string values: None, SecurityGroup (for security groups and Microsoft Entra roles), All (this gets all security groups, distribution groups, and Microsoft Entra directory roles that the signed-in user is a member of). * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. @@ -42,7 +42,7 @@ * **tokenEncryptionKeyId**: string {minLength: 36, maxLength: 36, pattern: "^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"}: Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * **type**: 'Microsoft.Graph/applications' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to an application and used as an alternate key. Immutable. -* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. +* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher) (ReadOnly): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. * **web**: [MicrosoftGraphWebApplication](#microsoftgraphwebapplication): Specifies settings for a web application. * **windows**: [MicrosoftGraphWindowsApplication](#microsoftgraphwindowsapplication): Specifies settings for apps running Microsoft Windows and published in the Microsoft Store or Xbox games store. @@ -90,7 +90,7 @@ * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. * **infoCatalogs**: string[]: Identifies the info segments assigned to the group. * **isAssignableToRole**: bool: Indicates whether this group can be assigned to a Microsoft Entra role. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group cannot be a dynamic group (that is, groupTypes can't contain DynamicMembership). Only callers with at least the Privileged Role Administrator role can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Microsoft Entra role assignmentsUsing this feature requires a Microsoft Entra ID P1 license. -* **isManagementRestricted**: bool (ReadOnly): Indicates whether the group is a member of a restricted management administrative unit. The default value is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. +* **isManagementRestricted**: bool (ReadOnly): Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). * **mail**: string (ReadOnly): The SMTP address for the group, for example, 'serviceadmins@contoso.com'. Read-only. * **mailEnabled**: bool (Required): Specifies whether the group is mail-enabled. Required. * **mailNickname**: string (Required): The mail alias for the group, unique for Microsoft 365 groups in the organization. Maximum length is 64 characters. This property can contain only characters in the ASCII character set 0 - 127 except the following: @ () / [] ' ; : <> , SPACE. @@ -114,7 +114,7 @@ * **resourceProvisioningOptions**: string[]: Specifies the group resources that are associated with the Microsoft 365 group. The possible value is Team. For more information, see Microsoft 365 group behaviors and provisioning options. * **securityEnabled**: bool (Required): Specifies whether the group is a security group. * **securityIdentifier**: string (ReadOnly): Security identifier of the group, used in Windows scenarios. Read-only. -* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[]: Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object. +* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[] (ReadOnly): Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object. * **theme**: string: Specifies a Microsoft 365 group's color theme. Possible values are Teal, Purple, Green, Blue, Pink, Orange or Red. * **type**: 'Microsoft.Graph/groups' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to a group and used as an alternate key. Immutable. @@ -149,7 +149,7 @@ * **appRoles**: [MicrosoftGraphAppRole](#microsoftgraphapprole)[]: The roles exposed by the application, which this service principal represents. For more information, see the appRoles property definition on the application entity. Not nullable. * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide an internal end-user facing description of the service principal. End-user portals such MyApps displays the application description in this field. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string: The display name for the service principal. * **homepage**: string: Home page or landing page of the application. * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. diff --git a/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.json b/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.json index 84227bf..1377261 100644 --- a/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.json +++ b/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.json @@ -81,8 +81,8 @@ "type": { "$ref": "#/5" }, - "flags": 0, - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit." + "flags": 2, + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management)." }, "mail": { "type": { @@ -214,7 +214,7 @@ "type": { "$ref": "#/10" }, - "flags": 0, + "flags": 2, "description": "Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object." }, "theme": { @@ -511,7 +511,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { @@ -686,7 +686,7 @@ "type": { "$ref": "#/68" }, - "flags": 0, + "flags": 2, "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification." }, "web": { @@ -1095,28 +1095,28 @@ "$ref": "#/0" }, "flags": 0, - "description": "Link to the application's marketing page. For example, https:/www.contoso.com/app/marketing." + "description": "Link to the application's marketing page. For example, https://www.contoso.com/app/marketing." }, "privacyStatementUrl": { "type": { "$ref": "#/0" }, "flags": 0, - "description": "Link to the application's privacy statement. For example, https:/www.contoso.com/app/privacy." + "description": "Link to the application's privacy statement. For example, https://www.contoso.com/app/privacy." }, "supportUrl": { "type": { "$ref": "#/0" }, "flags": 0, - "description": "Link to the application's support page. For example, https:/www.contoso.com/app/support." + "description": "Link to the application's support page. For example, https://www.contoso.com/app/support." }, "termsOfServiceUrl": { "type": { "$ref": "#/0" }, "flags": 0, - "description": "Link to the application's terms of service statement. For example, https:/www.contoso.com/app/termsofservice." + "description": "Link to the application's terms of service statement. For example, https://www.contoso.com/app/termsofservice." } } }, @@ -1384,7 +1384,7 @@ "$ref": "#/56" }, "flags": 0, - "description": "Specifies the URLs where user tokens are sent for sign-in, or the redirect URIs where OAuth 2.0 authorization codes and access tokens are sent. For iOS and macOS apps, specify the value following the syntax msauth.{BUNDLEID}:/auth, replacing '{BUNDLEID}'. For example, if the bundle ID is com.microsoft.identitysample.MSALiOS, the URI is msauth.com.microsoft.identitysample.MSALiOS:/auth." + "description": "Specifies the URLs where user tokens are sent for sign-in, or the redirect URIs where OAuth 2.0 authorization codes and access tokens are sent. For iOS and macOS apps, specify the value following the syntax msauth.{BUNDLEID}://auth, replacing '{BUNDLEID}'. For example, if the bundle ID is com.microsoft.identitysample.MSALiOS, the URI is msauth.com.microsoft.identitysample.MSALiOS://auth." } } }, @@ -1787,7 +1787,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { @@ -2123,7 +2123,7 @@ "$ref": "#/96" }, "flags": 1, - "description": "The audience that can appear in the external token. This field is mandatory and should be set to api:/AzureADTokenExchange for Microsoft Entra ID. It says what Microsoft identity platform should accept in the aud claim in the incoming token. This value represents Microsoft Entra ID in your external identity provider and has no fixed value across identity providers - you might need to create a new application registration in your identity provider to serve as the audience of this token. This field can only accept a single value and has a limit of 600 characters. Required." + "description": "The audience that can appear in the external token. This field is mandatory and should be set to api://AzureADTokenExchange for Microsoft Entra ID. It says what Microsoft identity platform should accept in the aud claim in the incoming token. This value represents Microsoft Entra ID in your external identity provider and has no fixed value across identity providers - you might need to create a new application registration in your identity provider to serve as the audience of this token. This field can only accept a single value and has a limit of 600 characters. Required." }, "description": { "type": { diff --git a/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.md b/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.md index b5dd150..76d5c89 100644 --- a/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.md +++ b/generated/microsoftgraph/microsoft.graph/v1.0/1.0.0/types.md @@ -15,7 +15,7 @@ * **defaultRedirectUri**: string * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide a description of the application object to end users. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string (Required): The display name for the application. Maximum length is 256 characters. * **groupMembershipClaims**: string: Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following valid string values: None, SecurityGroup (for security groups and Microsoft Entra roles), All (this gets all of the security groups, distribution groups, and Microsoft Entra directory roles that the signed-in user is a member of). * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. @@ -44,7 +44,7 @@ * **tokenEncryptionKeyId**: string {minLength: 36, maxLength: 36, pattern: "^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"}: Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * **type**: 'Microsoft.Graph/applications' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to an application and used as an alternate key. Immutable. -* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. +* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher) (ReadOnly): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. * **web**: [MicrosoftGraphWebApplication](#microsoftgraphwebapplication): Specifies settings for a web application. ## Resource Microsoft.Graph/applications/federatedIdentityCredentials@v1.0 @@ -87,7 +87,7 @@ * **groupTypes**: string[]: Specifies the group type and its membership. If the collection contains Unified, the group is a Microsoft 365 group; otherwise, it's either a security group or a distribution group. For details, see groups overview.If the collection includes DynamicMembership, the group has dynamic membership; otherwise, membership is static. * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. * **isAssignableToRole**: bool: Indicates whether this group can be assigned to a Microsoft Entra role. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group can't be a dynamic group (that is, groupTypes can't contain DynamicMembership). Only callers with at least the Privileged Role Administrator role can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Microsoft Entra role assignmentsUsing this feature requires a Microsoft Entra ID P1 license. -* **isManagementRestricted**: bool: Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. +* **isManagementRestricted**: bool (ReadOnly): Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). * **mail**: string (ReadOnly): The SMTP address for the group, for example, 'serviceadmins@contoso.com'. Read-only. * **mailEnabled**: bool (Required): Specifies whether the group is mail-enabled. Required. * **mailNickname**: string (Required): The mail alias for the group, unique for Microsoft 365 groups in the organization. Maximum length is 64 characters. This property can contain only characters in the ASCII character set 0 - 127 except the following characters: @ () / [] ' ; : <> , SPACE. Required. @@ -108,7 +108,7 @@ * **renewedDateTime**: string (ReadOnly): Timestamp of when the group was last renewed. This value can't be modified directly and is only updated via the renew service action. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on January 1, 2014 is 2014-01-01T00:00:00Z. Read-only. * **securityEnabled**: bool (Required): Specifies whether the group is a security group. Required. * **securityIdentifier**: string (ReadOnly): Security identifier of the group, used in Windows scenarios. Read-only. -* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[]: Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object. +* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[] (ReadOnly): Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object. * **theme**: string: Specifies a Microsoft 365 group's color theme. Possible values are Teal, Purple, Green, Blue, Pink, Orange, or Red. * **type**: 'Microsoft.Graph/groups' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to a group and used as an alternate key. Immutable. @@ -143,7 +143,7 @@ * **customSecurityAttributes**: any: An open complex type that holds the value of a custom security attribute that is assigned to a directory object. Nullable. Filter value is case sensitive. To read this property, the calling app must be assigned the CustomSecAttributeAssignment.Read.All permission. To write this property, the calling app must be assigned the CustomSecAttributeAssignment.ReadWrite.All permissions. To read or write this property in delegated scenarios, the admin must be assigned the Attribute Assignment Administrator role. * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide an internal end-user facing description of the service principal. End-user portals such MyApps displays the application description in this field. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string: The display name for the service principal. * **homepage**: string: Home page or landing page of the application. * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. diff --git a/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.json b/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.json index 8b4d73f..aa7d10c 100644 --- a/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.json +++ b/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.json @@ -81,8 +81,8 @@ "type": { "$ref": "#/5" }, - "flags": 0, - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit." + "flags": 2, + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management)." }, "mail": { "type": { @@ -214,7 +214,7 @@ "type": { "$ref": "#/10" }, - "flags": 0, + "flags": 2, "description": "Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object." }, "theme": { @@ -559,7 +559,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { @@ -734,7 +734,7 @@ "type": { "$ref": "#/69" }, - "flags": 0, + "flags": 2, "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification." }, "web": { @@ -1835,7 +1835,7 @@ "type": { "$ref": "#/0" }, - "flags": 0, + "flags": 2, "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement)." }, "displayName": { diff --git a/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.md b/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.md index 1949c72..81e1b75 100644 --- a/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.md +++ b/generated/microsoftgraph/microsoft.graph/v1.0/1.1.0-preview/types.md @@ -15,7 +15,7 @@ * **defaultRedirectUri**: string * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide a description of the application object to end users. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string (Required): The display name for the application. Maximum length is 256 characters. * **groupMembershipClaims**: string: Configures the groups claim issued in a user or OAuth 2.0 access token that the application expects. To set this attribute, use one of the following valid string values: None, SecurityGroup (for security groups and Microsoft Entra roles), All (this gets all of the security groups, distribution groups, and Microsoft Entra directory roles that the signed-in user is a member of). * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. @@ -44,7 +44,7 @@ * **tokenEncryptionKeyId**: string {minLength: 36, maxLength: 36, pattern: "^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$"}: Specifies the keyId of a public key from the keyCredentials collection. When configured, Microsoft Entra ID encrypts all the tokens it emits by using the key this property points to. The application code that receives the encrypted token must use the matching private key to decrypt the token before it can be used for the signed-in user. * **type**: 'Microsoft.Graph/applications' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to an application and used as an alternate key. Immutable. -* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. +* **verifiedPublisher**: [MicrosoftGraphVerifiedPublisher](#microsoftgraphverifiedpublisher) (ReadOnly): Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification. * **web**: [MicrosoftGraphWebApplication](#microsoftgraphwebapplication): Specifies settings for a web application. ## Resource Microsoft.Graph/applications/federatedIdentityCredentials@v1.0 @@ -87,7 +87,7 @@ * **groupTypes**: string[]: Specifies the group type and its membership. If the collection contains Unified, the group is a Microsoft 365 group; otherwise, it's either a security group or a distribution group. For details, see groups overview.If the collection includes DynamicMembership, the group has dynamic membership; otherwise, membership is static. * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. * **isAssignableToRole**: bool: Indicates whether this group can be assigned to a Microsoft Entra role. Optional. This property can only be set while creating the group and is immutable. If set to true, the securityEnabled property must also be set to true, visibility must be Hidden, and the group can't be a dynamic group (that is, groupTypes can't contain DynamicMembership). Only callers with at least the Privileged Role Administrator role can set this property. The caller must also be assigned the RoleManagement.ReadWrite.Directory permission to set this property or update the membership of such groups. For more, see Using a group to manage Microsoft Entra role assignmentsUsing this feature requires a Microsoft Entra ID P1 license. -* **isManagementRestricted**: bool: Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. +* **isManagementRestricted**: bool (ReadOnly): Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). * **mail**: string (ReadOnly): The SMTP address for the group, for example, 'serviceadmins@contoso.com'. Read-only. * **mailEnabled**: bool (Required): Specifies whether the group is mail-enabled. Required. * **mailNickname**: string (Required): The mail alias for the group, unique for Microsoft 365 groups in the organization. Maximum length is 64 characters. This property can contain only characters in the ASCII character set 0 - 127 except the following characters: @ () / [] ' ; : <> , SPACE. Required. @@ -108,7 +108,7 @@ * **renewedDateTime**: string (ReadOnly): Timestamp of when the group was last renewed. This value can't be modified directly and is only updated via the renew service action. The Timestamp type represents date and time information using ISO 8601 format and is always in UTC. For example, midnight UTC on January 1, 2014 is 2014-01-01T00:00:00Z. Read-only. * **securityEnabled**: bool (Required): Specifies whether the group is a security group. Required. * **securityIdentifier**: string (ReadOnly): Security identifier of the group, used in Windows scenarios. Read-only. -* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[]: Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object. +* **serviceProvisioningErrors**: [MicrosoftGraphServiceProvisioningError](#microsoftgraphserviceprovisioningerror)[] (ReadOnly): Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object. * **theme**: string: Specifies a Microsoft 365 group's color theme. Possible values are Teal, Purple, Green, Blue, Pink, Orange, or Red. * **type**: 'Microsoft.Graph/groups' (ReadOnly, DeployTimeConstant): The resource type * **uniqueName**: string (Required, DeployTimeConstant, Identifier): The unique identifier that can be assigned to a group and used as an alternate key. Immutable. @@ -143,7 +143,7 @@ * **customSecurityAttributes**: any: An open complex type that holds the value of a custom security attribute that is assigned to a directory object. Nullable. Filter value is case sensitive. To read this property, the calling app must be assigned the CustomSecAttributeAssignment.Read.All permission. To write this property, the calling app must be assigned the CustomSecAttributeAssignment.ReadWrite.All permissions. To read or write this property in delegated scenarios, the admin must be assigned the Attribute Assignment Administrator role. * **deletedDateTime**: string (ReadOnly): Date and time when this object was deleted. Always null when the object hasn't been deleted. * **description**: string: Free text field to provide an internal end-user facing description of the service principal. End-user portals such MyApps displays the application description in this field. The maximum allowed size is 1,024 characters. -* **disabledByMicrosoftStatus**: string: Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). +* **disabledByMicrosoftStatus**: string (ReadOnly): Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement). * **displayName**: string: The display name for the service principal. * **homepage**: string: Home page or landing page of the application. * **id**: string (ReadOnly): The unique identifier for an entity. Read-only. diff --git a/src/Microsoft.Graph.Bicep.Types.UnitTests/MicrosoftGraphTypeLoaderTests.cs b/src/Microsoft.Graph.Bicep.Types.UnitTests/MicrosoftGraphTypeLoaderTests.cs index 4f7aa08..7e8c559 100644 --- a/src/Microsoft.Graph.Bicep.Types.UnitTests/MicrosoftGraphTypeLoaderTests.cs +++ b/src/Microsoft.Graph.Bicep.Types.UnitTests/MicrosoftGraphTypeLoaderTests.cs @@ -4,6 +4,7 @@ using FluentAssertions; using System.Linq; using System.Collections.Generic; +using System.IO; using Azure.Bicep.Types.Concrete; namespace Microsoft.Graph.Bicep.Types.UnitTests @@ -11,6 +12,21 @@ namespace Microsoft.Graph.Bicep.Types.UnitTests [TestClass] public class MicrosoftGraphTypeLoaderTests { + private class VersionedTypeLoader : MicrosoftGraphTypeLoader + { + private readonly string apiVersion; + private readonly string extensionVersion; + + public VersionedTypeLoader(string apiVersion, string extensionVersion) + { + this.apiVersion = apiVersion; + this.extensionVersion = extensionVersion; + } + + protected override Stream GetContentStreamAtPath(string path) + => base.GetContentStreamAtPath($"microsoftgraph/microsoft.graph/{apiVersion}/{extensionVersion}/{path}"); + } + private IEnumerable minTypes = new List { "Microsoft.Graph/applications@beta", @@ -137,6 +153,49 @@ public void MSGraphTypeLoader_type_keys_are_insensitively_unique() { functionsByApiVersion.Keys.Select(x => x.ToLowerInvariant()).Should().OnlyHaveUniqueItems(); } + + } + + [DataTestMethod] + [DataRow("beta", "1.0.0")] + [DataRow("v1.0", "1.0.0")] + [DataRow("beta", "1.1.0-preview")] + [DataRow("v1.0", "1.1.0-preview")] + public void MSGraphTypeLoader_corrections_preserve_reads_and_conditional_writes(string apiVersion, string extensionVersion) + { + var loader = new VersionedTypeLoader(apiVersion, extensionVersion); + var index = loader.LoadTypeIndex(); + var readOnlyProperties = new Dictionary + { + ["groups"] = new[] { "isManagementRestricted", "serviceProvisioningErrors" }, + ["applications"] = new[] { "disabledByMicrosoftStatus", "verifiedPublisher" }, + ["servicePrincipals"] = new[] { "disabledByMicrosoftStatus" }, + }; + + foreach (var (resourceName, propertyNames) in readOnlyProperties) + { + var resource = loader.LoadResourceType(index.Resources[$"Microsoft.Graph/{resourceName}@{apiVersion}"]); + var body = resource.Body.Type.Should().BeOfType().Subject; + foreach (var propertyName in propertyNames) + { + var property = body.Properties[propertyName]; + property.Flags.Should().HaveFlag(ObjectTypePropertyFlags.ReadOnly); + property.Flags.Should().NotHaveFlag(ObjectTypePropertyFlags.WriteOnly); + property.Type.Type.Should().NotBeNull(); + } + } + + var servicePrincipal = loader.LoadResourceType(index.Resources[$"Microsoft.Graph/servicePrincipals@{apiVersion}"]); + var servicePrincipalBody = servicePrincipal.Body.Type.Should().BeOfType().Subject; + foreach (var propertyName in new[] { "addIns", "appRoles", "homepage", "logoutUrl", "replyUrls", "servicePrincipalNames" }) + { + servicePrincipalBody.Properties[propertyName].Flags.Should().NotHaveFlag(ObjectTypePropertyFlags.ReadOnly); + } + + var group = loader.LoadResourceType(index.Resources[$"Microsoft.Graph/groups@{apiVersion}"]); + var groupBody = group.Body.Type.Should().BeOfType().Subject; + groupBody.Properties["isManagementRestricted"].Description.Should().Contain( + "[restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management)"); } } } diff --git a/src/generator/src/cmd/generate.ts b/src/generator/src/cmd/generate.ts index 387c424..5cd1793 100644 --- a/src/generator/src/cmd/generate.ts +++ b/src/generator/src/cmd/generate.ts @@ -24,6 +24,7 @@ const argsConfig = yargs .option('specs-dir', { type: 'string', demandOption: true, desc: 'Path to the specs dir' }) .option('out-dir', { type: 'string', default: defaultOutDir, desc: 'Output path for generated files' }) .option('single-path', { type: 'string', default: undefined, desc: 'Only regenerate under a specific file path - e.g. "compute"' }) + .option('extension-version', { type: 'string', choices: ['1.0.0', '1.1.0-preview'], desc: 'Regenerate the stable or preview extension version instead of the latest version' }) .option('logging-level', { type: 'string', default: 'warning', choices: ['debug', 'verbose', 'information', 'warning', 'error', 'fatal'] }) .option('wait-for-debugger', { type: 'boolean', default: false, desc: 'Wait for a C# debugger to be attached before running the Autorest extension' }); @@ -45,9 +46,21 @@ executeSynchronous(async () => { const logLevel = args['logging-level']; const waitForDebugger = args['wait-for-debugger']; const singlePath = args['single-path']; + const requestedVersion = args['extension-version']; + if (requestedVersion) { + for (const apiVersion of [ApiVersion.Beta, ApiVersion.V1_0]) { + if (!existsSync(path.join(rootDir, 'src', 'swagger-generation', 'configs', apiVersion, `${requestedVersion}.yml`))) { + throw new Error(`Unknown extension version ${requestedVersion} for ${apiVersion}`); + } + extensionConfigForGeneration[apiVersion].version = requestedVersion; + } + } // Detect internal generation by checking if output directory contains 'internal' const isInternalGeneration = outputBaseDir.includes('internal'); + if (isInternalGeneration && requestedVersion && requestedVersion !== '1.0.0') { + throw new Error('Internal generation only supports extension version 1.0.0'); + } // For internal generation, use 1.1.0-preview-internal version consistently const effectiveExtensionConfig = isInternalGeneration ? { diff --git a/src/swagger-generation/README.md b/src/swagger-generation/README.md index 5fa7c2d..8c3875c 100644 --- a/src/swagger-generation/README.md +++ b/src/swagger-generation/README.md @@ -36,6 +36,7 @@ The configuration file is `config-.yml`. The following settings are a - `NavigationProperties` (optional): A list of navigation properties which will follow the behavior specified above. All values must be valid navigation properties of the entity type. - `RequiredOnWrite` (optional): A list of properties that are required when writing the entity type. All values must be valid properties of the entity type. - `ReadOnly` (optional): A list of properties that are read-only. All values must be valid properties of the entity type. + - `PropertyDescriptions` (optional): A map from structural property names to replacement descriptions. Use versioned, evidence-backed overrides when metadata is missing or incorrect. Markdown links and formatting are preserved verbatim. Unknown or excluded property names fail validation. This changes documentation, not mutability or allowed values. ### Output diff --git a/src/swagger-generation/configs/beta/1.0.0.yml b/src/swagger-generation/configs/beta/1.0.0.yml index 83716ab..d3b9ab4 100644 --- a/src/swagger-generation/configs/beta/1.0.0.yml +++ b/src/swagger-generation/configs/beta/1.0.0.yml @@ -132,6 +132,14 @@ EntityTypes: - proxyAddresses - renewedDateTime - securityIdentifier + - serviceProvisioningErrors + PropertyDescriptions: + isManagementRestricted: >- + Indicates whether the group is a member of a restricted management administrative unit. + Read-only. To manage a group member of a restricted management administrative unit, + the administrator or calling app must be assigned a Microsoft Entra role at the scope + of the restricted management administrative unit. + See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). - Name: microsoft.graph.application RootUri: /applications Upsertable: true @@ -145,7 +153,9 @@ EntityTypes: - appId - certification - createdDateTime + - disabledByMicrosoftStatus - publisherDomain + - verifiedPublisher Relationships: NeedsBatch: true BulkLimit: 20 @@ -163,6 +173,7 @@ EntityTypes: ReadOnly: - applicationTemplateId - appOwnerOrganizationId + - disabledByMicrosoftStatus - signInAudience Relationships: NeedsBatch: true diff --git a/src/swagger-generation/configs/beta/1.1.0-preview.yml b/src/swagger-generation/configs/beta/1.1.0-preview.yml index cee3de2..7f97cbb 100644 --- a/src/swagger-generation/configs/beta/1.1.0-preview.yml +++ b/src/swagger-generation/configs/beta/1.1.0-preview.yml @@ -132,6 +132,14 @@ EntityTypes: - proxyAddresses - renewedDateTime - securityIdentifier + - serviceProvisioningErrors + PropertyDescriptions: + isManagementRestricted: >- + Indicates whether the group is a member of a restricted management administrative unit. + Read-only. To manage a group member of a restricted management administrative unit, + the administrator or calling app must be assigned a Microsoft Entra role at the scope + of the restricted management administrative unit. + See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). - Name: microsoft.graph.application RootUri: /applications Upsertable: true @@ -145,7 +153,9 @@ EntityTypes: - appId - certification - createdDateTime + - disabledByMicrosoftStatus - publisherDomain + - verifiedPublisher Relationships: NeedsBatch: true BulkLimit: 20 @@ -163,6 +173,7 @@ EntityTypes: ReadOnly: - applicationTemplateId - appOwnerOrganizationId + - disabledByMicrosoftStatus - signInAudience Relationships: NeedsBatch: true diff --git a/src/swagger-generation/configs/v1.0/1.0.0.yml b/src/swagger-generation/configs/v1.0/1.0.0.yml index 91f2dfd..d4e8d30 100644 --- a/src/swagger-generation/configs/v1.0/1.0.0.yml +++ b/src/swagger-generation/configs/v1.0/1.0.0.yml @@ -109,6 +109,7 @@ EntityTypes: ReadOnly: - createdDateTime - expirationDateTime + - isManagementRestricted - mail - onPremisesDomainName - onPremisesLastSyncDateTime @@ -120,6 +121,14 @@ EntityTypes: - proxyAddresses - renewedDateTime - securityIdentifier + - serviceProvisioningErrors + PropertyDescriptions: + isManagementRestricted: >- + Indicates whether the group is a member of a restricted management administrative unit. + Read-only. To manage a group member of a restricted management administrative unit, + the administrator or calling app must be assigned a Microsoft Entra role at the scope + of the restricted management administrative unit. + See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). - Name: microsoft.graph.application RootUri: /applications Upsertable: true @@ -133,7 +142,9 @@ EntityTypes: - applicationTemplateId - certification - createdDateTime + - disabledByMicrosoftStatus - publisherDomain + - verifiedPublisher Relationships: NeedsBatch: true BulkLimit: 20 @@ -147,6 +158,7 @@ EntityTypes: ReadOnly: - applicationTemplateId - appOwnerOrganizationId + - disabledByMicrosoftStatus - resourceSpecificApplicationPermissions - signInAudience Relationships: diff --git a/src/swagger-generation/configs/v1.0/1.1.0-preview.yml b/src/swagger-generation/configs/v1.0/1.1.0-preview.yml index 89edcce..99a8e5e 100644 --- a/src/swagger-generation/configs/v1.0/1.1.0-preview.yml +++ b/src/swagger-generation/configs/v1.0/1.1.0-preview.yml @@ -109,6 +109,7 @@ EntityTypes: ReadOnly: - createdDateTime - expirationDateTime + - isManagementRestricted - mail - onPremisesDomainName - onPremisesLastSyncDateTime @@ -120,6 +121,14 @@ EntityTypes: - proxyAddresses - renewedDateTime - securityIdentifier + - serviceProvisioningErrors + PropertyDescriptions: + isManagementRestricted: >- + Indicates whether the group is a member of a restricted management administrative unit. + Read-only. To manage a group member of a restricted management administrative unit, + the administrator or calling app must be assigned a Microsoft Entra role at the scope + of the restricted management administrative unit. + See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management). - Name: microsoft.graph.application RootUri: /applications Upsertable: true @@ -133,7 +142,9 @@ EntityTypes: - applicationTemplateId - certification - createdDateTime + - disabledByMicrosoftStatus - publisherDomain + - verifiedPublisher Relationships: NeedsBatch: true BulkLimit: 20 @@ -147,6 +158,7 @@ EntityTypes: ReadOnly: - applicationTemplateId - appOwnerOrganizationId + - disabledByMicrosoftStatus - resourceSpecificApplicationPermissions - signInAudience Relationships: diff --git a/src/swagger-generation/output/microsoftgraph-beta-1.0.0.json b/src/swagger-generation/output/microsoftgraph-beta-1.0.0.json index 7e1de74..cb83c0d 100644 --- a/src/swagger-generation/output/microsoftgraph-beta-1.0.0.json +++ b/src/swagger-generation/output/microsoftgraph-beta-1.0.0.json @@ -176,7 +176,7 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", "readOnly": true }, "mail": { @@ -304,7 +304,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -403,7 +403,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -552,7 +552,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -654,7 +654,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", diff --git a/src/swagger-generation/output/microsoftgraph-beta-1.1.0-preview.json b/src/swagger-generation/output/microsoftgraph-beta-1.1.0-preview.json index 966237d..49b4585 100644 --- a/src/swagger-generation/output/microsoftgraph-beta-1.1.0-preview.json +++ b/src/swagger-generation/output/microsoftgraph-beta-1.1.0-preview.json @@ -218,7 +218,7 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", "readOnly": true }, "mail": { @@ -346,7 +346,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -455,7 +455,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -614,7 +614,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -721,7 +721,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", diff --git a/src/swagger-generation/output/microsoftgraph-v1.0-1.0.0.json b/src/swagger-generation/output/microsoftgraph-v1.0-1.0.0.json index b7bd895..531e740 100644 --- a/src/swagger-generation/output/microsoftgraph-v1.0-1.0.0.json +++ b/src/swagger-generation/output/microsoftgraph-v1.0-1.0.0.json @@ -158,8 +158,8 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", - "readOnly": false + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", + "readOnly": true }, "mail": { "type": "string", @@ -265,7 +265,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -372,7 +372,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -521,7 +521,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -623,7 +623,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", diff --git a/src/swagger-generation/output/microsoftgraph-v1.0-1.1.0-preview.json b/src/swagger-generation/output/microsoftgraph-v1.0-1.1.0-preview.json index ec58b8a..0db38ab 100644 --- a/src/swagger-generation/output/microsoftgraph-v1.0-1.1.0-preview.json +++ b/src/swagger-generation/output/microsoftgraph-v1.0-1.1.0-preview.json @@ -195,8 +195,8 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", - "readOnly": false + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", + "readOnly": true }, "mail": { "type": "string", @@ -318,7 +318,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -425,7 +425,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -574,7 +574,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -676,7 +676,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", diff --git a/src/swagger-generation/src/config.ts b/src/swagger-generation/src/config.ts index 59d2f66..8fb66e5 100644 --- a/src/swagger-generation/src/config.ts +++ b/src/swagger-generation/src/config.ts @@ -55,6 +55,7 @@ export interface EntityTypeConfig { Relationships?: RelationshipConfig, RequiredOnWrite?: string[] ReadOnly?: string[] + PropertyDescriptions?: Record FilterProperty?: string[] CompositeKey?: string[] EntitySetPath?: string diff --git a/src/swagger-generation/src/deserializer.ts b/src/swagger-generation/src/deserializer.ts index f742241..6fb67ea 100644 --- a/src/swagger-generation/src/deserializer.ts +++ b/src/swagger-generation/src/deserializer.ts @@ -49,7 +49,8 @@ const propertyHandler = (entityConfig: EntityTypeConfig | undefined, rawProperty const propertyAttributes: RawPropertyAttributes = rawProperty.$ const propertyName: string = propertyAttributes.Name const isAlternateKey: boolean = propertyName === alternateKey; - const propertyDescription: string = getPropertyDescription(rawProperty.Annotation, isAlternateKey); + const propertyDescription: string = entityConfig?.PropertyDescriptions?.[propertyName] + ?? getPropertyDescription(rawProperty.Annotation, isAlternateKey); let propertyType: string = propertyAttributes.Type let typedPropertyType: PrimitiveSwaggerTypeStruct | CollectionProperty | string const collectionRegex: RegExp = /Collection\((.+)\)/ diff --git a/src/swagger-generation/src/validator.ts b/src/swagger-generation/src/validator.ts index 7ba496a..4ff81a6 100644 --- a/src/swagger-generation/src/validator.ts +++ b/src/swagger-generation/src/validator.ts @@ -43,6 +43,11 @@ export const validateReferences = (definitionMap: DefinitionMap, config: Config) }); } + for (const propertyName of Object.keys(entityType.PropertyDescriptions ?? {})) { + if (!entity.Property.some(property => property.Name === propertyName)) { + throw new Error(`Property description ${propertyName} from config.yml is not present in ${entityType.Name}`); + } + } }); diff --git a/src/swagger-generation/tests/versionedContracts.test.ts b/src/swagger-generation/tests/versionedContracts.test.ts new file mode 100644 index 0000000..0fab048 --- /dev/null +++ b/src/swagger-generation/tests/versionedContracts.test.ts @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. +// Licensed under the MIT License. + +import { readFileSync } from 'fs'; +import { Config } from '../src/config'; +import { constructDataStructure } from '../src/deserializer'; +import { DefinitionMap } from '../src/definitions/DefinitionMap'; +import { CSDL } from '../src/definitions/RawTypes'; +import { Definition, Swagger } from '../src/definitions/Swagger'; +import { parseXML } from '../src/parser'; +import { writeSwagger } from '../src/swaggerWriter'; +import { validateReferences } from '../src/validator'; + +const readOnlyProperties: Record = { + 'microsoft.graph.group': ['isManagementRestricted', 'serviceProvisioningErrors'], + 'microsoft.graph.application': ['disabledByMicrosoftStatus', 'verifiedPublisher'], + 'microsoft.graph.servicePrincipal': ['disabledByMicrosoftStatus'], +}; + +interface SerializedType { + $type: string; + name?: string; + properties?: Record; +} + +function getDefinition(swagger: Swagger, name: string): Definition { + const definition = swagger.definitions[name]; + if ('allOf' in definition) { + const body = definition.allOf.find((item): item is Definition => 'properties' in item); + if (body) { + return body; + } + } else if ('properties' in definition) { + return definition; + } + throw new Error(`Missing object definition ${name}`); +} + +function generateSwagger(csdl: CSDL, config: Config): Swagger { + const definitions = constructDataStructure(csdl, new DefinitionMap(), config); + return writeSwagger(validateReferences(definitions, config), config); +} + +describe.each([ + ['beta', '1.0.0'], ['v1.0', '1.0.0'], + ['beta', '1.1.0-preview'], ['v1.0', '1.1.0-preview'], +])('%s/%s corrected contracts', (apiVersion, extensionVersion) => { + let csdl: CSDL; + let config: Config; + let swagger: Swagger; + + beforeAll(async () => { + config = new Config(apiVersion, extensionVersion); + csdl = await parseXML(config.MetadataFilePath); + swagger = generateSwagger(csdl, config); + }); + + it('carries the real CSDL producer guards through both Swagger snapshots and serialized types', () => { + const output: Swagger = JSON.parse(readFileSync(`output/microsoftgraph-${apiVersion}-${extensionVersion}.json`, 'utf8')); + const releaseType = extensionVersion.endsWith('preview') ? 'preview' : 'official'; + const specification: Swagger = JSON.parse(readFileSync( + `../../swagger/specification/microsoftgraph/resource-manager/microsoftgraph/${releaseType}/${apiVersion}/${extensionVersion}.json`, 'utf8', + )); + const types: SerializedType[] = JSON.parse(readFileSync( + `../../generated/microsoftgraph/microsoft.graph/${apiVersion}/${extensionVersion}/types.json`, 'utf8', + )); + const objectNames: Record = { + 'microsoft.graph.group': 'Microsoft.Graph/groups', + 'microsoft.graph.application': 'Microsoft.Graph/applications', + 'microsoft.graph.servicePrincipal': 'Microsoft.Graph/servicePrincipals', + }; + for (const [entityName, properties] of Object.entries(readOnlyProperties)) { + for (const propertyName of properties) { + const produced = getDefinition(swagger, entityName).properties[propertyName]; + expect(produced.readOnly).toBe(true); + expect(getDefinition(output, entityName).properties[propertyName].readOnly).toBe(produced.readOnly); + expect(getDefinition(specification, entityName).properties[propertyName].readOnly).toBe(produced.readOnly); + const property = types.find(type => type.name === objectNames[entityName])!.properties![propertyName]; + expect(property.flags & 2).toBe(2); + expect(property.flags & 4).toBe(0); + } + } + for (const [entityName, entityConfig] of config.EntityTypes) { + for (const [propertyName, description] of Object.entries(entityConfig.PropertyDescriptions ?? {})) { + expect(getDefinition(swagger, entityName).properties[propertyName].description).toBe(description); + expect(getDefinition(output, entityName).properties[propertyName].description).toBe(description); + expect(getDefinition(specification, entityName).properties[propertyName].description).toBe(description); + expect(types.find(type => type.name === objectNames[entityName])!.properties![propertyName].description) + .toBe(description); + } + } + }); + + it('retains the version-specific relationship representation', () => { + const types: SerializedType[] = JSON.parse(readFileSync( + `../../generated/microsoftgraph/microsoft.graph/${apiVersion}/${extensionVersion}/types.json`, 'utf8', + )); + const member = types.find(type => type.name === 'MicrosoftGraphRelationshipMember'); + if (extensionVersion === '1.1.0-preview') { + expect(Object.keys(member!.properties!)).toEqual([ + 'id', 'type', 'displayName', 'userPrincipalName', 'appId', 'uniqueName', + ]); + } else { + expect(member).toBeUndefined(); + } + }); + + it('preserves readable values and writable or conditionally writable service-principal inputs', () => { + for (const [entityName, properties] of Object.entries(readOnlyProperties)) { + for (const propertyName of properties) { + expect(getDefinition(swagger, entityName).properties[propertyName].readOnly).toBe(true); + } + } + const servicePrincipal = getDefinition(swagger, 'microsoft.graph.servicePrincipal'); + for (const propertyName of [ + 'addIns', 'appRoles', 'homepage', 'logoutUrl', 'replyUrls', 'servicePrincipalNames', + 'appDescription', 'appDisplayName', 'servicePrincipalType', 'info', 'loginUrl', 'verifiedPublisher', + ]) { + expect(servicePrincipal.properties[propertyName].readOnly).toBe(false); + } + expect(getDefinition(swagger, 'microsoft.graph.appRole').properties.origin.readOnly).toBe(true); + expect(getDefinition(swagger, 'microsoft.graph.application').properties.info.readOnly).toBe(false); + }); + + it('preserves the versioned guidance through metadata deserialization and Swagger serialization', () => { + const property = getDefinition(swagger, 'microsoft.graph.group').properties.isManagementRestricted; + expect(property.description).toContain('Read-only.'); + expect(property.description).toContain( + '[restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management)', + ); + expect(property.description).not.toContain('default value'); + }); + + it('rejects a misspelled description override instead of silently publishing missing guidance', () => { + const invalidConfig = new Config(apiVersion, extensionVersion); + invalidConfig.EntityTypes.get('microsoft.graph.group')!.PropertyDescriptions = { + isManagementRestrictedd: 'Invalid override', + }; + expect(() => generateSwagger(csdl, invalidConfig)).toThrow( + 'Property description isManagementRestrictedd from config.yml is not present in microsoft.graph.group', + ); + }); +}); diff --git a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/beta/1.0.0.json b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/beta/1.0.0.json index 7e1de74..cb83c0d 100644 --- a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/beta/1.0.0.json +++ b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/beta/1.0.0.json @@ -176,7 +176,7 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", "readOnly": true }, "mail": { @@ -304,7 +304,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -403,7 +403,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -552,7 +552,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -654,7 +654,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", diff --git a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/v1.0/1.0.0.json b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/v1.0/1.0.0.json index b7bd895..531e740 100644 --- a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/v1.0/1.0.0.json +++ b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/official/v1.0/1.0.0.json @@ -158,8 +158,8 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", - "readOnly": false + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", + "readOnly": true }, "mail": { "type": "string", @@ -265,7 +265,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -372,7 +372,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -521,7 +521,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -623,7 +623,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", diff --git a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/beta/1.1.0-preview.json b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/beta/1.1.0-preview.json index 8b9d67e..4a49b0e 100644 --- a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/beta/1.1.0-preview.json +++ b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/beta/1.1.0-preview.json @@ -193,7 +193,7 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. The default value is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", "readOnly": true }, "mail": { @@ -321,7 +321,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a non-transient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -420,7 +420,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -569,7 +569,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -671,7 +671,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. Possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons may include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", diff --git a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/v1.0/1.1.0-preview.json b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/v1.0/1.1.0-preview.json index 1d58f15..90c74af 100644 --- a/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/v1.0/1.1.0-preview.json +++ b/swagger/specification/microsoftgraph/resource-manager/microsoftgraph/preview/v1.0/1.1.0-preview.json @@ -195,8 +195,8 @@ }, "isManagementRestricted": { "type": "boolean", - "description": "Indicates whether the group is a member of a restricted management administrative unit. If not set, the default value is null and the default behavior is false. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit.", - "readOnly": false + "description": "Indicates whether the group is a member of a restricted management administrative unit. Read-only. To manage a group member of a restricted management administrative unit, the administrator or calling app must be assigned a Microsoft Entra role at the scope of the restricted management administrative unit. See [restricted management administrative units](https://learn.microsoft.com/en-us/entra/identity/role-based-access-control/admin-units-restricted-management).", + "readOnly": true }, "mail": { "type": "string", @@ -302,7 +302,7 @@ "$ref": "#/definitions/microsoft.graph.serviceProvisioningError" }, "description": "Errors published by a federated service describing a nontransient, service-specific error regarding the properties or link from a group object.", - "readOnly": false + "readOnly": true }, "theme": { "type": "string", @@ -409,7 +409,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string", @@ -558,7 +558,7 @@ "verifiedPublisher": { "$ref": "#/definitions/microsoft.graph.verifiedPublisher", "description": "Specifies the verified publisher of the application. For more information about how publisher verification helps support application security, trustworthiness, and compliance, see Publisher verification.", - "readOnly": false + "readOnly": true }, "web": { "$ref": "#/definitions/microsoft.graph.webApplication", @@ -660,7 +660,7 @@ "disabledByMicrosoftStatus": { "type": "string", "description": "Specifies whether Microsoft has disabled the registered application. The possible values are: null (default value), NotDisabled, and DisabledDueToViolationOfServicesAgreement (reasons include suspicious, abusive, or malicious activity, or a violation of the Microsoft Services Agreement).", - "readOnly": false + "readOnly": true }, "displayName": { "type": "string",