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

Simplify simple.smithy #2339

Merged
merged 3 commits into from
Feb 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
132 changes: 9 additions & 123 deletions codegen-core/common-test-models/simple.smithy
Original file line number Diff line number Diff line change
@@ -1,136 +1,22 @@
$version: "1.0"
$version: "2.0"

namespace com.amazonaws.simple

use aws.protocols#restJson1
use smithy.test#httpRequestTests
use smithy.test#httpResponseTests
use smithy.framework#ValidationException

@restJson1
@title("SimpleService")
@documentation("A simple service example, with a Service resource that can be registered and a readonly healthcheck")
service SimpleService {
version: "2022-01-01",
resources: [
Service,
],
operations: [
Healthcheck,
StoreServiceBlob,
],
Operation
]
}

@documentation("Id of the service that will be registered")
string ServiceId

@documentation("Name of the service that will be registered")
string ServiceName

@error("client")
@documentation(
"""
Returned when a new resource cannot be created because one already exists.
"""
)
structure ResourceAlreadyExists {
@required
message: String
}

@documentation("A resource that can register services")
resource Service {
identifiers: { id: ServiceId },
put: RegisterService,
}

@idempotent
@http(method: "PUT", uri: "/service/{id}")
@documentation("Service register operation")
@httpRequestTests([
{
id: "RegisterServiceRequestTest",
protocol: "aws.protocols#restJson1",
uri: "/service/1",
headers: {
"Content-Type": "application/json",
},
params: { id: "1", name: "TestService" },
body: "{\"name\":\"TestService\"}",
method: "PUT",
}
])
@httpResponseTests([
{
id: "RegisterServiceResponseTest",
protocol: "aws.protocols#restJson1",
params: { id: "1", name: "TestService" },
body: "{\"id\":\"1\",\"name\":\"TestService\"}",
code: 200,
headers: {
"Content-Length": "31"
}
}
])
operation RegisterService {
input: RegisterServiceInputRequest,
output: RegisterServiceOutputResponse,
errors: [ResourceAlreadyExists, ValidationException]
}

@documentation("Service register input structure")
structure RegisterServiceInputRequest {
@required
@httpLabel
id: ServiceId,
name: ServiceName,
}

@documentation("Service register output structure")
structure RegisterServiceOutputResponse {
@required
id: ServiceId,
name: ServiceName,
}

@readonly
@http(uri: "/healthcheck", method: "GET")
@documentation("Read-only healthcheck operation")
operation Healthcheck {
input: HealthcheckInputRequest,
output: HealthcheckOutputResponse
@http(uri: "/operation", method: "POST")
operation Operation {
input: OperationInputOutput
output: OperationInputOutput
}

@documentation("Service healthcheck output structure")
structure HealthcheckInputRequest {

}

@documentation("Service healthcheck input structure")
structure HealthcheckOutputResponse {

}

@readonly
@http(method: "POST", uri: "/service/{id}/blob")
@documentation("Stores a blob for a service id")
operation StoreServiceBlob {
input: StoreServiceBlobInput,
output: StoreServiceBlobOutput,
errors: [ValidationException]
}

@documentation("Store a blob for a service id input structure")
structure StoreServiceBlobInput {
@required
@httpLabel
id: ServiceId,
@required
@httpPayload
content: Blob,
}

@documentation("Store a blob for a service id output structure")
structure StoreServiceBlobOutput {

structure OperationInputOutput {
message: String
}