From 34cc0f62dbe0fcde858ffe51954d3e32f58b3bf0 Mon Sep 17 00:00:00 2001 From: Alexandre Hamez Date: Tue, 16 Jun 2020 22:16:12 +0200 Subject: [PATCH] Fix recommended conformance test by reinstating fields ordering Recommended.Proto3.ProtobufInput.ValidDataOneofBinary.MESSAGE.Merge.ProtobufOutput --- lib/protox/define.ex | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/protox/define.ex b/lib/protox/define.ex index cef66399..00948719 100644 --- a/lib/protox/define.ex +++ b/lib/protox/define.ex @@ -52,6 +52,7 @@ defmodule Protox.Define do # credo:disable-for-next-line Credo.Check.Refactor.CyclomaticComplexity defp define_messages(messages) do for {msg_name, syntax, fields} <- messages do + fields = Enum.sort(fields, &(elem(&1, 0) < elem(&2, 0))) unknown_fields = make_unknown_fields(:__uf__, fields) struct_fields = make_struct_fields(fields, unknown_fields, syntax) required_fields = make_required_fields(fields)