-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Breaking Change: Standardize casing for property names and enumerated values in JSON #642
Comments
@michaeltlombardi I manually reviewed the structs that are (de)serialized. The only cases I saw were in Progress which is already fixed by #644 and tracing supporting |
I found the following definitions other than progress—I looked primarily for structs and enums that had both serialize/deserialize or the
I also noticed the progress struct, which only serializes - not sure if we should also have it with a JSON Schema if it's meant to be consumed by other tools, and thus also camelCased: Lines 42 to 50 in 3963389
|
I think PascalCasing makes sense for Enums which are used as property values and not property names. Progress currently is only serialized, when we get to enabling resources to emit progress then deserialization will be important. |
Prior to this change, the structs and enums in `dsc_lib` didn't consistently use camelCase - most property names and enum values use camelCase, but not all - and this inconsistency isn't predictable for end users, who need to consult the JSON Schemas to be sure. This change updates the definitions to rename the fields and values when serializing and deserializing, which also updates their JSON Schema. A future change is required to update the canonical schemas in the repository to match these updates.
Pascal casing for enums is currently inconsistent, and some of them can't be changed to PascalCasing without breaking ARM compatibility, like DSC/dsc_lib/src/configure/config_doc.rs Lines 108 to 124 in 3963389
Other enums that currently use camelCasing:
|
ARM compat is a priority, so I guess that means we should make everything camelCased to be consistent. I'll update my PR for this. |
Relatedly, in my ideal world, which I am not recommending we do in the short-to-mid-term, or without further user feedback:
Because DSC knows the supplied data and JSON Schema for not only its own data types but also for resource instances, I think we can (relatively cheaply, maintainably) implement a check for case-sensitivity values. The |
I think making property names and enum values case-insensitive makes sense since we don't ever want a situation where we have different properties/enums that differ by casing. It looks like |
Prior to this change, the structs and enums in `dsc_lib` didn't consistently use camelCase - most property names and enum values use camelCase, but not all - and this inconsistency isn't predictable for end users, who need to consult the JSON Schemas to be sure. This change updates the definitions to rename the fields and values when serializing and deserializing, which also updates their JSON Schema. A future change is required to update the canonical schemas in the repository to match these updates.
Summary of the new feature / enhancement
Currently, the general practice is to use
camelCase
for JSON property names and enumerated values. However, not all of the structs follow this convention, and it's not predictable which values or properties use a different casing.Because JSON Schemas are case sensitive, this constitutes a breaking change best made sooner than later.
Proposed technical implementation details (optional)
serde
attribute for rust structs and enums correctly cases the property names and values.Serialize
and/orDeserialize
use camel casing.The text was updated successfully, but these errors were encountered: