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

Code snippets must be clearer on the version of the SDK #1048

Closed
maisarissi opened this issue Jun 24, 2022 · 23 comments
Closed

Code snippets must be clearer on the version of the SDK #1048

maisarissi opened this issue Jun 24, 2022 · 23 comments
Assignees
Labels
area: snippets-generation Describes a required fix to the snippet generator type: enhancement Enhancement request targeting an existing experience

Comments

@maisarissi
Copy link

maisarissi commented Jun 24, 2022

Microsoft Graph API reference docs and Graph Explorer provide code snippets given an HTTP call/scenario.
However, just by looking at the code snippet, it's impossible to know which SDK version it is compatible with.

We need to be clear which SDK version is supported in both platforms, Graph API reference docs and Graph Explorer.

Any suggestions on what it should look like? @RabebOthmani @lramosvea

@maisarissi maisarissi added the area: snippets-generation Describes a required fix to the snippet generator label Jun 24, 2022
@lramosvea
Copy link

lramosvea commented Jun 24, 2022

@maisarissi, @jasonjoh and I had a discussion prior to our offsite about this. One of the things we discussed was having a support policy we can publish about versioning, which I think currently does not exist. We need to discuss this also with Seb and Vivian.

@ddyett
Copy link
Contributor

ddyett commented Apr 5, 2023

@maisarissi @lramosvea do we still need to close on anything here?

@maisarissi
Copy link
Author

maisarissi commented Apr 12, 2023

We should have a new sentence highlighting the version used to generate the snippet:

image

@isvargasmsft @sebastienlevert @CarolKigoonya can you take a look at the suggestion and add any other thoughts?

@isvargasmsft
Copy link
Member

I agree with adding a small flag with the version just for clarification. That could also promote upgrading to newer versions of the SDK.

@lramosvea
Copy link

We do need to add the SDK version used to generate the snippets.

@sebastienlevert
Copy link

This should be part of the snippet so it would also work with Graph Explorer. I agree this would deliver clear expectations for developers.

@andrueastman
Copy link
Member

For the docs, we could probably do something like this. If we place a note inside the snippet block we run into the issue where using the copy functionality results in the user copying invalid code that may not compile.

Update user - Microsoft Graph beta | Microsoft Learn

image

The alternative is to use the option below with the text appearing as a code comment. This will also easily work with the Graph Explorer.

Update user - Microsoft Graph beta | Microsoft Learn

image

@sebastienlevert
Copy link

I like this option as it easily spans across all properties where we show snippets!

@maisarissi
Copy link
Author

If we choose to go with the first option, which looks way better in our docs than just a comment line, would Graph Explorer be able to follow a similar pattern?

@sebastienlevert
Copy link

@maisarissi The first options seems like extra work for Graph Explorer as it doesn't support markdown currently IIRC.

@sebastienlevert
Copy link

Also, the fact that the version is copy / pasted is fairly interesting as it bring this context over to the developers IDE.

@maisarissi
Copy link
Author

I agree with those points, however I feel that the code comment is "less visible", in a sense that, it's easier to ignore the information as opposed to the Note option that creates a block to draw the readers' attention to it.

What if we add the comment in the code snippet but in the docs we keep the Note as well?

@sebastienlevert
Copy link

I love this last version!

@isvargasmsft
Copy link
Member

The note can be hosted in an include file that can be easily updated when we move to a different major version.

@sebastienlevert
Copy link

@isvargasmsft yes for the docs, not for GE though. So we need a solution that address both!

@maisarissi
Copy link
Author

Ok! So I'll summarize our agreement:

  • Have a include file with "Code snippets are only available for the latest version. Current version is 5.x"
  • Use the include file to generate the Note section in the docs
  • Also have the comment in the code showing the version so we can have the same information in Graph Explorer (this will duplicate the information for people in docs, but I don't think this is a problem)

The final version would be:
image

@sebastienlevert @isvargasmsft @andrueastman

@lramosvea
Copy link

I like having the note although not sure if this will look good on docs where we have many notes already and this might be a bit overwhelming for users. Let me share this with Steve.

@maisarissi
Copy link
Author

Hey @lramosvea have you checked with Steve? We believe this will bring clarity to users.

@lramosvea
Copy link

Can't tag Steve here but did share this with him. Let me follow up and I'll get back to you.

@ddyett ddyett assigned lramosvea and unassigned andrueastman Jun 29, 2023
@ddyett
Copy link
Contributor

ddyett commented Jun 29, 2023

@lramosvea awaiting word of decision.

@lramosvea
Copy link

@ddyett @maisarissi after discussing this with the rest of the docs team, our recommendation is to just keep the comment in the code. We don't think the note needs to be added,

@ddyett
Copy link
Contributor

ddyett commented Oct 12, 2023

@ddyett to move to global backlog. .NET complete but needs tracking for other languages.

@andrueastman
Copy link
Member

Closing this for now given the available spec. This has been broken down into individual language issues below
CLI - #1935
Go - #1936
Python - #1937
PHP - #1938
Typescript - #1939
Powershell - #1940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: snippets-generation Describes a required fix to the snippet generator type: enhancement Enhancement request targeting an existing experience
Projects
None yet
Development

No branches or pull requests

7 participants