Skip to content
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions bin/generate_s2_messages
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env ruby

require "json"

Dir.glob("lib/s2/s2-json-schema/**/*.schema.json").each do |file|
json = JSON.parse(File.read(file))
json["type"] ||= "object" unless json["enum"]
File.write(file, JSON.pretty_generate(json, indent: " "))
end

`npx -y quicktype -s schema lib/s2/s2-json-schema/{schemas,messages}/*.schema.json -l ruby --namespace S2::Messages -o lib/s2/messages.rb`
4 changes: 2 additions & 2 deletions lib/s2/message_handler/error_handling.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ module S2::MessageHandler::ErrorHandling
rescue_from S2::MessageFactory::MissingMessageType,
S2::MessageFactory::InvalidMessagePayload,
S2::MessageFactory::UnsupportedMessageType do |error|
reply to: error.message_id, status: :invalid_message, diagnostic_label: error.message
end
reply to: error.message_id, status: :invalid_message, diagnostic_label: error.message
end

rescue_from S2::MessageHandler::Dispatching::HandlerNotFound do |_error|
reply to: nil,
Expand Down
Loading