microsoft-graph-devx-api
microsoft-graph-devx-api copied to clipboard
Graph API Explorer not providing right code snippets
I was unable to transfer the following issue from the docs repo to here https://github.com/microsoftgraph/microsoft-graph-docs-contrib/issues/1891
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."
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.