41 static constexpr int32_t kInvalidFieldId = -1;
49 SchemaField(int32_t field_id, std::string_view name, std::shared_ptr<Type> type,
50 bool optional, std::string_view doc = {});
53 static SchemaField MakeOptional(int32_t field_id, std::string_view name,
54 std::shared_ptr<Type> type, std::string_view doc = {});
56 static SchemaField MakeRequired(int32_t field_id, std::string_view name,
57 std::shared_ptr<Type> type, std::string_view doc = {});
60 [[nodiscard]] int32_t field_id()
const;
63 [[nodiscard]] std::string_view name()
const;
66 [[nodiscard]]
const std::shared_ptr<Type>& type()
const;
69 [[nodiscard]]
bool optional()
const;
72 std::string_view doc()
const;
74 [[nodiscard]] std::string ToString()
const override;
76 Status Validate()
const;
79 return lhs.Equals(rhs);
84 copy.optional_ =
false;
90 copy.optional_ =
true;
96 [[nodiscard]]
bool Equals(
const SchemaField& other)
const;
100 std::shared_ptr<Type> type_;