Skip to content

Ruby generator: multiline x-deprecated-reason emits invalid types.rb (latent) #420

Description

@jeremy

Follow-up from a resolved bot thread on #412 (discussion), filed for durable tracking.

Defect (latent / currently dormant)

ruby/scripts/generate-types.rb emits deprecation reasons on a single comment line:

puts "    # @deprecated #{schema['x-deprecated-reason'] || 'deprecated'}"
# ...and the per-attribute path:
puts "      #   @deprecated #{ps['x-deprecated-reason'] || 'deprecated'}"

If an x-deprecated-reason ever contains a newline, puts writes the later lines as bare Ruby source, producing a syntactically invalid types.rb. The reason is derived from OpenAPI descriptions without collapsing line breaks, so a multiline description would trigger this.

Why it isn't biting today

Scanned openapi.json: zero x-deprecated-reason values currently contain a newline, so rb-generate/rb-check are green. This is a robustness gap, not an active break.

Fix

Split the reason on \n and prefix every line with the comment leader (# / # @deprecated for the first, # for continuations), mirroring the Swift generator's deprecationDocLines treatment (added in #406). Add a generator unit test feeding a multiline reason.

Low priority — hardening only.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions