-
Notifications
You must be signed in to change notification settings - Fork 62
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 the ability to change the request or response body content type based on an annotation #405
Comments
Here is what the result should look like (for the request body) in the case of OneNote openapi: 3.0.1
info:
title: Example
description: Example
version: 1.0.1
servers:
- url: https://example.org
paths:
/directoryObject:
post:
requestBody:
content:
multipart/form-data:
schema:
type: object
properties:
id:
type: string
format: uuid
address:
$ref: '#/components/schemas/address'
profileImage:
type: string
format: binary
encoding:
id:
contentType: text/plain
address:
contentType: application/json
profileImage:
contentType: image/png
responses:
'204':
content:
application/json:
schema:
type: string
components:
schemas:
address:
type: object
properties:
street:
type: string
city:
type: string |
We can leverage the <EntityType Name="onenote" BaseType="graph.entity">
<NavigationProperty Name="pages" Type="Collection(graph.onenotePage)" ContainsTarget="true">
<Annotation Term="Org.OData.Core.V1.MediaType" String="application/xhtml+xml" />
</NavigationProperty>
</EntityType> We can then check for the above annotation here: Lines 128 to 132 in eb17185
|
Thanks for the additional information. |
To address the potentially different MIME types required for different operations, I propose adding new properties to the below capability annotations for their respective methods: 1. PUT/PATCH scenarios: <ComplexType Name="UpdateRestrictionsType">
<Property Name="AcceptableContentTypes" Type="Collection(Edm.String)" Nullable="false">
<Annotation Term="Core.Description" String="Lists the MIME types acceptable for the request body content"/>
</Property>
<Property Name="AcceptableResponseTypes" Type="Collection(Edm.String)" Nullable="false">
<Annotation Term="Core.Description" String="Lists the MIME types acceptable for the response returned by the request" />
</Property>
<!-- other properties -->
</ComplexType> 2. POST method scenarios: <ComplexType Name="InsertRestrictionsType">
<Property Name="AcceptableContentTypes" Type="Collection(Edm.String)" Nullable="false">
<Annotation Term="Core.Description" String="Lists the MIME types acceptable for the request body content"/>
</Property>
<Property Name="AcceptableResponseTypes" Type="Collection(Edm.String)" Nullable="false">
<Annotation Term="Core.Description" String="Lists the MIME types acceptable for the response returned by the request" />
</Property>
<!-- other properties -->
</ComplexType> Thoughts? @darrelmiller @baywet @mikepizzo |
Thanks for following up on this. I think we should make the annotations' names a bit more explicit, what do you think of:
|
I was going to suggest:
but I think I like @baywet's suggestions better. Have @garethj-msft and @MaximRouiller seen this proposal? |
We haven't. Reading this now. Give me some time to ingest the information. |
Alright, I have a few questions.
I might be completely off but I'm happy to jump on a call to clarify my viewpoint. |
@MaximRouiller And we already use it in our metadata, example: However, this annotation doesn't specify the operations in which the MIME types are applicable, and hence they will be applied to all the operations in the generated path. The problem we have at hand is specifying specific MIME types for specific operations, in cases where they could be different for the different operations. To answer your questions: |
OneNote leverages multipart/form to create/update one note pages so the page, attachments and more can be pushed in a single call.
Currently the resulting OpenAPI description contains a basic JSON input/output for that endpoint which is incorrect.
We should:
The text was updated successfully, but these errors were encountered: