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

Add support for requests that allow passing a model or a stream. #134

Closed
Tracked by #1049
darrelmiller opened this issue Apr 21, 2021 · 4 comments · Fixed by #1602
Closed
Tracked by #1049

Add support for requests that allow passing a model or a stream. #134

darrelmiller opened this issue Apr 21, 2021 · 4 comments · Fixed by #1602
Assignees
Labels
enhancement New feature or request fixed generator Issues or improvements relater to generation capabilities.

Comments

@darrelmiller
Copy link
Member

darrelmiller commented Apr 21, 2021

This is needed in OData when adding stream entities to collections.

Current .net workaround https://github.com/microsoftgraph/msgraph-sdk-dotnet/blob/dev/tests/Microsoft.Graph.DotnetCore.Test/Requests/Functional/OneNoteTests.cs#L342

Add TeamsApp and TeamsAppDefinition
https://docs.microsoft.com/en-us/graph/api/teamsapp-update?view=graph-rest-1.0&tabs=http#request

Add OneNotePage
https://docs.microsoft.com/en-us/graph/api/onenote-post-pages?view=graph-rest-1.0#request

@darrelmiller darrelmiller added this to the Alpha milestone Apr 21, 2021
@darrelmiller darrelmiller added the enhancement New feature or request label Apr 21, 2021
@darrelmiller darrelmiller modified the milestones: Alpha, Beta Apr 21, 2021
@baywet
Copy link
Member

baywet commented Apr 21, 2021

as this is an Odata concept, shouldn't it be handle at the conversion stage? what would be the resulting open api description?

@darrelmiller darrelmiller changed the title Add support for adding stream entities to collections. Add support for requests that all multiple content types, like JSON and stream. Apr 21, 2021
@darrelmiller
Copy link
Member Author

Yeah, that's why I changed the title. But the title change got lost. So I updated it again.

@baywet baywet added the generator Issues or improvements relater to generation capabilities. label Jul 21, 2021
@baywet baywet added this to Kiota Feb 18, 2022
@baywet baywet moved this to Todo in Kiota Feb 18, 2022
@darrelmiller darrelmiller changed the title Add support for requests that all multiple content types, like JSON and stream. Add support for requests that return multiple content types, like JSON and stream. Mar 18, 2022
@darrelmiller darrelmiller changed the title Add support for requests that return multiple content types, like JSON and stream. Add support for requests that allow passing a model or a stream. Mar 18, 2022
@darrelmiller
Copy link
Member Author

Add support for the following API

openapi: 3.0.0
info:
  title: Sending a stream
  version: 1.0.0
paths:
  /sendmeastream:
    post:
      requestBody:
        content:
          application/octet-stream: {}
      responses:
        200: 
          description: ok

Any unrecognized media type should be presented as a stream.

@darrelmiller darrelmiller assigned baywet and unassigned darrelmiller May 20, 2022
@baywet
Copy link
Member

baywet commented May 20, 2022

to decipher the darrelspeak here:

  • the emission of a model or stream parameter for the request body needs to be aligned with the response: look at an allow list, anything outside of the allow list or without schema to be treated as a stream.
  • that list needs to be specifiable by kiota users this way if they are not happy with our defaults, they can emit models for those additional mime types. The additional work for them being to implement IParseNode/ISerializationWriter for that mime type.

The new parameter name for the mime types should be --supported-media-types alias -m the default value should be

private static readonly HashSet<string> structuredMimeTypes = new (StringComparer.OrdinalIgnoreCase) {
and it should be multi-valued so people can do

-m application/json application/xml

or

-m application/json -m application/xml

@baywet baywet moved this from Todo to In Progress in Kiota May 30, 2022
@baywet baywet added the fixed label May 31, 2022
Repository owner moved this from In Progress to Done in Kiota Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request fixed generator Issues or improvements relater to generation capabilities.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants