module Cucumber
  module Messages
  <%- @schemas.sort.each do |key, schema| %>

    ##
    # Represents the <%= class_name(key) %> message in Cucumber's {message protocol}[https://github.com/cucumber/common/tree/main/messages#readme].
    #
    <%= format_description(schema['description']) %>
    #
    # The code was auto-generated by {this script}[https://github.com/cucumber/common/blob/main/messages/jsonschema/scripts/codegen.rb]
    #

    class <%= class_name(key) %>
    <%- schema['properties'].each do |property_name, property| -%>
      attr_reader :<%= property_name %>
    <%- end -%>

      def initialize(
      <%- schema['properties'].each do |property_name, property| -%>
        <%= property_name -%>: <%=
          (schema['required'] || []).index(property_name) ?
            default_value(class_name(key), property_name, property) :
            'nil'
          -%><%= property_name == schema['properties'].keys.last ? '' : ',' %>
      <%- end -%>
      )
      <%- schema['properties'].each do |property_name, property| -%>
        @<%= property_name %> = <%= property_name %>
      <%- end -%>
      end
    end
  <%- end %>
  end
end

module Cucumber
  module Messages
  <%- @schemas.sort.each do |key, schema| %>

    ##
    # Represents the <%= class_name(key) %> message in Cucumber's {message protocol}[https://github.com/cucumber/common/tree/main/messages#readme].
    #
    <%= format_description(schema['description']) %>
    #
    # The code was auto-generated by {this script}[https://github.com/cucumber/common/blob/main/messages/jsonschema/scripts/codegen.rb]
    #

    class <%= class_name(key) %>
    <%- schema['properties'].each do |property_name, property| -%>

      <%- if property['description'] -%>
      ##
      <%= format_description(property['description'], indent_string: '      ') %>

      <%- end -%>
      attr_reader :<%= property_name %>
    <%- end -%>

      def initialize(
      <%- schema['properties'].each do |property_name, property| -%>
        <%= property_name -%>: <%=
          (schema['required'] || []).index(property_name) ?
            default_value(class_name(key), property_name, property) :
            'nil'
          -%><%= property_name == schema['properties'].keys.last ? '' : ',' %>
      <%- end -%>
      )
      <%- schema['properties'].each do |property_name, property| -%>
        @<%= property_name %> = <%= property_name %>
      <%- end -%>
      end
    end
  <%- end %>
  end
end

Add rdoc on Ruby DTOs attributes
Add rdoc on Ruby DTOs attributes
