【问题标题】:can I describe AWS::ApiGateway::Model schema in yaml format我可以用 yaml 格式描述 AWS::ApiGateway::Model 架构吗
【发布时间】:2020-07-15 23:20:58
【问题描述】:
我有 api-gateway cloudFormation 模板,我有 AWS::ApiGateway::Model:
Type: AWS::ApiGateway::Model
Properties:
ContentType: String
Description: "OsRules model desc"
Name: OsRule
RestApiId: !Ref Segment
Schema: json
我有一个问题,我可以用yaml格式描述Schema键吗?
【问题讨论】:
标签:
amazon-cloudformation
aws-api-gateway
【解决方案1】:
是的。你看过documentation吗?亚马逊在格式化页面上有一个示例...
Schema:
$schema: 'http://json-schema.org/draft-04/schema#'
title: PetsModelNoFlatten
type: array
items:
type: object
properties:
number:
type: integer
class:
type: string
salesPrice:
type: number
【解决方案2】:
是的,请参阅文档中的the following example:
PetsModelNoFlatten:
Type: 'AWS::ApiGateway::Model'
Properties:
RestApiId: !Ref RestApi
ContentType: application/json
Description: Schema for Pets example
Name: PetsModelNoFlatten
Schema:
$schema: 'http://json-schema.org/draft-04/schema#'
title: PetsModelNoFlatten
type: array
items:
type: object
properties:
number:
type: integer
class:
type: string
salesPrice:
type: number