Output is not deterministic for messages containing multiple `oneof` fields
The order of oneof fields in sabledocs-generated HTML varies from run to run.
Example:
syntax = "proto3";
package sable.test.v1;
message SampleMessage {
string foo = 1;
int32 bar = 2;
oneof test_oneof {
string name = 4;
int32 number = 9;
}
oneof test_oneof2 {
string name2 = 5;
int32 number2 = 10;
}
oneof test_oneof3 {
string name3 = 6;
int32 number4 = 11;
}
}
Outputs from multiple runs with the same input:
Steps to reproduce:
protoc oneof-test.proto -o descriptor.pb --include_source_info
sabledocs
Context: my organization has an automated build that saves a build artifact if the build output is different from the most recent build artifact, and I noticed that it was saving near-identical build artifacts that differ only in the order of oneof fields in sabledocs-generated HTML. Based on https://github.com/markvincze/sabledocs/issues/31 I understand that the order is intended to be deterministic.
I suspect this may be related to using set to hold oneof_names:
https://github.com/markvincze/sabledocs/blob/main/src/sabledocs/proto_descriptor_parser.py#L209
If that's the case, a potential solution may be to replace the set with a dict and use its keys view, which acts like a set but preserves order: https://docs.python.org/3/library/stdtypes.html#dict-views