Skip to content

Commit

Permalink
Regenerate example
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed Aug 5, 2024
1 parent fc0e553 commit d80b6cb
Show file tree
Hide file tree
Showing 24 changed files with 713 additions and 301 deletions.
2 changes: 1 addition & 1 deletion example/build/smithy/classpath.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":"1.0","artifacts":{"software.amazon.smithy.ruby:smithy-ruby-rails-codegen:0.3.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/ruby/smithy-ruby-rails-codegen/0.3.0/smithy-ruby-rails-codegen-0.3.0.jar","sha1":"af1219ea5c3651f06c234b1c580e17aaa0fefd1a"},"software.amazon.smithy.ruby:smithy-ruby-codegen:0.3.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/ruby/smithy-ruby-codegen/0.3.0/smithy-ruby-codegen-0.3.0.jar","sha1":"9fdbf0d9ea0be3e1365e39c9fe2f7fb261a86736"},"software.amazon.smithy:smithy-codegen-core:1.44.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-codegen-core/1.44.0/smithy-codegen-core-1.44.0.jar","sha1":"846298b340671e6e64d3b395dfc4e3ae43799411"},"software.amazon.smithy:smithy-waiters:1.44.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-waiters/1.44.0/smithy-waiters-1.44.0.jar","sha1":"39506d22c9593dffc1f19f8f3db9c6b49e8153bd"},"software.amazon.smithy:smithy-jmespath:1.44.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-jmespath/1.44.0/smithy-jmespath-1.44.0.jar","sha1":"798cf5cc353a1178f4d549d046e3afbdb4fe0b20"},"software.amazon.smithy:smithy-rules-engine:1.44.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-rules-engine/1.44.0/smithy-rules-engine-1.44.0.jar","sha1":"45989301f54639089a82cafe0dc8833cd1879415"},"software.amazon.smithy:smithy-protocol-test-traits:1.44.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-protocol-test-traits/1.44.0/smithy-protocol-test-traits-1.44.0.jar","sha1":"445967304497bb5602b2d02ed5a6eaf18e7572c6"}}}
{"version":"1.0","artifacts":{"software.amazon.smithy.ruby:smithy-ruby-rails-codegen:0.3.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/ruby/smithy-ruby-rails-codegen/0.3.0/smithy-ruby-rails-codegen-0.3.0.jar","sha1":"af1219ea5c3651f06c234b1c580e17aaa0fefd1a"},"software.amazon.smithy.ruby:smithy-ruby-codegen:0.3.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/ruby/smithy-ruby-codegen/0.3.0/smithy-ruby-codegen-0.3.0.jar","sha1":"9fdbf0d9ea0be3e1365e39c9fe2f7fb261a86736"},"software.amazon.smithy:smithy-codegen-core:1.50.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-codegen-core/1.50.0/smithy-codegen-core-1.50.0.jar","sha1":"f258e35cc2bd47af79bebb41c4ed8ac5b9fed2df"},"software.amazon.smithy:smithy-waiters:1.50.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-waiters/1.50.0/smithy-waiters-1.50.0.jar","sha1":"3efa3d5e94114761bc7e7245cc9f548e753dcefb"},"software.amazon.smithy:smithy-jmespath:1.50.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-jmespath/1.50.0/smithy-jmespath-1.50.0.jar","sha1":"6707074f0cbc1410a6b62f4ff3c06f94cc119268"},"software.amazon.smithy:smithy-rules-engine:1.50.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-rules-engine/1.50.0/smithy-rules-engine-1.50.0.jar","sha1":"680c84e2f7196369784fae20cd07613d365df04e"},"software.amazon.smithy:smithy-protocol-traits:1.50.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-protocol-traits/1.50.0/smithy-protocol-traits-1.50.0.jar","sha1":"281ef4a70b11e6042794c89d04a44dd6078ec45b"},"software.amazon.smithy:smithy-protocol-test-traits:1.50.0":{"path":"/Users/mamuller/.m2/repository/software/amazon/smithy/smithy-protocol-test-traits/1.50.0/smithy-protocol-test-traits-1.50.0.jar","sha1":"e3466ac03419a98f33178fa33e3edeafcc3370cb"}}}
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,15 @@
"smithy.api#xmlFlattened",
"smithy.api#xmlName",
"smithy.api#xmlNamespace",
"smithy.protocols#rpcv2Cbor",
"smithy.ruby#skipTests",
"smithy.ruby.protocols#nestedAttributes",
"smithy.ruby.protocols#railsJson",
"smithy.rules#clientContextParams",
"smithy.rules#contextParam",
"smithy.rules#endpointRuleSet",
"smithy.rules#endpointTests",
"smithy.rules#operationContextParams",
"smithy.rules#staticContextParams",
"smithy.test#httpMalformedRequestTests",
"smithy.test#httpRequestTests",
Expand Down Expand Up @@ -157,6 +159,7 @@
"smithy.api#tags",
"smithy.api#title",
"smithy.api#trait",
"smithy.api#traitValidators",
"smithy.api#uniqueItems",
"smithy.api#unitType",
"smithy.api#unstable",
Expand Down
92 changes: 92 additions & 0 deletions example/build/smithy/high-score-service/model/model.json
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,53 @@
"smithy.api#documentation": "Output structure for UpdateHighScore"
}
},
"smithy.protocols#StringList": {
"type": "list",
"member": {
"target": "smithy.api#String"
},
"traits": {
"smithy.api#documentation": "A list of String shapes.",
"smithy.api#private": {}
}
},
"smithy.protocols#rpcv2Cbor": {
"type": "structure",
"members": {
"http": {
"target": "smithy.protocols#StringList",
"traits": {
"smithy.api#documentation": "Priority ordered list of supported HTTP protocol versions."
}
},
"eventStreamHttp": {
"target": "smithy.protocols#StringList",
"traits": {
"smithy.api#documentation": "Priority ordered list of supported HTTP protocol versions\nthat are required when using event streams."
}
}
},
"traits": {
"smithy.api#documentation": "An RPC-based protocol that serializes CBOR payloads.",
"smithy.api#protocolDefinition": {
"traits": [
"smithy.api#cors",
"smithy.api#endpoint",
"smithy.api#hostLabel",
"smithy.api#httpError"
]
},
"smithy.api#trait": {
"selector": "service"
},
"smithy.api#traitValidators": {
"rpcv2Cbor.NoDocuments": {
"selector": "service ~> member :test(> document)",
"message": "This protocol does not support document types"
}
}
}
},
"smithy.ruby#TestType": {
"type": "enum",
"members": {
Expand Down Expand Up @@ -592,6 +639,23 @@
"smithy.api#unstable": {}
}
},
"smithy.rules#OperationContextParamDefinition": {
"type": "structure",
"members": {
"path": {
"target": "smithy.api#String",
"traits": {
"smithy.api#documentation": "a JMESPath expression to select element(s) from the operation input to bind to.",
"smithy.api#required": {}
}
}
},
"traits": {
"smithy.api#documentation": "An operation context parameter definition.",
"smithy.api#private": {},
"smithy.api#unstable": {}
}
},
"smithy.rules#OperationInput": {
"type": "structure",
"members": {
Expand Down Expand Up @@ -778,6 +842,28 @@
"smithy.api#unstable": {}
}
},
"smithy.rules#operationContextParams": {
"type": "map",
"key": {
"target": "smithy.api#String",
"traits": {
"smithy.api#documentation": "The rule-set parameter name."
}
},
"value": {
"target": "smithy.rules#OperationContextParamDefinition",
"traits": {
"smithy.api#documentation": "The static parameter definition."
}
},
"traits": {
"smithy.api#documentation": "Binds one or more named rule-set parameters to elements contained in the operation's input structure.\nThe type of the shapes targeted by the trait MUST match the parameter types defined in the rule-set.",
"smithy.api#trait": {
"selector": "operation"
},
"smithy.api#unstable": {}
}
},
"smithy.rules#staticContextParams": {
"type": "map",
"key": {
Expand Down Expand Up @@ -868,6 +954,12 @@
"traits": {
"smithy.api#documentation": "The HTTP message body to include in the request"
}
},
"bodyMediaType": {
"target": "smithy.api#String",
"traits": {
"smithy.api#documentation": "The media type of the `body`.\n\nThis is used to help test runners to parse and validate the expected\ndata against generated data."
}
}
},
"traits": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Gem::Specification.new do |spec|
spec.author = 'Amazon Web Services'
spec.summary = 'Sample Rails JSON Service'
spec.files = Dir['lib/**/*.rb', 'VERSION']
spec.license = 'Apache-2.0'

spec.required_ruby_version = '>= 3.0'
spec.add_runtime_dependency 'hearth', '~> 1.0.0.pre3'
end
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
require_relative 'high_score_service/params'
require_relative 'high_score_service/parsers'
require_relative 'high_score_service/stubs'
require_relative 'high_score_service/telemetry'
require_relative 'high_score_service/types'
require_relative 'high_score_service/validators'
require_relative 'high_score_service/waiters'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@

module HighScoreService
module Auth
Params = Struct.new(:operation_name, keyword_init: true)
class Params
def initialize(operation_name: nil)
@operation_name = operation_name
end

attr_accessor :operation_name
end

SCHEMES = [
Hearth::AuthSchemes::Anonymous.new
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@ def self.build(http_req, input:)
http_req.append_path('/high_scores')
http_req.headers['Content-Type'] = 'application/json'
data = {}
data[:high_score] = Builders::HighScoreParams.build(input[:high_score]) unless input[:high_score].nil?
data[:high_score] = Builders::HighScoreParams.build(input.high_score) unless input.high_score.nil?
http_req.body = StringIO.new(Hearth::JSON.dump(data))
end
end

class DeleteHighScore
def self.build(http_req, input:)
http_req.http_method = 'DELETE'
if input[:id].to_s.empty?
if input.id.to_s.empty?
raise ArgumentError, "HTTP label :id cannot be empty."
end
http_req.append_path(format(
'/high_scores/%<id>s',
id: Hearth::HTTP.uri_escape(input[:id].to_s)
id: Hearth::HTTP.uri_escape(input.id.to_s)
)
)
end
Expand All @@ -39,12 +39,12 @@ def self.build(http_req, input:)
class GetHighScore
def self.build(http_req, input:)
http_req.http_method = 'GET'
if input[:id].to_s.empty?
if input.id.to_s.empty?
raise ArgumentError, "HTTP label :id cannot be empty."
end
http_req.append_path(format(
'/high_scores/%<id>s',
id: Hearth::HTTP.uri_escape(input[:id].to_s)
id: Hearth::HTTP.uri_escape(input.id.to_s)
)
)
end
Expand All @@ -53,8 +53,8 @@ def self.build(http_req, input:)
class HighScoreParams
def self.build(input)
data = {}
data[:game] = input[:game] unless input[:game].nil?
data[:score] = input[:score] unless input[:score].nil?
data[:game] = input.game unless input.game.nil?
data[:score] = input.score unless input.score.nil?
data
end
end
Expand All @@ -69,17 +69,17 @@ def self.build(http_req, input:)
class UpdateHighScore
def self.build(http_req, input:)
http_req.http_method = 'PUT'
if input[:id].to_s.empty?
if input.id.to_s.empty?
raise ArgumentError, "HTTP label :id cannot be empty."
end
http_req.append_path(format(
'/high_scores/%<id>s',
id: Hearth::HTTP.uri_escape(input[:id].to_s)
id: Hearth::HTTP.uri_escape(input.id.to_s)
)
)
http_req.headers['Content-Type'] = 'application/json'
data = {}
data[:high_score] = Builders::HighScoreParams.build(input[:high_score]) unless input[:high_score].nil?
data[:high_score] = Builders::HighScoreParams.build(input.high_score) unless input.high_score.nil?
http_req.body = StringIO.new(Hearth::JSON.dump(data))
end
end
Expand Down
Loading

0 comments on commit d80b6cb

Please sign in to comment.