~bigbes/tarantool

tarantool-protobuf

ref: b75b87912eb710e71f73380e6b98c312f25a74d5 tarantool-protobuf/examples/expected/runtime/conformance/conformance_pb.lua -rw-r--r-- 8.0 KiB
b75b8791 — Eugene Blikh codegen: EmmyLua type annotations for messages, enums, wrappers 3 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
-- Code generated by protoc-gen-tarantool. DO NOT EDIT.
-- source: conformance.proto
-- syntax: proto3
-- package: conformance

local pb = require("pb")
local wire = pb.wire

local M = {}

-- Enum: conformance.WireFormat
M.WireFormat_descriptor = pb.enum("conformance.WireFormat", {
    UNSPECIFIED = 0,
    PROTOBUF = 1,
    JSON = 2,
    JSPB = 3,
    TEXT_FORMAT = 4,
})
M.WireFormat = M.WireFormat_descriptor.by_name

-- Enum: conformance.TestCategory
M.TestCategory_descriptor = pb.enum("conformance.TestCategory", {
    UNSPECIFIED_TEST = 0,
    BINARY_TEST = 1,
    JSON_TEST = 2,
    JSON_IGNORE_UNKNOWN_PARSING_TEST = 3,
    JSPB_TEST = 4,
    TEXT_FORMAT_TEST = 5,
})
M.TestCategory = M.TestCategory_descriptor.by_name

-- Pre-declare message descriptors so cross-references resolve.
M.TestStatus_descriptor = {name = "conformance.TestStatus"}
M.FailureSet_descriptor = {name = "conformance.FailureSet"}
M.ConformanceRequest_descriptor = {name = "conformance.ConformanceRequest"}
M.ConformanceResponse_descriptor = {name = "conformance.ConformanceResponse"}
M.JspbEncodingConfig_descriptor = {name = "conformance.JspbEncodingConfig"}

-- Message: conformance.TestStatus
M.TestStatus_descriptor.fields = {
    {name="name", id=1, kind='scalar', proto_type="string"},
    {name="failure_message", id=2, kind='scalar', proto_type="string"},
    {name="matched_name", id=3, kind='scalar', proto_type="string"},
}
pb.finalize_message(M.TestStatus_descriptor)

-- Message: conformance.FailureSet
M.FailureSet_descriptor.fields = {
    {name="test", id=2, kind='message', message=M.TestStatus_descriptor, repeated=true},
}
pb.finalize_message(M.FailureSet_descriptor)

-- Message: conformance.ConformanceRequest
M.ConformanceRequest_descriptor.fields = {
    {name="protobuf_payload", id=1, kind='scalar', proto_type="bytes", oneof="payload"},
    {name="json_payload", id=2, kind='scalar', proto_type="string", oneof="payload"},
    {name="jspb_payload", id=7, kind='scalar', proto_type="string", oneof="payload"},
    {name="text_payload", id=8, kind='scalar', proto_type="string", oneof="payload"},
    {name="requested_output_format", id=3, kind='enum', enum=M.WireFormat_descriptor},
    {name="message_type", id=4, kind='scalar', proto_type="string"},
    {name="test_category", id=5, kind='enum', enum=M.TestCategory_descriptor},
    {name="jspb_encoding_options", id=6, kind='message', message=M.JspbEncodingConfig_descriptor},
    {name="print_unknown_fields", id=9, kind='scalar', proto_type="bool"},
}
M.ConformanceRequest_descriptor.oneofs = {
    payload = {"protobuf_payload", "json_payload", "jspb_payload", "text_payload"},
}
pb.finalize_message(M.ConformanceRequest_descriptor)

-- Message: conformance.ConformanceResponse
M.ConformanceResponse_descriptor.fields = {
    {name="parse_error", id=1, kind='scalar', proto_type="string", oneof="result"},
    {name="serialize_error", id=6, kind='scalar', proto_type="string", oneof="result"},
    {name="timeout_error", id=9, kind='scalar', proto_type="string", oneof="result"},
    {name="runtime_error", id=2, kind='scalar', proto_type="string", oneof="result"},
    {name="protobuf_payload", id=3, kind='scalar', proto_type="bytes", oneof="result"},
    {name="json_payload", id=4, kind='scalar', proto_type="string", oneof="result"},
    {name="skipped", id=5, kind='scalar', proto_type="string", oneof="result"},
    {name="jspb_payload", id=7, kind='scalar', proto_type="string", oneof="result"},
    {name="text_payload", id=8, kind='scalar', proto_type="string", oneof="result"},
}
M.ConformanceResponse_descriptor.oneofs = {
    result = {"parse_error", "serialize_error", "timeout_error", "runtime_error", "protobuf_payload", "json_payload", "skipped", "jspb_payload", "text_payload"},
}
pb.finalize_message(M.ConformanceResponse_descriptor)

-- Message: conformance.JspbEncodingConfig
M.JspbEncodingConfig_descriptor.fields = {
    {name="use_jspb_array_any_format", id=1, kind='scalar', proto_type="bool"},
}
pb.finalize_message(M.JspbEncodingConfig_descriptor)

-- EmmyLua / lua-language-server type annotations.
-- These are comments — no runtime effect. They give editors
-- autocomplete and type-checking for the generated wrappers.
---@alias conformance.WireFormat integer
---@alias conformance.TestCategory integer

---@class conformance.TestStatus
---@field name string
---@field failure_message string
---@field matched_name string

---@class conformance.FailureSet
---@field test conformance.TestStatus[]

---@class conformance.ConformanceRequest
---@field protobuf_payload? string
---@field json_payload? string
---@field jspb_payload? string
---@field text_payload? string
---@field requested_output_format conformance.WireFormat
---@field message_type string
---@field test_category conformance.TestCategory
---@field jspb_encoding_options conformance.JspbEncodingConfig
---@field print_unknown_fields boolean

---@class conformance.ConformanceResponse
---@field parse_error? string
---@field serialize_error? string
---@field timeout_error? string
---@field runtime_error? string
---@field protobuf_payload? string
---@field json_payload? string
---@field skipped? string
---@field jspb_payload? string
---@field text_payload? string

---@class conformance.JspbEncodingConfig
---@field use_jspb_array_any_format boolean

---@param t? conformance.TestStatus
---@return conformance.TestStatus
function M.TestStatus_new(t) return t or {} end
---@param t conformance.TestStatus
---@return string
function M.TestStatus_encode(t) return pb.encode(M.TestStatus_descriptor, t) end
---@param b string
---@return conformance.TestStatus
function M.TestStatus_decode(b) return pb.decode(M.TestStatus_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.TestStatus_decode_lazy(b) return pb.decode_lazy(M.TestStatus_descriptor, b) end

---@param t? conformance.FailureSet
---@return conformance.FailureSet
function M.FailureSet_new(t) return t or {} end
---@param t conformance.FailureSet
---@return string
function M.FailureSet_encode(t) return pb.encode(M.FailureSet_descriptor, t) end
---@param b string
---@return conformance.FailureSet
function M.FailureSet_decode(b) return pb.decode(M.FailureSet_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.FailureSet_decode_lazy(b) return pb.decode_lazy(M.FailureSet_descriptor, b) end

---@param t? conformance.ConformanceRequest
---@return conformance.ConformanceRequest
function M.ConformanceRequest_new(t) return t or {} end
---@param t conformance.ConformanceRequest
---@return string
function M.ConformanceRequest_encode(t) return pb.encode(M.ConformanceRequest_descriptor, t) end
---@param b string
---@return conformance.ConformanceRequest
function M.ConformanceRequest_decode(b) return pb.decode(M.ConformanceRequest_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.ConformanceRequest_decode_lazy(b) return pb.decode_lazy(M.ConformanceRequest_descriptor, b) end

---@param t? conformance.ConformanceResponse
---@return conformance.ConformanceResponse
function M.ConformanceResponse_new(t) return t or {} end
---@param t conformance.ConformanceResponse
---@return string
function M.ConformanceResponse_encode(t) return pb.encode(M.ConformanceResponse_descriptor, t) end
---@param b string
---@return conformance.ConformanceResponse
function M.ConformanceResponse_decode(b) return pb.decode(M.ConformanceResponse_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.ConformanceResponse_decode_lazy(b) return pb.decode_lazy(M.ConformanceResponse_descriptor, b) end

---@param t? conformance.JspbEncodingConfig
---@return conformance.JspbEncodingConfig
function M.JspbEncodingConfig_new(t) return t or {} end
---@param t conformance.JspbEncodingConfig
---@return string
function M.JspbEncodingConfig_encode(t) return pb.encode(M.JspbEncodingConfig_descriptor, t) end
---@param b string
---@return conformance.JspbEncodingConfig
function M.JspbEncodingConfig_decode(b) return pb.decode(M.JspbEncodingConfig_descriptor, b) end
---@param b string
---@return pb.MessageView
function M.JspbEncodingConfig_decode_lazy(b) return pb.decode_lazy(M.JspbEncodingConfig_descriptor, b) end

return M