Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot manage encrypted subscriptions via SDK due to missing interfaces. #2237

Closed
jasonjoh opened this issue Nov 28, 2023 · 3 comments · Fixed by #2289
Closed

Cannot manage encrypted subscriptions via SDK due to missing interfaces. #2237

jasonjoh opened this issue Nov 28, 2023 · 3 comments · Fixed by #2289
Assignees
Labels

Comments

@jasonjoh
Copy link
Member

jasonjoh commented Nov 28, 2023

Describe the bug
Attempting to use AddPublicEncryptionCertificate on a Subscription results in an error:

'Subscription' does not contain a definition for 'AddPublicEncryptionCertificate' 
and the best extension method overload 
'IEncryptableSubscriptionExtensions.AddPublicEncryptionCertificate(IEncryptableSubscription, X509Certificate2)' 
requires a receiver of type 'Microsoft.Graph.IEncryptableSubscription'

Attempting to use DecryptAsync method on ChangeNotification.EncryptedContent results in an error:

'ChangeNotificationEncryptedContent' does not contain a definition for 'DecryptAsync' 
and the best extension method overload 'IDecryptableContentExtensions.DecryptAsync<ChatMessage>
(IDecryptableContent, Func<string, string, Task<X509Certificate2>>)' requires a 
receiver of type 'Microsoft.Graph.IDecryptableContent'

Attempting to use AreTokensValid on a ChangeNotificationCollection results in an error:

'ChangeNotificationCollection' does not contain a definition for 'AreTokensValid' and 
no accessible extension method 'AreTokensValid' accepting a first argument of type 
'ChangeNotificationCollection' could be found (are you missing a using directive or 
an assembly reference?)

Expected behavior
These methods should be available. This is a breaking change from v4 SDK.

@baywet
Copy link
Member

baywet commented Nov 29, 2023

@andrueastman if we want to restore that we might want to switch classes generation (at least for models) to be partial. I'm a bit reticent to that approach since it'd only work for dotnet.
The alternatives being:

  • use of reflection (not great)
  • extension methods in the service libraries (only works for dotnet as well)
  • duplicating the code across service libraries (probably the least of all evils)

Thoughts?

@andrueastman
Copy link
Member

@baywet Given that the ChangeNotification models are not generated by Kiota as they are not directly referenced by any endpoint(the openApi metadata would need to reference them using callbacks and then Kiota detects the models in them)

I think the last option would be the best here as the existing webhook models already use that approach.

@andrueastman andrueastman self-assigned this Dec 14, 2023
@baywet
Copy link
Member

baywet commented Dec 14, 2023

ah I missed that aspect, so they are effectively defined in core I guess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants