Api Gateway - support for allOf & oneOf

1

As per this documentation https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-known-issues.html#api-gateway-known-issues-rest-apis , it mentions there's no support for oneOf property when defining API specs with OpenAPI 3.0.

There's no mentioning of the allOf property, but support for it seems to be partial: if I compose the root schema model with allOf, the corresponding endpoint will end up with no model attached to the request body at the API GW side. However, if I define some sub-property of the root model with allOf, that seems to work.

Example (hand written yaml so indentations not correct, but you'll get the idea):

schemas:
  # This does not work
  NotWorkingModel:
    allOf:
      - type: object
        properties:
          foo:
            type: string
       - type: object
         properties:
           bar:
             type: string
   
   # This works
   WorkingModel:
     type: object
     properties:
       foo:
         allOf:
            - type: object
               properties:
                 bar:
                   type: string
            - type: object
               properties:
                  jar:
                    type: string

My main question is: will there be any plans getting these oneOf & allOf properties fully supported when defining REST API specs with OpenAPI?

l3p1
已提問 1 年前檢視次數 292 次
1 個回答
3
已接受的答案

Hello,

This is still an active feature request we have with the API Gateway internal team for which we currently do not have an ETA, unfortunately. You can keep an eye on the AWS What's New page and the API Gateway blog, as all new feature requests and enhancements are posted there.

 - AWS blogs: https://blogs.amazon.com/
 - What's New: https://aws.amazon.com/new/
 - AWS Release Notes: https://aws.amazon.com/releasenotes/
 - AWS Compute Blog: Amazon API Gateway - https://aws.amazon.com/blogs/compute/tag/amazon-api-gateway/
AWS
支援工程師
Rajil_P
已回答 1 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南