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

Format IDL files #2256

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ use aws.protocols#restJson1

@restJson1
service MyService {
version: "2020-07-02",
operations: [HasDefault]
version: "2020-07-02"
operations: [
HasDefault
]
}

@http(method: "POST", uri: "/defaults")
Expand All @@ -20,7 +22,7 @@ operation HasDefault {
foo: String = ""
bar: StringList = []
baz: DefaultEnum = "FOO"
withAlphaOnlyRef: Foo_Baz,
withAlphaOnlyRef: Foo_Baz
anInt: Long
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@ namespace smithy.example
@aws.auth#sigv4(name: "someservice")
@aws.apigateway#authorizer("foo")
@aws.apigateway#authorizers(
foo: {scheme: "aws.auth#sigv4", type: "aws", uri: "arn:foo"},
baz: {scheme: "aws.auth#sigv4", type: "aws", uri: "arn:baz"})
foo: { scheme: "aws.auth#sigv4", type: "aws", uri: "arn:foo" }
baz: { scheme: "aws.auth#sigv4", type: "aws", uri: "arn:baz" }
)
service ServiceA {
version: "2019-06-17",
operations: [OperationA, OperationB]
version: "2019-06-17"
operations: [
OperationA
OperationB
]
}

// Inherits the authorizer of ServiceA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,58 @@ use aws.protocols#restJson1

@restJson1
service MyService {
version: "2020-07-02",
operations: [ValidEnums,],
version: "2020-07-02"
operations: [
ValidEnums
]
}

@httpChecksum(
requestAlgorithmMember: "requestAlgorithm",
requestValidationModeMember: "validationMode",
requestAlgorithmMember: "requestAlgorithm"
requestValidationModeMember: "validationMode"
responseAlgorithms: ["CRC32C"]
)
@http(method: "GET", uri: "/unsupported")
@readonly
@suppress(["UnstableTrait"])
operation ValidEnums {
input: ValidEnumsInput,
output: ValidEnumsOutput,

input: ValidEnumsInput
output: ValidEnumsOutput
}

structure ValidEnumsInput {
@httpQuery("requestAlgorithm")
requestAlgorithm: RequestAlgorithm,
requestAlgorithm: RequestAlgorithm

@httpQuery("validationMode")
validationMode: ValidationMode,
validationMode: ValidationMode
}

structure ValidEnumsOutput {}

@enum([
{
value: "CRC32C",
value: "CRC32C"
name: "CRC32C"
},
}
{
value: "CRC32",
value: "CRC32"
name: "CRC32"
},
}
{
value: "SHA1",
value: "SHA1"
name: "SHA1"
},
}
{
value: "SHA256",
value: "SHA256"
name: "SHA256"
}
])
string RequestAlgorithm

@enum([
{
value: "ENABLED",
value: "ENABLED"
name: "ENABLED"
}
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ use aws.api#arnReference

/// Specifies the source of the caller identifier that will be used to throttle
/// API methods that require a key.
@externalDocumentation(
"Developer Guide": "https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html"
)
@externalDocumentation("Developer Guide": "https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-swagger-extensions-api-key-source.html")
@internal
@tags(["internal"])
@trait(selector: "service")
Expand All @@ -35,9 +33,7 @@ map authorizers {
@tags(["internal"])
@trait(
selector: ":test(service, resource, operation)"
conflicts: [
"aws.apigateway#mockIntegration"
]
conflicts: ["aws.apigateway#mockIntegration"]
)
structure integration {
/// The type of integration with the specified backend.
Expand Down Expand Up @@ -109,9 +105,7 @@ structure integration {
@tags(["internal"])
@trait(
selector: ":test(service, resource, operation)"
conflicts: [
"aws.apigateway#integration"
]
conflicts: ["aws.apigateway#integration"]
)
structure mockIntegration {
/// Specifies how a request payload of unmapped content type is passed
Expand Down Expand Up @@ -141,11 +135,7 @@ string requestValidator
@private
structure AuthorizerDefinition {
/// The Smithy authentication scheme used by the client (e.g, aws.v4).
@idRef(
selector: "[trait|authDefinition]"
failWhenMissing: true
errorMessage: "The scheme of an authorizer definition must reference an auth trait"
)
@idRef(selector: "[trait|authDefinition]", failWhenMissing: true, errorMessage: "The scheme of an authorizer definition must reference an auth trait")
@required
scheme: String

Expand Down Expand Up @@ -351,6 +341,7 @@ enum PassThroughBehavior {
enum PayloadFormatVersion {
/// Specifies 1.0 version of the format used by the authorizer
V1_0 = "1.0"

/// Specifies 2.0 version of the format used by the authorizer
V2_0 = "2.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,19 @@ use aws.auth#sigv4
@sigv4(name: "service")
@aws.apigateway#authorizer("foo")
@aws.apigateway#authorizers(
foo: {scheme: sigv4, type: "aws", uri: "arn:foo"},
baz: {scheme: sigv4, type: "aws", uri: "arn:foo"})
foo: { scheme: sigv4, type: "aws", uri: "arn:foo" }
baz: { scheme: sigv4, type: "aws", uri: "arn:foo" }
)
service ServiceA {
version: "2019-06-17",
operations: [OperationA, OperationB],
resources: [ResourceA, ResourceB],
version: "2019-06-17"
operations: [
OperationA
OperationB
]
resources: [
ResourceA
ResourceB
]
}

// Inherits the authorizer of ServiceA
Expand All @@ -22,7 +29,10 @@ operation OperationB {}

// Inherits the authorizer of ServiceA
resource ResourceA {
operations: [OperationC, OperationD]
operations: [
OperationC
OperationD
]
}

// Inherits the authorizer of ServiceA
Expand All @@ -35,7 +45,10 @@ operation OperationD {}
// Overrides the authorizer of ServiceA
@aws.apigateway#authorizer("baz")
resource ResourceB {
operations: [OperationE, OperationF]
operations: [
OperationE
OperationF
]
}

// Inherits the authorizer of ResourceB
Expand All @@ -47,10 +60,17 @@ operation OperationF {}

@sigv4(name: "service")
@aws.apigateway#authorizers(
foo: {scheme: sigv4, type: "aws", uri: "arn:foo"},
baz: {scheme: sigv4, type: "aws", uri: "arn:foo"})
foo: { scheme: sigv4, type: "aws", uri: "arn:foo" }
baz: { scheme: sigv4, type: "aws", uri: "arn:foo" }
)
service ServiceB {
version: "2019-06-17",
operations: [OperationA, OperationB],
resources: [ResourceA, ResourceB],
version: "2019-06-17"
operations: [
OperationA
OperationB
]
resources: [
ResourceA
ResourceB
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,48 @@ namespace aws.cloudformation
/// additional identifier for the resource.
@unstable
@trait(
selector: "structure > :test(member > string)",
conflicts: [cfnExcludeProperty],
breakingChanges: [{change: "remove"}]
selector: "structure > :test(member > string)"
conflicts: [cfnExcludeProperty]
breakingChanges: [
{
change: "remove"
}
]
)
structure cfnAdditionalIdentifier {}

/// The cloudFormationName trait allows a CloudFormation resource property name
/// to differ from a structure member name used in the model.
@unstable
@trait(
selector: "structure > member",
breakingChanges: [{change: "any"}]
selector: "structure > member"
breakingChanges: [
{
change: "any"
}
]
)
string cfnName

/// Indicates that a structure member should not be included in generated
/// CloudFormation resource definitions.
@unstable
@trait(
selector: "structure > member",
conflicts: [
cfnAdditionalIdentifier,
cfnMutability,
cfnDefaultValue
],
breakingChanges: [{change: "add"}]
selector: "structure > member"
conflicts: [cfnAdditionalIdentifier, cfnMutability, cfnDefaultValue]
breakingChanges: [
{
change: "add"
}
]
)
structure cfnExcludeProperty {}

/// Indicates that a structure member has a default value
/// for the property of the CloudFormation resource.
@unstable
@trait(
selector: "resource > operation -[input, output]-> structure > member",
selector: "resource > operation -[input, output]-> structure > member"
conflicts: [cfnExcludeProperty]
)
structure cfnDefaultValue {}
Expand All @@ -48,7 +56,7 @@ structure cfnDefaultValue {}
/// when part of a CloudFormation resource.
@unstable
@trait(
selector: "structure > member",
selector: "structure > member"
conflicts: [cfnExcludeProperty]
)
enum cfnMutability {
Expand All @@ -69,13 +77,11 @@ enum cfnMutability {
/// member is also marked with the `@additionalIdentifier` trait.
CREATE = "create"


/// Indicates that the CloudFormation property generated from this
/// member can be returned by a `read` or `list` request, but
/// cannot be set by the user.
READ = "read"


/// Indicates that the CloudFormation property generated from this
/// member can be specified by the user, but cannot be returned by a
/// `read` or `list` request. MUST NOT be set if the member is also
Expand All @@ -86,16 +92,20 @@ enum cfnMutability {
/// Indicates that a Smithy resource is a CloudFormation resource.
@unstable
@trait(
selector: "resource",
breakingChanges: [{change: "presence"}]
selector: "resource"
breakingChanges: [
{
change: "presence"
}
]
)
structure cfnResource {
/// Provides a custom CloudFormation resource name.
name: String,
name: String

/// A list of additional shape IDs of structures that will have their
/// properties added to the CloudFormation resource.
additionalSchemas: StructureIdList,
additionalSchemas: StructureIdList
}

@private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,27 @@ use aws.cloudformation#cfnResource

@cfnResource
resource FooResource {
identifiers: {
fooId: FooId
}
identifiers: { fooId: FooId }
}

@cfnResource(
name: "CustomResource",
name: "CustomResource"
additionalSchemas: [ExtraBarRequest]
)
resource BarResource {
identifiers: {
barId: BarId
},
operations: [ExtraBarOperation],
identifiers: { barId: BarId }
operations: [
ExtraBarOperation
]
}

operation ExtraBarOperation {
input: ExtraBarRequest,
input: ExtraBarRequest
}

structure ExtraBarRequest {
@required
barId: BarId,
barId: BarId
}

string FooId
Expand Down
Loading
Loading