Skip to content
Merged
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
4 changes: 3 additions & 1 deletion ruby/scripts/generate-metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class MetadataExtractor
METHODS = %w[get post put patch delete].freeze

def initialize(openapi_path)
@openapi = JSON.parse(File.read(openapi_path))
# Read as UTF-8 regardless of process locale (LC_ALL=C would otherwise read
# as US-ASCII and JSON.parse dies on the spec's multibyte characters)
@openapi = JSON.parse(File.read(openapi_path, encoding: 'UTF-8'))
end

def extract
Expand Down
3 changes: 2 additions & 1 deletion ruby/scripts/generate-services.rb
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,8 @@ def download(upload_id:)
].freeze

def initialize(openapi_path)
@openapi = JSON.parse(File.read(openapi_path))
# UTF-8 regardless of process locale — see generate-metadata.rb
@openapi = JSON.parse(File.read(openapi_path, encoding: 'UTF-8'))
@schemas = @openapi.dig('components', 'schemas') || {}
end

Expand Down
3 changes: 2 additions & 1 deletion ruby/scripts/generate-types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def deprecation_doc_lines(reason, indent:, tag_prefix: '')
puts ' module Types'
puts ' include TypeHelpers'

schemas = JSON.parse(File.read(openapi_path))['components']['schemas'] || {}
# UTF-8 regardless of process locale — see generate-metadata.rb
schemas = JSON.parse(File.read(openapi_path, encoding: 'UTF-8'))['components']['schemas'] || {}
sorted = schemas.keys.sort

sorted.each do |name|
Expand Down