microsoft-graph-explorer-v4 icon indicating copy to clipboard operation
microsoft-graph-explorer-v4 copied to clipboard

Downloadable project setup for snippets to get started

Open zengin opened this issue 2 years ago • 5 comments

We show short snippets in the "Code Snippets" tab, but they assume some dependencies and import/using statements and it takes quite some time to follow the links to get to a running project in the corresponding language.

It would be nice if we can download the code snippet with minimal project setup. For C#, that would include all the assumed usings with a .csproj file containing assumed NuGet dependencies.

Raptor already does this type of decoration to compile and execute code snippets, we can extract and reuse those templates here.

zengin avatar Apr 26 '22 22:04 zengin

While I think the idea would appeal to many people, I am concerned about the maintenance effort in managing up to date dependencies on packages and frameworks in all the languages that we support. I think we need to focus on tying the code snippet experience back to the Tutorial work that Jason is managing.

darrelmiller avatar Jun 17 '22 15:06 darrelmiller

We need to keep the dependencies up to date for Raptor tests anyways and dependabot is a great way to achieve that. We do that with inline template projects within Raptor repository and let dependabot manage dependencies for us, e.g.:

https://github.com/microsoftgraph/msgraph-sdk-raptor/tree/70ff6ca7951a1cacaa62a4b0fe0c3dbb2a17d9b3/GoV1Tests/goDependencies

If we extract them as a GitHub template project for each language, Raptor can consume the "compilation context" from the template repositories, and we can also point customers to the same template to get started with their snippet. This doesn't have to be a "download" experience, it could be a "starting from a template project" experience, but I think we have the opportunity to let customers plug the snippet directly into a contextual piece of code to get running in seconds. I totally agree that we should make sure that this doesn't pollute the samples space including the tutorials, sample projects etc.

I think this approach could offer free maintenance for all the other experiences in our portfolio. It might be worth exploring how much is in common between Raptor's compilation context, tutorials and other samples in order to make sure that there is a true opportunity for reusability.

cc: @jasonjoh

zengin avatar Jun 17 '22 18:06 zengin

This is definitely something on our radar already in the JS / TS world and would love to see something like this across all languages. Similar to how you can use a create-react-app to create any application, it would be great to find similar options for all other languages. It's also probably the best way to get started for a new dev without starting at the blank page.

sebastienlevert avatar Jun 20 '22 17:06 sebastienlevert

If we go down that route, ideally we'd make the project template repositories this way people can create a repo based on the template right away.

baywet avatar Jul 26 '23 11:07 baywet

Absolutely agree. Maybe there is an opportunity to cross-efforts with the quick starts projects from @jasonjoh

sebastienlevert avatar Jul 26 '23 15:07 sebastienlevert