3
message items {
    message require {
        optional bool require_sex = 1; //
        repeated int32 fate = 2 [packed = true];
    }
    optional int32 sub_type = 1;
    repeated int32 levels = 2 [packed = true];
}

I tried

raw.require.require_sex = 1
raw.require.fate.append(1)
raw.require.fate.extend([2,3])

got an error AttributeError: 'property' object has no attribute 'append'

but the first level repeated field works fine:

raw = down_pb2.items()
raw.levels.append(4)

is this kind of definition not supported?

1 Answer 1

4

You need to create a field using that require type and then access that field in the code.

message items {
    message require {
        optional bool require_sex = 1; //
        repeated int32 fate = 2 [packed = true];
    }
    optional int32 sub_type = 1;
    repeated int32 levels = 2 [packed = true];
    required require sub = 3;
}

then

raw.sub.fate.append(1)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks so much for your answer, I really didn't noticed it's a TYPE not a variable. But the required limit is not really necessarily need here, optional can do the same thing here. Thanks again!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.