From e63f3ee69382ea4c65825eba0c9714d0bc409e32 Mon Sep 17 00:00:00 2001 From: david-perez Date: Mon, 13 Feb 2023 12:41:43 +0100 Subject: [PATCH] Simplify `simple.smithy` (#2339) `simple.smithy` is currently not that simple. Besides, it serves no effective purpose: everything that the model exercises is already exercised in a clearer and more orderly manner in other integration tests. This PR makes the model minimal, so that it recovers its purpose as a simple smoke test. Contributors can also use the model as a scratchpad for features or bugfixs they're working on. --- codegen-core/common-test-models/simple.smithy | 132 ++---------------- 1 file changed, 9 insertions(+), 123 deletions(-) diff --git a/codegen-core/common-test-models/simple.smithy b/codegen-core/common-test-models/simple.smithy index 43c4bc6aca..c7e58c8e4a 100644 --- a/codegen-core/common-test-models/simple.smithy +++ b/codegen-core/common-test-models/simple.smithy @@ -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 }