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

PlannerAssignment class does not exist in version 6.4.0 #1873

Open
HermanShpryhau opened this issue Mar 4, 2024 · 9 comments
Open

PlannerAssignment class does not exist in version 6.4.0 #1873

HermanShpryhau opened this issue Mar 4, 2024 · 9 comments

Comments

@HermanShpryhau
Copy link

In the docs for creating a task the PlannerAssignment is mentioned in the code example, but this class is not present in the library.

@HermanShpryhau HermanShpryhau changed the title PlannerAssignment class does not exist PlannerAssignment class does not exist in version 6.4.0 Mar 4, 2024
@Ndiritu
Copy link
Contributor

Ndiritu commented Mar 4, 2024

Thanks for reporting this @HermanShpryhau.

While this is being investigated, you can try using a HashMap to hold the plannerAssignment properties and values as follows. Lmk if this unblocks you:

PlannerAssignments assignments = new PlannerAssignments();
HashMap<String, Object> additionalData = new HashMap<>();
additionalData.put("[user-id]", "{'@odata.type':'#microsoft.graph.plannerAssignment','orderHint':' !'}");
assignments.setAdditionalData(additionalData);

@Ndiritu Ndiritu added the bug label Mar 4, 2024
@Ndiritu
Copy link
Contributor

Ndiritu commented Mar 4, 2024

(Triage notes)
PlannerAssignments is an open type. PlannerAssignment(no 's') is declared as a component in the OpenAPI spec but not generated by Kiota. Could this be because it's not references as an optional property of plannerAssignments?

@HermanShpryhau
Copy link
Author

Unfortunately putting a map there results in following exception:

java.lang.IllegalStateException: Dangling name: 27a1c9e1-8745-43b6-b8e1-bd2493ed5ac8
	at com.google.gson.stream.JsonWriter.close(JsonWriter.java:346) ~[gson-2.10.1.jar:na]
	at com.google.gson.stream.JsonWriter.endObject(JsonWriter.java:321) ~[gson-2.10.1.jar:na]
	at com.microsoft.kiota.serialization.JsonSerializationWriter.writeObjectValue(JsonSerializationWriter.java:307) ~[microsoft-kiota-serialization-json-1.0.4.jar:na]
	at com.microsoft.graph.models.PlannerTask.serialize(PlannerTask.java:273) ~[microsoft-graph-6.4.0.jar:na]
	at com.microsoft.kiota.serialization.JsonSerializationWriter.writeObjectValue(JsonSerializationWriter.java:292) ~[microsoft-kiota-serialization-json-1.0.4.jar:na]
	at com.microsoft.kiota.RequestInformation.setContentFromParsable(RequestInformation.java:358) ~[microsoft-kiota-abstractions-1.0.4.jar:na]
	at com.microsoft.graph.planner.tasks.TasksRequestBuilder.toPostRequestInformation(TasksRequestBuilder.java:154) ~[microsoft-graph-6.4.0.jar:na]
	at com.microsoft.graph.planner.tasks.TasksRequestBuilder.post(TasksRequestBuilder.java:108) ~[microsoft-graph-6.4.0.jar:na]
	at com.microsoft.graph.planner.tasks.TasksRequestBuilder.post(TasksRequestBuilder.java:95) ~[microsoft-graph-6.4.0.jar:na]

I also tried creating a GSON json object and putting it there. Didn't help either.

@Ndiritu
Copy link
Contributor

Ndiritu commented Mar 4, 2024

My apologies @HermanShpryhau. I meant to pass the JSON string value. Updated the sample.

@HermanShpryhau
Copy link
Author

The string approach didn't work for me either. I don't have logs at hand currently unfortunately.

@Eleirbag89
Copy link

The string approach didn't work.
This is the error log:

Exception in thread "main" com.microsoft.graph.models.odataerrors.ODataError: An open type property has an invalid type.
	at com.microsoft.graph.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36)
	at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:210)
	at com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:672)
	at com.microsoft.kiota.ApiExceptionBuilder.<init>(ApiExceptionBuilder.java:26)
	at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:671)
	at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:279)
	at com.microsoft.graph.planner.tasks.TasksRequestBuilder.post(TasksRequestBuilder.java:111)
	at com.microsoft.graph.planner.tasks.TasksRequestBuilder.post(TasksRequestBuilder.java:95)
	at org.example.Main.main(Main.java:39)

@Ndiritu
Copy link
Contributor

Ndiritu commented Mar 13, 2024

(Triage notes) PlannerAssignments is an open type. PlannerAssignment(no 's') is declared as a component in the OpenAPI spec but not generated by Kiota. Could this be because it's not references as an optional property of plannerAssignments?

@baywet when you have some time, might you be able to share more on this?

@Ndiritu
Copy link
Contributor

Ndiritu commented Mar 13, 2024

The string approach didn't work. This is the error log:

Exception in thread "main" com.microsoft.graph.models.odataerrors.ODataError: An open type property has an invalid type.
	at com.microsoft.graph.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36)
	at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:210)
	at com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:672)
	at com.microsoft.kiota.ApiExceptionBuilder.<init>(ApiExceptionBuilder.java:26)
	at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:671)
	at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:279)
	at com.microsoft.graph.planner.tasks.TasksRequestBuilder.post(TasksRequestBuilder.java:111)
	at com.microsoft.graph.planner.tasks.TasksRequestBuilder.post(TasksRequestBuilder.java:95)
	at org.example.Main.main(Main.java:39)

Apologies @Eleirbag89 @HermanShpryhau . Realised this doesn't work because the body of the user-Id in the assignments property is sent as a JSON string instead of an object. Will investigate the root cause further

@baywet
Copy link
Member

baywet commented Mar 18, 2024

@Ndiritu I think this is one of the very few OData Dictionary usage across the API surface. @TarkanSevilmis is the architect for that API and could confirm that.
PlannerAssignements is a dictionary key string value PlannerAssignment.
But because OpenAPI.net doesn't support OAI 3.1 yet which brings support for dictionaries, openapi.net.odata cannot convert things properly.
That means we don't have a reference to PlannerAssignment in the description, so it gets trimmed away by kiota during the generation.
And whenever support for it in OpenAPI.net and OpenAPI.net.OData is added for it, adding support in kiota will be a breaking change (additions to the SerializationWriter and ParseNode interfaces).

All that to say:

  • it's an issue we probably have across languages.
  • it's going to take a while to be solved.

We should probably direct the customer to make an arbitrary request for this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants