microsoftgraph / microsoft-graph-devx-api

Services API for Graph Explorer
MIT License
87 stars 35 forks source link

Different snippet generation techniques return different errors for the same queryURL #1494

Closed Onokaev closed 1 year ago

Onokaev commented 1 year ago

Describe the bug For the same query URL, for example: https://graph.microsoft.com/v1.0/mee (Notice that /mee is wrong), the API returns different errors and different error codes.

To Reproduce Steps to reproduce the behavior:

  1. Go to https://developer.microsoft.com/en-us/graph/graph-explorer
  2. Type the query: https://graph.microsoft.com/v1.0/meeee
  3. Click on the Code snippets tab and also open dev tools (press f12) and select the network tab
  4. Click on the different snippet tabs and observe the responses for the different calls
  5. Notice that the errors are different for both Go and JavaScript

Expected behavior The snippets should return the same error for the same queryURL. If it's a 404, all should return that

Screenshots image

image

Notice that the errors as well as the error codes are different

Desktop (please complete the following information):

Smartphone (please complete the following information):

Additional context Add any other context about the problem here.

zengin commented 1 year ago

@Onokaev thank you for reporting this issue.

This is happening because snippet generation bubbles up exception messages from the different parsing tools. One is using OData, the other is using OpenAPI, that's why you see different error messages. It would be impractical to have common error messages across all possible error messages using these two different stacks.

Maybe this particular case could be special cased in the code with an exception wrapper, but even this won't live that long because everything will eventually move to OpenAPI.

In addition, the error messages nearly mean the same thing.

cc: @maisarissi @sebastienlevert regarding estimated timeline for migration of all languages to the OpenAPI stack.

sebastienlevert commented 1 year ago

It will still take some time until we get all languages on the OpenAPI stack, even more when we think of PowerShell. Having multiple errors "meaning" the same is a little big weird, but not that much of a big deal I think. We should focus on the expected format from OpenAPI-described snippets and let the other format die peacefully...

Onokaev commented 1 year ago

Thank you @zengin and @sebastienlevert. Let me make changes to GE to cover these special cases. For context, we want to show users the exact errors that are coming from the snippets endpoint. Currently, we show 'Snippet not available' whenever a snippet call fails for any reason.