jsontypedef / json-typedef-codegen

A CLI tool that generates code from JSON Typedef schemas
https://jsontypedef.com/docs/tools/jtd-codegen
MIT License
157 stars 31 forks source link

Keep order of attributes in JTD schema #34

Closed julien-c closed 2 years ago

julien-c commented 3 years ago

Hi, thanks for this great project @ucarion 🙏

Is there any way to keep the order of attributes definition from the JTD file, and not reorder them?

ucarion commented 3 years ago

I'm afraid not. The code generated is alphabetized so that output is stable as long as the schema is semantically identical.

The ordering of keys isn't meaningful in JSON or in JTD, and so the code generator disregards such information in order to have fewer spurious diffs in its output.

On Sun, Aug 8, 2021, 3:38 AM Julien Chaumond @.***> wrote:

Hi, thanks for this great project @ucarion https://github.com/ucarion 🙏

Is there any way to keep the order of attributes definition from the JTD file, and not reorder them?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jsontypedef/json-typedef-codegen/issues/34, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQUIOOS6FT4G5ZZ3VPPJP3T3ZNAVANCNFSM5BYLL4XQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .