microsoftgraph / microsoftgraph/msgraph-metadata

Annotate 'ConflictBehavior' as Query Parameter in OpenApi doc

Open
#560 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area: OpenAPI Area: SDK metadata-issue Needs: Investigation ToTriage
Dominant language
XSLT
Stars
166
Forks
55
Avg merge
16h 12m
Merged PRs (30d)
14

Description

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()+"?@microsoft.graph.conflictBehavior=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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the OpenAPI metadata for DriveItem's ConflictBehavior instance attribute and trace how it is consumed during SDK generation. Compare the generated Java and C# upload request APIs with the examples in the issue; done means conflictBehavior is exposed as a query parameter rather than requiring URI mutation.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
api, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.