microsoft-graph-devx-api icon indicating copy to clipboard operation
microsoft-graph-devx-api copied to clipboard

Graph API Explorer not providing right code snippets

Open RabebOthmani opened this issue 3 years ago • 2 comments

I was unable to transfer the following issue from the docs repo to here https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/1891

RabebOthmani avatar Sep 27 '22 15:09 RabebOthmani

After talking to someone from the Java SDK team, this is the response that I received

Hi, I have determined that there isn't a references() method associated with the deviceCategroy property of a deviceManagement entity. According to our current model, when a navigationProperty also includes "containsTarget = true" in the metadata description we do not generate a <baseEntity>WithReferenceRequestBuilder class.

In this case, the deviceCategroy property in the deviceManagement has "containsTarget = true". We therefore do not generate a deviceCategroyWithReferenceRequestBuilder class. Classes with the naming schema of <baseEntity>WithReferenceRequestBuilder extend the class BaseWithReferenceRequest which defines the references() method."

ElinorW avatar Oct 24 '22 13:10 ElinorW

It seems that this is in fact a snippets issue. Properties with 'containsTarget=true' will not generate an <Entity>WithReferenceRequestBuilder in java. An <Entity>WithReferenceRequestBuilder class will include a .references() method and so without this class being generated we cannot call that method. We need to confirm with the deviceManagement owners that the property deviceCategory is in fact contained within the deviceManagement entity, if that is the case then a change to the snippets needs to be made. Alternatively, if it is not contained, then a change to the metadata is needed which will then propagate to the classes we generate which should then align the code to the snippet.

ramsessanchez avatar Oct 26 '22 18:10 ramsessanchez