msgraph-metadata icon indicating copy to clipboard operation
msgraph-metadata copied to clipboard

Annotate 'ConflictBehavior' as Query Parameter in OpenApi doc

Open ramsessanchez opened this issue 2 years ago • 0 comments

The instance attribute should be annotated as a queryParameter in the openApi doc that we use for SDK generation. At the current moment we are required to add the conflict behavior parameter as such for java (and similarly for c#)

RequestInformation requestInformation = graphClient.drives().byDriveId("id").items().byDriveItemId("id").content().toPutRequestInformation(file);
// 'file' should be an inputStream
URI uriIncludesConflictBehavior = new URI(requestInformation.getUri().toString()+"[email protected]=rename");
requestInformation.setUri(uriIncludesConflictBehavior);

graphClient.getRequestAdapter().sendPrimitive(requestInformation, null, InputStream.class);

the desired outcome should be much simpler

graphClient.drives().byDriveId("id").items().byDriveItemId("id").content().put(file, config -> {
config.queryParameters.conflictBehavior = "rename";
});

This instance attribute should be treated as a query parameter as it is set in the url and thus should be annotated as such.

Future consideration: This does bring up the question as to how we should handle InstanceAttributes and how they should be described in the OpenApi doc going forward. To me it seems that they vary in implementation and behavior making it difficult to default to a single rule. Perhaps they should be handled on a case-by-case basis? I would be interested in hearing any thoughts and ideas regarding these sorts of options.

ramsessanchez avatar Jan 22 '24 23:01 ramsessanchez