cucumber-messages 24.0.1 → 25.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (79) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/lib/cucumber/messages/attachment.rb +126 -0
  4. data/lib/cucumber/messages/attachment_content_encoding.rb +11 -0
  5. data/lib/cucumber/messages/background.rb +64 -0
  6. data/lib/cucumber/messages/ci.rb +62 -0
  7. data/lib/cucumber/messages/comment.rb +50 -0
  8. data/lib/cucumber/messages/data_table.rb +41 -0
  9. data/lib/cucumber/messages/doc_string.rb +51 -0
  10. data/lib/cucumber/messages/duration.rb +50 -0
  11. data/lib/cucumber/messages/envelope.rb +124 -0
  12. data/lib/cucumber/messages/examples.rb +74 -0
  13. data/lib/cucumber/messages/exception.rb +57 -0
  14. data/lib/cucumber/messages/feature.rb +87 -0
  15. data/lib/cucumber/messages/feature_child.rb +49 -0
  16. data/lib/cucumber/messages/gherkin_document.rb +62 -0
  17. data/lib/cucumber/messages/git.rb +54 -0
  18. data/lib/cucumber/messages/group.rb +46 -0
  19. data/lib/cucumber/messages/helpers/id_generator/incrementing.rb +20 -0
  20. data/lib/cucumber/messages/helpers/id_generator/uuid.rb +17 -0
  21. data/lib/cucumber/messages/helpers/id_generator.rb +4 -0
  22. data/lib/cucumber/messages/helpers/ndjson_to_message_enumerator.rb +30 -0
  23. data/lib/cucumber/messages/helpers/time_conversion.rb +31 -0
  24. data/lib/cucumber/messages/hook.rb +51 -0
  25. data/lib/cucumber/messages/java_method.rb +46 -0
  26. data/lib/cucumber/messages/java_stack_trace_element.rb +46 -0
  27. data/lib/cucumber/messages/location.rb +44 -0
  28. data/lib/cucumber/messages/message.rb +92 -4
  29. data/lib/cucumber/messages/meta.rb +81 -0
  30. data/lib/cucumber/messages/parameter_type.rb +64 -0
  31. data/lib/cucumber/messages/parse_error.rb +41 -0
  32. data/lib/cucumber/messages/pickle.rb +107 -0
  33. data/lib/cucumber/messages/pickle_doc_string.rb +41 -0
  34. data/lib/cucumber/messages/pickle_step.rb +71 -0
  35. data/lib/cucumber/messages/pickle_step_argument.rb +43 -0
  36. data/lib/cucumber/messages/pickle_step_type.rb +13 -0
  37. data/lib/cucumber/messages/pickle_table.rb +36 -0
  38. data/lib/cucumber/messages/pickle_table_cell.rb +36 -0
  39. data/lib/cucumber/messages/pickle_table_row.rb +36 -0
  40. data/lib/cucumber/messages/pickle_tag.rb +47 -0
  41. data/lib/cucumber/messages/product.rb +49 -0
  42. data/lib/cucumber/messages/rule.rb +72 -0
  43. data/lib/cucumber/messages/rule_child.rb +44 -0
  44. data/lib/cucumber/messages/scenario.rb +74 -0
  45. data/lib/cucumber/messages/source.rb +63 -0
  46. data/lib/cucumber/messages/source_media_type.rb +11 -0
  47. data/lib/cucumber/messages/source_reference.rb +55 -0
  48. data/lib/cucumber/messages/step.rb +80 -0
  49. data/lib/cucumber/messages/step_definition.rb +46 -0
  50. data/lib/cucumber/messages/step_definition_pattern.rb +41 -0
  51. data/lib/cucumber/messages/step_definition_pattern_type.rb +11 -0
  52. data/lib/cucumber/messages/step_keyword_type.rb +14 -0
  53. data/lib/cucumber/messages/step_match_argument.rb +54 -0
  54. data/lib/cucumber/messages/step_match_arguments_list.rb +36 -0
  55. data/lib/cucumber/messages/table_cell.rb +49 -0
  56. data/lib/cucumber/messages/table_row.rb +54 -0
  57. data/lib/cucumber/messages/tag.rb +58 -0
  58. data/lib/cucumber/messages/test_case.rb +54 -0
  59. data/lib/cucumber/messages/test_case_finished.rb +46 -0
  60. data/lib/cucumber/messages/test_case_started.rb +69 -0
  61. data/lib/cucumber/messages/test_run_finished.rb +63 -0
  62. data/lib/cucumber/messages/test_run_started.rb +36 -0
  63. data/lib/cucumber/messages/test_step.rb +74 -0
  64. data/lib/cucumber/messages/test_step_finished.rb +51 -0
  65. data/lib/cucumber/messages/test_step_result.rb +57 -0
  66. data/lib/cucumber/messages/test_step_result_status.rb +16 -0
  67. data/lib/cucumber/messages/test_step_started.rb +46 -0
  68. data/lib/cucumber/messages/timestamp.rb +52 -0
  69. data/lib/cucumber/messages/undefined_parameter_type.rb +41 -0
  70. data/lib/cucumber/messages.rb +9 -5
  71. metadata +110 -30
  72. data/lib/cucumber/messages/id_generator.rb +0 -24
  73. data/lib/cucumber/messages/message/deserialization.rb +0 -37
  74. data/lib/cucumber/messages/message/serialization.rb +0 -70
  75. data/lib/cucumber/messages/message/utils.rb +0 -45
  76. data/lib/cucumber/messages/ndjson_to_message_enumerator.rb +0 -21
  77. data/lib/cucumber/messages/time_conversion.rb +0 -33
  78. data/lib/cucumber/messages.deserializers.rb +0 -1208
  79. data/lib/cucumber/messages.dtos.rb +0 -1782
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91761b02653e0190badad2d2f4f866be44156fa55e137e1f0e8996884147c352
4
- data.tar.gz: af4ee066387e8d222bf12a361ec8cfcd78eb16842c057ee94814ca085539f643
3
+ metadata.gz: 5503bb8b808557151373a4c743bb3c2505045ee76eb90ecb89024910a6716fa3
4
+ data.tar.gz: 85161d88c9aed19bb5079b65c19c64b0e095dd498d5c165f07f459e9a530bf5c
5
5
  SHA512:
6
- metadata.gz: f58ec87b8e6df87590fc43278d6aadac90951429190de29d8d5360b38b01d0ccd5ef08c24c7bd54066d321ce11fd3f23c89d0b9a193a50825954a34dd07625f4
7
- data.tar.gz: f0e8fa7d114cfc024513c80ca63e312ab8cefa6b28c8d5d78f18385891f16b479f53c0908b0e7c49efd1e5e79159cdd1299cbf313e710426967f48c088566179
6
+ metadata.gz: 3d44796653824c23b69f9b492a78991c265335ac245e4f919f89fa80bd30a9c3d695ab7b2c23a187378310c21497cbaad642c5678c8df5d2309afcd339a4794d
7
+ data.tar.gz: 5b5bfa76bec9f68083a8027ecd3124bf31604d8e1cb13c468fca8a334cd3466dc7793c97a23d4f34360ed3b367da5269cc179207fa610f43728606f19df6b3ec
data/VERSION CHANGED
@@ -1 +1 @@
1
- 24.0.1
1
+ 25.0.0
@@ -0,0 +1,126 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Attachment message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # //// Attachments (parse errors, execution errors, screenshots, links...)
11
+ #
12
+ # *
13
+ # An attachment represents any kind of data associated with a line in a
14
+ # [Source](#io.cucumber.messages.Source) file. It can be used for:
15
+ #
16
+ # * Syntax errors during parse time
17
+ # * Screenshots captured and attached during execution
18
+ # * Logs captured and attached during execution
19
+ #
20
+ # It is not to be used for runtime errors raised/thrown during execution. This
21
+ # is captured in `TestResult`.
22
+ ##
23
+ class Attachment < Message
24
+ ##
25
+ # *
26
+ # The body of the attachment. If `contentEncoding` is `IDENTITY`, the attachment
27
+ # is simply the string. If it's `BASE64`, the string should be Base64 decoded to
28
+ # obtain the attachment.
29
+ ##
30
+ attr_reader :body
31
+
32
+ ##
33
+ # *
34
+ # Whether to interpret `body` "as-is" (IDENTITY) or if it needs to be Base64-decoded (BASE64).
35
+ #
36
+ # Content encoding is *not* determined by the media type, but rather by the type
37
+ # of the object being attached:
38
+ #
39
+ # - string: IDENTITY
40
+ # - byte array: BASE64
41
+ # - stream: BASE64
42
+ ##
43
+ attr_reader :content_encoding
44
+
45
+ ##
46
+ # *
47
+ # Suggested file name of the attachment. (Provided by the user as an argument to `attach`)
48
+ ##
49
+ attr_reader :file_name
50
+
51
+ ##
52
+ # *
53
+ # The media type of the data. This can be any valid
54
+ # [IANA Media Type](https://www.iana.org/assignments/media-types/media-types.xhtml)
55
+ # as well as Cucumber-specific media types such as `text/x.cucumber.gherkin+plain`
56
+ # and `text/x.cucumber.stacktrace+plain`
57
+ ##
58
+ attr_reader :media_type
59
+
60
+ attr_reader :source
61
+
62
+ attr_reader :test_case_started_id
63
+
64
+ attr_reader :test_step_id
65
+
66
+ ##
67
+ # *
68
+ # A URL where the attachment can be retrieved. This field should not be set by Cucumber.
69
+ # It should be set by a program that reads a message stream and does the following for
70
+ # each Attachment message:
71
+ #
72
+ # - Writes the body (after base64 decoding if necessary) to a new file.
73
+ # - Sets `body` and `contentEncoding` to `null`
74
+ # - Writes out the new attachment message
75
+ #
76
+ # This will result in a smaller message stream, which can improve performance and
77
+ # reduce bandwidth of message consumers. It also makes it easier to process and download attachments
78
+ # separately from reports.
79
+ ##
80
+ attr_reader :url
81
+
82
+ def initialize(
83
+ body: '',
84
+ content_encoding: AttachmentContentEncoding::IDENTITY,
85
+ file_name: nil,
86
+ media_type: '',
87
+ source: nil,
88
+ test_case_started_id: nil,
89
+ test_step_id: nil,
90
+ url: nil
91
+ )
92
+ @body = body
93
+ @content_encoding = content_encoding
94
+ @file_name = file_name
95
+ @media_type = media_type
96
+ @source = source
97
+ @test_case_started_id = test_case_started_id
98
+ @test_step_id = test_step_id
99
+ @url = url
100
+ super()
101
+ end
102
+
103
+ ##
104
+ # Returns a new Attachment from the given hash.
105
+ # If the hash keys are camelCased, they are properly assigned to the
106
+ # corresponding snake_cased attributes.
107
+ #
108
+ # Cucumber::Messages::Attachment.from_h(some_hash) # => #<Cucumber::Messages::Attachment:0x... ...>
109
+ ##
110
+ def self.from_h(hash)
111
+ return nil if hash.nil?
112
+
113
+ new(
114
+ body: hash[:body],
115
+ content_encoding: hash[:contentEncoding],
116
+ file_name: hash[:fileName],
117
+ media_type: hash[:mediaType],
118
+ source: Source.from_h(hash[:source]),
119
+ test_case_started_id: hash[:testCaseStartedId],
120
+ test_step_id: hash[:testStepId],
121
+ url: hash[:url]
122
+ )
123
+ end
124
+ end
125
+ end
126
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ class AttachmentContentEncoding
7
+ IDENTITY = 'IDENTITY'
8
+ BASE64 = 'BASE64'
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,64 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Background message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class Background < Message
11
+ ##
12
+ # The location of the `Background` keyword
13
+ ##
14
+ attr_reader :location
15
+
16
+ attr_reader :keyword
17
+
18
+ attr_reader :name
19
+
20
+ attr_reader :description
21
+
22
+ attr_reader :steps
23
+
24
+ attr_reader :id
25
+
26
+ def initialize(
27
+ location: Location.new,
28
+ keyword: '',
29
+ name: '',
30
+ description: '',
31
+ steps: [],
32
+ id: ''
33
+ )
34
+ @location = location
35
+ @keyword = keyword
36
+ @name = name
37
+ @description = description
38
+ @steps = steps
39
+ @id = id
40
+ super()
41
+ end
42
+
43
+ ##
44
+ # Returns a new Background from the given hash.
45
+ # If the hash keys are camelCased, they are properly assigned to the
46
+ # corresponding snake_cased attributes.
47
+ #
48
+ # Cucumber::Messages::Background.from_h(some_hash) # => #<Cucumber::Messages::Background:0x... ...>
49
+ ##
50
+ def self.from_h(hash)
51
+ return nil if hash.nil?
52
+
53
+ new(
54
+ location: Location.from_h(hash[:location]),
55
+ keyword: hash[:keyword],
56
+ name: hash[:name],
57
+ description: hash[:description],
58
+ steps: hash[:steps]&.map { |item| Step.from_h(item) },
59
+ id: hash[:id]
60
+ )
61
+ end
62
+ end
63
+ end
64
+ end
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Ci message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # CI environment
11
+ ##
12
+ class Ci < Message
13
+ ##
14
+ # Name of the CI product, e.g. "Jenkins", "CircleCI" etc.
15
+ ##
16
+ attr_reader :name
17
+
18
+ ##
19
+ # Link to the build
20
+ ##
21
+ attr_reader :url
22
+
23
+ ##
24
+ # The build number. Some CI servers use non-numeric build numbers, which is why this is a string
25
+ ##
26
+ attr_reader :build_number
27
+
28
+ attr_reader :git
29
+
30
+ def initialize(
31
+ name: '',
32
+ url: nil,
33
+ build_number: nil,
34
+ git: nil
35
+ )
36
+ @name = name
37
+ @url = url
38
+ @build_number = build_number
39
+ @git = git
40
+ super()
41
+ end
42
+
43
+ ##
44
+ # Returns a new Ci from the given hash.
45
+ # If the hash keys are camelCased, they are properly assigned to the
46
+ # corresponding snake_cased attributes.
47
+ #
48
+ # Cucumber::Messages::Ci.from_h(some_hash) # => #<Cucumber::Messages::Ci:0x... ...>
49
+ ##
50
+ def self.from_h(hash)
51
+ return nil if hash.nil?
52
+
53
+ new(
54
+ name: hash[:name],
55
+ url: hash[:url],
56
+ build_number: hash[:buildNumber],
57
+ git: Git.from_h(hash[:git])
58
+ )
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Comment message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # *
11
+ # A comment in a Gherkin document
12
+ ##
13
+ class Comment < Message
14
+ ##
15
+ # The location of the comment
16
+ ##
17
+ attr_reader :location
18
+
19
+ ##
20
+ # The text of the comment
21
+ ##
22
+ attr_reader :text
23
+
24
+ def initialize(
25
+ location: Location.new,
26
+ text: ''
27
+ )
28
+ @location = location
29
+ @text = text
30
+ super()
31
+ end
32
+
33
+ ##
34
+ # Returns a new Comment from the given hash.
35
+ # If the hash keys are camelCased, they are properly assigned to the
36
+ # corresponding snake_cased attributes.
37
+ #
38
+ # Cucumber::Messages::Comment.from_h(some_hash) # => #<Cucumber::Messages::Comment:0x... ...>
39
+ ##
40
+ def self.from_h(hash)
41
+ return nil if hash.nil?
42
+
43
+ new(
44
+ location: Location.from_h(hash[:location]),
45
+ text: hash[:text]
46
+ )
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,41 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the DataTable message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class DataTable < Message
11
+ attr_reader :location
12
+
13
+ attr_reader :rows
14
+
15
+ def initialize(
16
+ location: Location.new,
17
+ rows: []
18
+ )
19
+ @location = location
20
+ @rows = rows
21
+ super()
22
+ end
23
+
24
+ ##
25
+ # Returns a new DataTable from the given hash.
26
+ # If the hash keys are camelCased, they are properly assigned to the
27
+ # corresponding snake_cased attributes.
28
+ #
29
+ # Cucumber::Messages::DataTable.from_h(some_hash) # => #<Cucumber::Messages::DataTable:0x... ...>
30
+ ##
31
+ def self.from_h(hash)
32
+ return nil if hash.nil?
33
+
34
+ new(
35
+ location: Location.from_h(hash[:location]),
36
+ rows: hash[:rows]&.map { |item| TableRow.from_h(item) }
37
+ )
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the DocString message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class DocString < Message
11
+ attr_reader :location
12
+
13
+ attr_reader :media_type
14
+
15
+ attr_reader :content
16
+
17
+ attr_reader :delimiter
18
+
19
+ def initialize(
20
+ location: Location.new,
21
+ media_type: nil,
22
+ content: '',
23
+ delimiter: ''
24
+ )
25
+ @location = location
26
+ @media_type = media_type
27
+ @content = content
28
+ @delimiter = delimiter
29
+ super()
30
+ end
31
+
32
+ ##
33
+ # Returns a new DocString from the given hash.
34
+ # If the hash keys are camelCased, they are properly assigned to the
35
+ # corresponding snake_cased attributes.
36
+ #
37
+ # Cucumber::Messages::DocString.from_h(some_hash) # => #<Cucumber::Messages::DocString:0x... ...>
38
+ ##
39
+ def self.from_h(hash)
40
+ return nil if hash.nil?
41
+
42
+ new(
43
+ location: Location.from_h(hash[:location]),
44
+ media_type: hash[:mediaType],
45
+ content: hash[:content],
46
+ delimiter: hash[:delimiter]
47
+ )
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Duration message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # The structure is pretty close of the Timestamp one. For clarity, a second type
11
+ # of message is used.
12
+ ##
13
+ class Duration < Message
14
+ attr_reader :seconds
15
+
16
+ ##
17
+ # Non-negative fractions of a second at nanosecond resolution. Negative
18
+ # second values with fractions must still have non-negative nanos values
19
+ # that count forward in time. Must be from 0 to 999,999,999
20
+ # inclusive.
21
+ ##
22
+ attr_reader :nanos
23
+
24
+ def initialize(
25
+ seconds: 0,
26
+ nanos: 0
27
+ )
28
+ @seconds = seconds
29
+ @nanos = nanos
30
+ super()
31
+ end
32
+
33
+ ##
34
+ # Returns a new Duration from the given hash.
35
+ # If the hash keys are camelCased, they are properly assigned to the
36
+ # corresponding snake_cased attributes.
37
+ #
38
+ # Cucumber::Messages::Duration.from_h(some_hash) # => #<Cucumber::Messages::Duration:0x... ...>
39
+ ##
40
+ def self.from_h(hash)
41
+ return nil if hash.nil?
42
+
43
+ new(
44
+ seconds: hash[:seconds],
45
+ nanos: hash[:nanos]
46
+ )
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,124 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Envelope message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ #
10
+ # When removing a field, replace it with reserved, rather than deleting the line.
11
+ # When adding a field, add it to the end and increment the number by one.
12
+ # See https://developers.google.com/protocol-buffers/docs/proto#updating for details
13
+ #
14
+ # *
15
+ # All the messages that are passed between different components/processes are Envelope
16
+ # messages.
17
+ ##
18
+ class Envelope < Message
19
+ attr_reader :attachment
20
+
21
+ attr_reader :gherkin_document
22
+
23
+ attr_reader :hook
24
+
25
+ attr_reader :meta
26
+
27
+ attr_reader :parameter_type
28
+
29
+ attr_reader :parse_error
30
+
31
+ attr_reader :pickle
32
+
33
+ attr_reader :source
34
+
35
+ attr_reader :step_definition
36
+
37
+ attr_reader :test_case
38
+
39
+ attr_reader :test_case_finished
40
+
41
+ attr_reader :test_case_started
42
+
43
+ attr_reader :test_run_finished
44
+
45
+ attr_reader :test_run_started
46
+
47
+ attr_reader :test_step_finished
48
+
49
+ attr_reader :test_step_started
50
+
51
+ attr_reader :undefined_parameter_type
52
+
53
+ def initialize(
54
+ attachment: nil,
55
+ gherkin_document: nil,
56
+ hook: nil,
57
+ meta: nil,
58
+ parameter_type: nil,
59
+ parse_error: nil,
60
+ pickle: nil,
61
+ source: nil,
62
+ step_definition: nil,
63
+ test_case: nil,
64
+ test_case_finished: nil,
65
+ test_case_started: nil,
66
+ test_run_finished: nil,
67
+ test_run_started: nil,
68
+ test_step_finished: nil,
69
+ test_step_started: nil,
70
+ undefined_parameter_type: nil
71
+ )
72
+ @attachment = attachment
73
+ @gherkin_document = gherkin_document
74
+ @hook = hook
75
+ @meta = meta
76
+ @parameter_type = parameter_type
77
+ @parse_error = parse_error
78
+ @pickle = pickle
79
+ @source = source
80
+ @step_definition = step_definition
81
+ @test_case = test_case
82
+ @test_case_finished = test_case_finished
83
+ @test_case_started = test_case_started
84
+ @test_run_finished = test_run_finished
85
+ @test_run_started = test_run_started
86
+ @test_step_finished = test_step_finished
87
+ @test_step_started = test_step_started
88
+ @undefined_parameter_type = undefined_parameter_type
89
+ super()
90
+ end
91
+
92
+ ##
93
+ # Returns a new Envelope from the given hash.
94
+ # If the hash keys are camelCased, they are properly assigned to the
95
+ # corresponding snake_cased attributes.
96
+ #
97
+ # Cucumber::Messages::Envelope.from_h(some_hash) # => #<Cucumber::Messages::Envelope:0x... ...>
98
+ ##
99
+ def self.from_h(hash)
100
+ return nil if hash.nil?
101
+
102
+ new(
103
+ attachment: Attachment.from_h(hash[:attachment]),
104
+ gherkin_document: GherkinDocument.from_h(hash[:gherkinDocument]),
105
+ hook: Hook.from_h(hash[:hook]),
106
+ meta: Meta.from_h(hash[:meta]),
107
+ parameter_type: ParameterType.from_h(hash[:parameterType]),
108
+ parse_error: ParseError.from_h(hash[:parseError]),
109
+ pickle: Pickle.from_h(hash[:pickle]),
110
+ source: Source.from_h(hash[:source]),
111
+ step_definition: StepDefinition.from_h(hash[:stepDefinition]),
112
+ test_case: TestCase.from_h(hash[:testCase]),
113
+ test_case_finished: TestCaseFinished.from_h(hash[:testCaseFinished]),
114
+ test_case_started: TestCaseStarted.from_h(hash[:testCaseStarted]),
115
+ test_run_finished: TestRunFinished.from_h(hash[:testRunFinished]),
116
+ test_run_started: TestRunStarted.from_h(hash[:testRunStarted]),
117
+ test_step_finished: TestStepFinished.from_h(hash[:testStepFinished]),
118
+ test_step_started: TestStepStarted.from_h(hash[:testStepStarted]),
119
+ undefined_parameter_type: UndefinedParameterType.from_h(hash[:undefinedParameterType])
120
+ )
121
+ end
122
+ end
123
+ end
124
+ end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ # The code was auto-generated by {this script}[https://github.com/cucumber/messages/blob/main/jsonschema/scripts/codegen.rb]
4
+ module Cucumber
5
+ module Messages
6
+ ##
7
+ # Represents the Examples message in Cucumber's {message protocol}[https://github.com/cucumber/messages].
8
+ ##
9
+ ##
10
+ class Examples < Message
11
+ ##
12
+ # The location of the `Examples` keyword
13
+ ##
14
+ attr_reader :location
15
+
16
+ attr_reader :tags
17
+
18
+ attr_reader :keyword
19
+
20
+ attr_reader :name
21
+
22
+ attr_reader :description
23
+
24
+ attr_reader :table_header
25
+
26
+ attr_reader :table_body
27
+
28
+ attr_reader :id
29
+
30
+ def initialize(
31
+ location: Location.new,
32
+ tags: [],
33
+ keyword: '',
34
+ name: '',
35
+ description: '',
36
+ table_header: nil,
37
+ table_body: [],
38
+ id: ''
39
+ )
40
+ @location = location
41
+ @tags = tags
42
+ @keyword = keyword
43
+ @name = name
44
+ @description = description
45
+ @table_header = table_header
46
+ @table_body = table_body
47
+ @id = id
48
+ super()
49
+ end
50
+
51
+ ##
52
+ # Returns a new Examples from the given hash.
53
+ # If the hash keys are camelCased, they are properly assigned to the
54
+ # corresponding snake_cased attributes.
55
+ #
56
+ # Cucumber::Messages::Examples.from_h(some_hash) # => #<Cucumber::Messages::Examples:0x... ...>
57
+ ##
58
+ def self.from_h(hash)
59
+ return nil if hash.nil?
60
+
61
+ new(
62
+ location: Location.from_h(hash[:location]),
63
+ tags: hash[:tags]&.map { |item| Tag.from_h(item) },
64
+ keyword: hash[:keyword],
65
+ name: hash[:name],
66
+ description: hash[:description],
67
+ table_header: TableRow.from_h(hash[:tableHeader]),
68
+ table_body: hash[:tableBody]&.map { |item| TableRow.from_h(item) },
69
+ id: hash[:id]
70
+ )
71
+ end
72
+ end
73
+ end
74
+ end