-
Notifications
You must be signed in to change notification settings - Fork 34
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.
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.
This change updates the YAML source definition files for the JSON Schemas to use the correct casing. It also adds the missing `context` property for the `Microsoft.DSC` metadata field.
This change generates the canonical schemas for in new folders: `v3`, `v3.0`, and `v3.0.0`, instead of the previous date-based folder `2024/04`. The changing of the casing is _not_ backwards compatible, and requires a new location to avoid breaking prior schemas. This change generates the schemas into three folders to accomodate the changes requested in PowerShell#138 for moving from date-based to semantic versioning for the schemas. Going forward, schema generation should: - Export to a folder for the current release with the full semantic version, like `v3.0.1` or `v3.1.0`. - Export to a folder for the current `major.minor` schema, like `v3.0` or `v3.1` - Build to a folder for the current major version of the release, like `v3`. Under this design, you can: - Get the exact version of the schema that a release shipped with by specifying the schema URI as `v<major>.<minor>.<patch>` - Get the latest schema for your minor version as `v<major>.<minor>` - Get the latest schema for your major version as `v<major>` Breaking changes to the schema have the potential to break integrating software, configuration documents, and resource manifests. They therefore constitute a breaking change in the application and require incrementing the major version segment of the semantic version. This change will be followed by an update to the allowed schema versions in the code itself, which should only recognize the updated schema at this time, not previous schemas.
This commit only touches the `dsc` and `dsc_lib` crates. A future commit will update the examples, manifests, and tests throughout the repository for the updated schema URIs. Tests against this commit specifically will not pass, but the changes to the library are broken out here for easier review. This change defines a new module in the library for interacting with and managing JSON Schemas for DSC. The code in this module is made public for use in other repository crates, but shouldn't be used by crates outside of this repository. It defines new enumerations: - `SchemaUriPrefix` for handling URIs pointing to either the GitHub repository or friendly `aka.ms` locations. - `SchemaForm` for the different forms the DSC schemas are published to (canonical, bundled, and enhanced for VS Code) - `RecognizedSchemaVersion` for managing the version folders schemas are publsihed to for and after GA. It defines a few helper functions for constructing the various URIs for a schema. These helper functions may be useful for testing, but should primarily be used through the new `DscRepoSchema` trait, which requires a type to define the base name and folder path for its schema and whether the schema should be published in its bundled form (only applies to top-level schemas, not subschemas). The trait provides default implementations for retrieving the schema URIs and a function to return a generated JSON Schema for the `$schema` keyword, used by both configuration documents and resource manifests. As we canonicalize and improve the schemas, this trait should make it simpler to manage the schemas across new versions and should be the container for JSON Schema enhancements specific to the DSC schemas. This change updates the configuration document and resource manifest definitions to implement the `DscRepoSchema` trait and replaces the per-type enumerations for schema version URIs by passing the `recognized_schema_uris_subschema` to the schemars `schema_with` attribute.
This change updates the schema URIs in the various resource manifests, configuration documents, and tests to use the new schema URIs: - `https://aka.ms/dsc/schemas/v3/bundled/config/document.json` for configuration documents. - `https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json` for resource manifests. This change pins the changes to the major version to reduce how often these files need to be updated with future releases. It uses the `aka.ms` prefix instead of the GitHub URI prefix for readability and because we expect the majority of users to prefer the shorter URI. With this change in place, tests broken in the previous commit should pass again.
Prior to this change, DSC didn't have a convenient way to verify whether a configuration or manifest used a recognized schema or to switch behaviors based on the declared URI. This change begins the process of plumbing the recognized schemas into DSC so the engine can correctly validate and handle items based on the value of the `$schema` keyword. In this first iteration, the `DscRepoSchema` trait adds a method to validate whether the item uses a recognized schema. In the future, the engine should provide further handling than pass/fail. This change only adds the methods, it doesn't alter how DSC processes configuration documents or resource manifests.
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.
This change updates the YAML source definition files for the JSON Schemas to use the correct casing. It also adds the missing `context` property for the `Microsoft.DSC` metadata field.
This change generates the canonical schemas for in new folders: `v3`, `v3.0`, and `v3.0.0`, instead of the previous date-based folder `2024/04`. The changing of the casing is _not_ backwards compatible, and requires a new location to avoid breaking prior schemas. This change generates the schemas into three folders to accomodate the changes requested in PowerShell#138 for moving from date-based to semantic versioning for the schemas. Going forward, schema generation should: - Export to a folder for the current release with the full semantic version, like `v3.0.1` or `v3.1.0`. - Export to a folder for the current `major.minor` schema, like `v3.0` or `v3.1` - Build to a folder for the current major version of the release, like `v3`. Under this design, you can: - Get the exact version of the schema that a release shipped with by specifying the schema URI as `v<major>.<minor>.<patch>` - Get the latest schema for your minor version as `v<major>.<minor>` - Get the latest schema for your major version as `v<major>` Breaking changes to the schema have the potential to break integrating software, configuration documents, and resource manifests. They therefore constitute a breaking change in the application and require incrementing the major version segment of the semantic version. This change will be followed by an update to the allowed schema versions in the code itself, which should only recognize the updated schema at this time, not previous schemas.
This commit only touches the `dsc` and `dsc_lib` crates. A future commit will update the examples, manifests, and tests throughout the repository for the updated schema URIs. Tests against this commit specifically will not pass, but the changes to the library are broken out here for easier review. This change defines a new module in the library for interacting with and managing JSON Schemas for DSC. The code in this module is made public for use in other repository crates, but shouldn't be used by crates outside of this repository. It defines new enumerations: - `SchemaUriPrefix` for handling URIs pointing to either the GitHub repository or friendly `aka.ms` locations. - `SchemaForm` for the different forms the DSC schemas are published to (canonical, bundled, and enhanced for VS Code) - `RecognizedSchemaVersion` for managing the version folders schemas are publsihed to for and after GA. It defines a few helper functions for constructing the various URIs for a schema. These helper functions may be useful for testing, but should primarily be used through the new `DscRepoSchema` trait, which requires a type to define the base name and folder path for its schema and whether the schema should be published in its bundled form (only applies to top-level schemas, not subschemas). The trait provides default implementations for retrieving the schema URIs and a function to return a generated JSON Schema for the `$schema` keyword, used by both configuration documents and resource manifests. As we canonicalize and improve the schemas, this trait should make it simpler to manage the schemas across new versions and should be the container for JSON Schema enhancements specific to the DSC schemas. This change updates the configuration document and resource manifest definitions to implement the `DscRepoSchema` trait and replaces the per-type enumerations for schema version URIs by passing the `recognized_schema_uris_subschema` to the schemars `schema_with` attribute.
This change updates the schema URIs in the various resource manifests, configuration documents, and tests to use the new schema URIs: - `https://aka.ms/dsc/schemas/v3/bundled/config/document.json` for configuration documents. - `https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json` for resource manifests. This change pins the changes to the major version to reduce how often these files need to be updated with future releases. It uses the `aka.ms` prefix instead of the GitHub URI prefix for readability and because we expect the majority of users to prefer the shorter URI. With this change in place, tests broken in the previous commit should pass again.
Prior to this change, DSC didn't have a convenient way to verify whether a configuration or manifest used a recognized schema or to switch behaviors based on the declared URI. This change begins the process of plumbing the recognized schemas into DSC so the engine can correctly validate and handle items based on the value of the `$schema` keyword. In this first iteration, the `DscRepoSchema` trait adds a method to validate whether the item uses a recognized schema. In the future, the engine should provide further handling than pass/fail. This change only adds the methods, it doesn't alter how DSC processes configuration documents or resource manifests.
…/config ref This change drafts a new reference document that explains how the DSC schemas are published, the URIs DSC recognizes for those schemas, and updates the documentation for the resource manifest and configuration document schemas with the updated context. A future change will address updating the rest of the reference documentation.
This change updates the reference documentation to align with the new schema URIs and the changes to the enumeration and struct casing.
…ng-canonicalization (GH-642) Ensure camelCase for items in `dsc_lib`
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.
This change updates the YAML source definition files for the JSON Schemas to use the correct casing. It also adds the missing `context` property for the `Microsoft.DSC` metadata field.
This change generates the canonical schemas for in new folders: `v3`, `v3.0`, and `v3.0.0`, instead of the previous date-based folder `2024/04`. The changing of the casing is _not_ backwards compatible, and requires a new location to avoid breaking prior schemas. This change generates the schemas into three folders to accomodate the changes requested in PowerShell#138 for moving from date-based to semantic versioning for the schemas. Going forward, schema generation should: - Export to a folder for the current release with the full semantic version, like `v3.0.1` or `v3.1.0`. - Export to a folder for the current `major.minor` schema, like `v3.0` or `v3.1` - Build to a folder for the current major version of the release, like `v3`. Under this design, you can: - Get the exact version of the schema that a release shipped with by specifying the schema URI as `v<major>.<minor>.<patch>` - Get the latest schema for your minor version as `v<major>.<minor>` - Get the latest schema for your major version as `v<major>` Breaking changes to the schema have the potential to break integrating software, configuration documents, and resource manifests. They therefore constitute a breaking change in the application and require incrementing the major version segment of the semantic version. This change will be followed by an update to the allowed schema versions in the code itself, which should only recognize the updated schema at this time, not previous schemas.
This commit only touches the `dsc` and `dsc_lib` crates. A future commit will update the examples, manifests, and tests throughout the repository for the updated schema URIs. Tests against this commit specifically will not pass, but the changes to the library are broken out here for easier review. This change defines a new module in the library for interacting with and managing JSON Schemas for DSC. The code in this module is made public for use in other repository crates, but shouldn't be used by crates outside of this repository. It defines new enumerations: - `SchemaUriPrefix` for handling URIs pointing to either the GitHub repository or friendly `aka.ms` locations. - `SchemaForm` for the different forms the DSC schemas are published to (canonical, bundled, and enhanced for VS Code) - `RecognizedSchemaVersion` for managing the version folders schemas are publsihed to for and after GA. It defines a few helper functions for constructing the various URIs for a schema. These helper functions may be useful for testing, but should primarily be used through the new `DscRepoSchema` trait, which requires a type to define the base name and folder path for its schema and whether the schema should be published in its bundled form (only applies to top-level schemas, not subschemas). The trait provides default implementations for retrieving the schema URIs and a function to return a generated JSON Schema for the `$schema` keyword, used by both configuration documents and resource manifests. As we canonicalize and improve the schemas, this trait should make it simpler to manage the schemas across new versions and should be the container for JSON Schema enhancements specific to the DSC schemas. This change updates the configuration document and resource manifest definitions to implement the `DscRepoSchema` trait and replaces the per-type enumerations for schema version URIs by passing the `recognized_schema_uris_subschema` to the schemars `schema_with` attribute.
This change updates the schema URIs in the various resource manifests, configuration documents, and tests to use the new schema URIs: - `https://aka.ms/dsc/schemas/v3/bundled/config/document.json` for configuration documents. - `https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json` for resource manifests. This change pins the changes to the major version to reduce how often these files need to be updated with future releases. It uses the `aka.ms` prefix instead of the GitHub URI prefix for readability and because we expect the majority of users to prefer the shorter URI. With this change in place, tests broken in the previous commit should pass again.
Prior to this change, DSC didn't have a convenient way to verify whether a configuration or manifest used a recognized schema or to switch behaviors based on the declared URI. This change begins the process of plumbing the recognized schemas into DSC so the engine can correctly validate and handle items based on the value of the `$schema` keyword. In this first iteration, the `DscRepoSchema` trait adds a method to validate whether the item uses a recognized schema. In the future, the engine should provide further handling than pass/fail. This change only adds the methods, it doesn't alter how DSC processes configuration documents or resource manifests.
…/config ref This change drafts a new reference document that explains how the DSC schemas are published, the URIs DSC recognizes for those schemas, and updates the documentation for the resource manifest and configuration document schemas with the updated context. A future change will address updating the rest of the reference documentation.
This change updates the reference documentation to align with the new schema URIs and the changes to the enumeration and struct casing.
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: