Microsoft.Graph `GraphServiceClient` initialisation results in No operations defined in spec!
See original GitHub issueDescribe the issue
Initialising Microsoft.Graph GraphServiceClient
anywhere in a function app that uses OpenAPI results in No operations defined in spec!
To Reproduce Steps to reproduce the behavior:
- Create a new Function App v4 .net 6, with an HttpTrigger with OpenAPI extension
- Install Microsoft.Graph v4.21.0 (You may also need Azure.Identity v1.5.0 if you plan to make a working example)
- Start function app
- Notice that the swagger UI and swagger JSON has no operations
Expected behavior Operations should be listed as per normal
Example code:
ClientSecretCredential credential = new ClientSecretCredential(
tenantId,
clientId,
clientSecret,
new TokenCredentialOptions
{
AuthorityHost = AzureAuthorityHosts.AzurePublicCloud
});
string[] scopes = new[] { "https://graph.microsoft.com/.default" };
graphClient = new GraphServiceClient(credential, scopes);
commenting out the final line solves the issue. It seems that somehow GraphServiceClient’s constructor disturbs something on the OpenAPI side.
Environment (please complete the following information, if applicable):
- Version: Microsoft.Azure.WebJobs.Extensions.OpenApi 1.2.0
Additional context I am writing a function app to manage B2C users via the GraphAPI. I’m using OpenAPI to maintain and share the documentation.
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
Swashbuckle.AspNetCore: 'No operations defined in spec! ...
In short: i needed to change my HOST project SDK: from 'Microsoft.NET. ... i did not find explicitly is it should be like...
Read more >Microsoft Graph Known Issues
This error is due to intermittent license check failures, which we are working to fix. As a temporary workaround, add the Directory.
Read more >Swagger docs "No operations defined in spec!" : r/node
Hello all, I have set up a Fastify project and I want to use Swagger to document the endpoints, however, I get the...
Read more >Microsoft Teams – Markus Moeller's SharePoint Blog
The first thing is an EditForm bound to a Class representing the Offer object. All the field controls are then bound to a...
Read more >An introduction to Microsoft Graph for developers
Improve your application's interactions with Microsoft Graph, without adding complexity • Designed to simplify building high- quality, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It was #381 and #387
None of the PR reference this issue. So I can’t really tell what this issue was. But it’s really out of interest now, I’ll dig around the PRs and try and see. Thank you once again for the help.