Hi Malintha,

>From what I understood from above, OpenAPI 3.0.0 is supporting specifying
different response/request schemas based on the media type. In swagger 2.0
we could define only one schema for request/response which is common for
the specified produces and consumes elements under resources section. Is my
understanding correct?

Yes, we can define different schemas of responses and requests based on the
content type.

eg: Responses

  responses:
        '200':
          description: OK
          content:
            application/xml:
              schema:
                type: array
                items:
                  type: string
            application/json:
              schema:
                type: array
                items:
                  type: string



eg: RequestBody

     requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                payload:
                  type: string
          application/xml:
            schema:
              type: object
              properties:
                payload:
                  type: string
        description: Request Body


If that so, if we are changing the UI based on swagger version, do we also
support specifying different response/request schemas based on the media
type?

Since we have been providing the functionality of defining body and
formData parameters in APIM 2.1.0, we have to at least support requestBody
definitions in APIM 2.2.0 UI. Since we haven't supported responses
definitions for Swagger 2.0, we can omit this functionality for OpenAPI
3.0.0 also, but if we are planning to add this as a new improvement, we
have to implement this for both versions. Or else, we can allow the users
to continue with complex definitions via embedded Swagger editor.





On Tue, Jan 16, 2018 at 11:06 AM, Malintha Amarasinghe <[email protected]>
wrote:

> Hi Thilini,
>
> From what I understood from above, OpenAPI 3.0.0 is supporting specifying
> different response/request schemas based on the media type. In swagger 2.0
> we could define only one schema for request/response which is common for
> the specified produces and consumes elements under resources section. Is my
> understanding correct?
>
> If that so, if we are changing the UI based on swagger version, do we also
> support specifying different response/request schemas based on the media
> type?
>
> Thanks!
> Malintha
>
> On Tue, Jan 16, 2018 at 10:54 AM, Thilini Shanika <[email protected]>
> wrote:
>
>> Hi All,
>>
>> We are currently in the process of implementing Open API 3.0 support in
>> API Manager and as per the design discussions, APIM 2.2.0 will be
>> supporting both OpenAPI 3.0.0 and Swagger 2.0 specs. A resource definition
>> of Open API 3.0.0 has some significant differences compared to a resource
>> definition in Swagger 2.0. Following are some of the major differences of
>> Swagger 2.0 and OpenAPI 3.0.0 spec based API resource definition.
>>
>>    - '*body*' and '*formData*' parameter types are not available in
>>    OpenAPI 3.0.0. Instead, the *requestBody* element has been introduced.
>>    - According to Swagger 2.0 spec, one can define a list of MIME types
>>    which the API resource can produce and consume. These configs are
>>    defines under *consumes *and *produces *elements of the API resource.
>>    But this config is no longer available in OpenAPI 3.0.0. Instead, MIME
>>    types are defined under *requestBody *and *response *elements.
>>
>> OpenAPI 3.0.0 based resource definition is given below
>>
>> paths:
>>   /testpath:
>>     get:
>>       responses:
>>         '200':
>>           description: OK
>>       parameters:
>>         - name: id
>>           in: query
>>           required: false
>>           schema:
>>             type: string
>>     post:
>>       responses:
>>         '200':
>>           description: OK
>>           content:
>>             *application/xml*:
>>               schema:
>>                 type: array
>>                 items:
>>                   type: string
>>       *requestBody*:
>>         content:
>>           *application/json:*
>>             schema:
>>               type: object
>>               properties:
>>                 payload:
>>                   type: string
>>         description: Request Body
>>
>> If we are implementing support for OpenAPI 3.0.0, we have to do some
>> changes to resource definition UI. (Has to remove consumes: and produces:
>> fields, has to remove body and formData from parameter types. Instead,
>> requestBody configuration functionality should be added). Since we have to
>> support both versions, we have to change the resource definition UI
>> rendering based on the swagger version. Shall we render a different UI with
>> above changes for OpenAPI 3.0.0 based API definitions? WDYT?
>>
>>
>>
>> --
>> Thilini Shanika
>> Senior Software Engineer
>> WSO2, Inc.; http://wso2.com
>> 20, Palmgrove Avenue, Colombo 3
>>
>> E-mail: [email protected]
>> o
>>
>
>
>
> --
> Malintha Amarasinghe
> *WSO2, Inc. - lean | enterprise | middleware*
> http://wso2.com/
>
> Mobile : +94 712383306 <+94%2071%20238%203306>
>



-- 
Thilini Shanika
Senior Software Engineer
WSO2, Inc.; http://wso2.com
20, Palmgrove Avenue, Colombo 3

E-mail: [email protected]
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to