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

[User story] Copy API manifest path #2836

Closed
RabebOthmani opened this issue Oct 30, 2023 · 17 comments · May be fixed by #2572
Closed

[User story] Copy API manifest path #2836

RabebOthmani opened this issue Oct 30, 2023 · 17 comments · May be fixed by #2572
Assignees
Labels
Area: Resource Explorer Needs: Attention 👋 Author has responded to the issue
Milestone

Comments

@RabebOthmani
Copy link

As a user, when I click on the 'copy to clipboard' button
I want the API manifest path to be copied
So I can use it with the Kiota extension on VS Code

Acceptance criteria:

  • I want to have a valid API manifest Path
@thewahome
Copy link
Collaborator

What is an API manifest path?

@RabebOthmani
Copy link
Author

@thewahome I'm noticing that what we are copying is an encoded value. Originally we encoded that to manage the URL and be able to open directly in VS Code. There's no need to encode anymore. Is there a use case for encoding?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: Attention 👋 Author has responded to the issue and removed Needs: Author Feedback labels Nov 7, 2023
@thewahome
Copy link
Collaborator

I am not sure @RabebOthmani . @baywet must we encode it for the VS Code extension to pick up the manifest?

@baywet
Copy link
Member

baywet commented Nov 7, 2023

both would be supported I believe at this point. But To Rabeb's point, since we don't need to encode it anymore, having it copied to the clipboard not-encoded would be useful to people who want to copy it to do something else with it.

@thewahome thewahome linked a pull request Nov 15, 2023 that will close this issue
2 tasks
@thewahome thewahome added this to the November-2023 milestone Nov 15, 2023
@thewahome thewahome assigned thewahome and unassigned RabebOthmani Nov 15, 2023
@RabebOthmani
Copy link
Author

RabebOthmani commented Nov 15, 2023

Test scenario
collection to generate

Path generated

{
    "publisher": {
        "name": "Microsoft Graph",
        "contactEmail": "[email protected]"
    },
    "apiDependencies": {
        "graph-v1.0-DelegatedWork": {
            "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml",
            "apiDeploymentBaseUrl": "https://graph.microsoft.com",
            "apiDescriptionVersion": "v1.0",
            "auth": {
                "clientIdentifier": "",
                "access": [
                    {
                        "type": "openid",
                        "claims": {
                            "scp": {
                                "essential": true,
                                "values": [
                                    "Chat.ReadBasic"
                                ]
                            }
                        }
                    }
                ]
            },
            "requests": [
                {
                    "method": "GET",
                    "uriTemplate": "/chats"
                },
                {
                    "method": "GET",
                    "uriTemplate": "/chats/$count"
                }
            ]
        },
        "graph-beta-DelegatedWork": {
            "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/beta/openapi.yaml",
            "apiDeploymentBaseUrl": "https://graph.microsoft.com",
            "apiDescriptionVersion": "beta",
            "auth": {
                "clientIdentifier": "",
                "access": [
                    {
                        "type": "openid",
                        "claims": {
                            "scp": {
                                "essential": true,
                                "values": []
                            }
                        }
                    }
                ]
            },
            "requests": [
                {
                    "method": "GET",
                    "uriTemplate": "/admin"
                }
            ]
        }
    }
}

If I change the scope
scope

The generation

{
    "publisher": {
        "name": "Microsoft Graph",
        "contactEmail": "[email protected]"
    },
    "apiDependencies": {
        "graph-v1.0-DelegatedWork": {
            "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml",
            "apiDeploymentBaseUrl": "https://graph.microsoft.com",
            "apiDescriptionVersion": "v1.0",
            "auth": {
                "clientIdentifier": "",
                "access": [
                    {
                        "type": "openid",
                        "claims": {
                            "scp": {
                                "essential": true,
                                "values": [
                                    "Chat.ReadBasic"
                                ]
                            }
                        }
                    }
                ]
            },
            "requests": [
                {
                    "method": "GET",
                    "uriTemplate": "/chats"
                },
                {
                    "method": "GET",
                    "uriTemplate": "/chats/$count"
                }
            ]
        },
        "graph-v1.0-Application": {
            "apiDescriptionUrl": "https://raw.githubusercontent.com/microsoftgraph/msgraph-metadata/master/openapi/v1.0/openapi.yaml",
            "apiDeploymentBaseUrl": "https://graph.microsoft.com",
            "apiDescriptionVersion": "v1.0",
            "auth": {
                "clientIdentifier": "",
                "access": [
                    {
                        "type": "openid",
                        "claims": {
                            "roles": {
                                "essential": true,
                                "values": []
                            }
                        }
                    }
                ]
            },
            "requests": []
        }
    }
}

@thewahome @darrelmiller the requests are empty once we change the scope to Application and we are not capturing the app permissions required. This isn't the expected behaviour, is it? Please notice that changing the scope also changed the version of the API in the generation without the user changing it (admin beta is generated as V1)

@darrelmiller
Copy link
Contributor

@RabebOthmani GET /beta/admin isn't actually a valid Graph URL, so it will fail to return permissions. That might be why we are seeing invalid generation for the app only scenario. Try it with GET /users

@RabebOthmani
Copy link
Author

@darrelmiller GET/users is working, FYI @thewahome which means the conversation should be around the paths so we avoid such cases

@thewahome
Copy link
Collaborator

The faulty permissions are fixed now @RabebOthmani it's possible that @darrelmiller is looking at the updated values

@petrhollayms
Copy link

@baywet Could you please have a look on the VSCode integration? To be discussed.

@baywet
Copy link
Member

baywet commented Dec 6, 2023

@thewahome is this in production or do you have a URI for a preview?
@petrhollayms I believe the repro scenario has changed a couple of times throughout the discussion here now, do you have clear repro instructions?

@thewahome
Copy link
Collaborator

It's still in staging. The repro steps are:

  • add any two or more paths into a collection
  • preview the collection
  • in the preview page, click on the "create a manifest" button
  • in the new manifest screen, a preview of the manifest containing the resources you selected is visible in a readonly editor
  • on the top right of the preview, a copy button exists. Click it to copy the contents into your clipboard
  • open visual studio code with the Kiota extension installed
  • open the kiota options and click on paste a manifest
  • notice that throws an error

@baywet
Copy link
Member

baywet commented Dec 6, 2023

Thanks for the details.
Can you provide me with the staging link please? (either here or through teams)
Any specifics about what you put in the collection (endpoints, authentication scenarios) to cause the error?

@baywet
Copy link
Member

baywet commented Dec 7, 2023

Just for clarity here: it's the "Paste API manifest" button that doesn't work properly (I can repro that). When you click on "Open in VS Code" in GE (which is what I was doing to date), it works properly.
That's strange since it's supposed to be the same code for both commands. Investigating.

@baywet
Copy link
Member

baywet commented Dec 7, 2023

Update: I was able to isolate and fix the bug. However this is now going to consistently fail for both approaches because I also updated the api manifest dependency and the apiDeploymentBaseUrl generated by GE doesn't end with a trailing slash. Could you fix that last detail @thewahome please?

microsoft/kiota#3877

@baywet
Copy link
Member

baywet commented Dec 7, 2023

(also application name now seems to be required by the spec)

@thewahome
Copy link
Collaborator

thewahome commented Jan 8, 2024

@baywet, I've added the trailing slash in the apiDeploymentBaseUrl property

@baywet
Copy link
Member

baywet commented Jan 8, 2024

Thanks, do you have a staging URL for me to run integration tests? Or were you able to validate end to end with the latest preview of the vscode extension?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Resource Explorer Needs: Attention 👋 Author has responded to the issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants