Skip to content

Commit e8acbdd

Browse files
author
Guy Fankam
committed
Revert configuration keys to camelCase.
1 parent a9fd756 commit e8acbdd

5 files changed

Lines changed: 29 additions & 22 deletions

File tree

.github/workflows/create_github_release.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77
description: "Provide a release version. e.g. v3.1.0"
88
required: true
99
type: string
10-
Include_OSX:
10+
Build_OSX:
1111
description: "Build OSX artifacts. It can sometimes take a while (1hr+) to find a Mac runner."
1212
required: false
1313
default: true
@@ -18,7 +18,7 @@ jobs:
1818
name: Generate extractor artifacts
1919
strategy:
2020
matrix:
21-
dotnet-runtime: ${{ fromJSON(inputs.Include_OSX && '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64","osx-arm64","osx-x64"]' || '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64"]') }}
21+
dotnet-runtime: ${{ fromJSON(inputs.Build_OSX && '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64","osx-arm64","osx-x64"]' || '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64"]') }}
2222
# Dynamically set the runner OS based on the .NET runtime
2323
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest", "linux-arm64":"ubuntu-latest", "linux-musl-x64":"ubuntu-latest", "linux-musl-arm64":"ubuntu-latest", "win-x64":"windows-latest", "osx-arm64":"macos-latest", "osx-x64":"macos-latest"}')[matrix.dotnet-runtime] }}
2424
steps:
@@ -75,7 +75,7 @@ jobs:
7575
name: Generate publisher artifacts
7676
strategy:
7777
matrix:
78-
dotnet-runtime: ${{ fromJSON(inputs.Include_OSX && '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64","osx-arm64","osx-x64"]' || '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64"]') }}
78+
dotnet-runtime: ${{ fromJSON(inputs.Build_OSX && '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64","osx-arm64","osx-x64"]' || '["linux-x64","linux-arm64","linux-musl-x64","linux-musl-arm64","win-x64"]') }}
7979
# Dynamically set the runner OS based on the .NET runtime
8080
runs-on: ${{ fromJSON('{"linux-x64":"ubuntu-latest", "linux-arm64":"ubuntu-latest", "linux-musl-x64":"ubuntu-latest", "linux-musl-arm64":"ubuntu-latest", "win-x64":"windows-latest", "osx-arm64":"macos-latest", "osx-x64":"macos-latest"}')[matrix.dotnet-runtime] }}
8181
steps:
@@ -310,7 +310,7 @@ jobs:
310310
--clobber
311311
312312
- name: Upload macOS assets
313-
if: ${{ inputs.Include_OSX }}
313+
if: ${{ inputs.Build_OSX }}
314314
env:
315315
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
316316
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

configuration.extractor.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ loggers:
2727
- loggerName1
2828
- loggerName2
2929

30-
named_values:
30+
namedValues:
3131
- namedValueName1
3232
- namedValueName2
3333

@@ -43,11 +43,11 @@ tags:
4343
- tagName1
4444
- tagName2
4545

46-
policy_fragments:
46+
policyFragments:
4747
- policyFragment1
4848
- policyFragment2
4949

50-
version_sets:
50+
versionSets:
5151
- versionSetName1
5252

5353
workspaces:
@@ -65,14 +65,14 @@ workspaces:
6565
groups: []
6666
loggers:
6767
- workspaceLoggerName1
68-
named_values:
68+
namedValues:
6969
- workspaceNamedValueName1
70-
policy_fragments:
70+
policyFragments:
7171
- workspacePolicyFragmentName1
7272
products:
7373
- workspaceProductName1
7474
subscriptions: []
7575
tags:
7676
- workspaceTagName1
77-
version_sets:
77+
versionSets:
7878
- workspaceVersionSetName1

configuration.prod.yaml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
apimServiceName: [prod or any other target environment apim instance name goes here]
22

3-
named_values:
3+
namedValues:
44
- name: environment
55
properties:
66
displayName: environment
@@ -24,7 +24,7 @@ named_values:
2424
displayName: helloworldfromlogicapp_manual-invoke_634e022983908257b35630b0
2525
value: "{#helloworldfromlogicapp#}"
2626

27-
service_policies:
27+
policies:
2828
- name: policy
2929
properties:
3030
format: rawxml
@@ -67,7 +67,7 @@ backends:
6767
url: "https://prod-75.eastus.logic.azure.com/workflows/[guid goes here]/triggers"
6868
resourceId: "https://management.azure.com/subscriptions/[subscription Guid goes here]/resourceGroups/rg-apim-lab-prod/providers/Microsoft.Logic/workflows/helloworldfromprodlogicapp"
6969

70-
version_sets:
70+
versionSets:
7171
- name: versionSetName1
7272
properties:
7373
displayName: "My Version Set"
@@ -118,7 +118,7 @@ tags:
118118
displayName: "Tag 1"
119119

120120

121-
policy_fragments:
121+
policyFragments:
122122
- name: policyFragment1
123123
properties:
124124
description: "Policy fragment description"
@@ -131,7 +131,7 @@ workspaces:
131131
- name: workspaceGroupName1
132132
properties:
133133
displayName: "Workspace Group"
134-
named_values:
134+
namedValues:
135135
- name: workspaceNamedValueName1
136136
properties:
137137
displayName: workspaceNamedValueName1
@@ -149,7 +149,7 @@ workspaces:
149149
- name: workspaceTagName1
150150
properties:
151151
displayName: "Workspace Tag"
152-
version_sets:
152+
versionSets:
153153
- name: workspaceVersionSetName1
154154
properties:
155155
displayName: "Workspace Version Set"
@@ -169,7 +169,7 @@ workspaces:
169169
- name: workspaceDiagnosticName1
170170
properties:
171171
verbosity: Error
172-
policy_fragments:
172+
policyFragments:
173173
- name: workspacePolicyFragmentName1
174174
properties:
175175
description: "Workspace policy fragment"

src/common/Resource.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,16 @@ public interface IResource
4040
string PluralName { get; }
4141

4242
public string ConfigurationKey =>
43-
// By default, use the plural name in snake_case as the configuration key.
44-
new([.. from character in PluralName
45-
select char.IsWhiteSpace(character)
46-
? '_'
47-
: char.ToLowerInvariant(character)]);
43+
// By default, use the plural name in camelCase as the configuration key.
44+
new([.. PluralName.Split(' ', StringSplitOptions.RemoveEmptyEntries)
45+
.SelectMany<string, char>((word, index) => word switch
46+
{
47+
// Lowercase the first character of the first word
48+
[var first, .. var rest] when index == 0 => [char.ToLowerInvariant(first), .. rest],
49+
// Uppercase the first character of subsequent words
50+
[var first, .. var rest] => [char.ToUpperInvariant(first), .. rest],
51+
_ => []
52+
})]);
4853

4954
#pragma warning disable CA1056 // URI-like properties should not be strings. This is not a URI, but a path to a collection of resources.
5055
public string CollectionUriPath { get; }

src/common/ServicePolicy.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ private ServicePolicyResource() { }
88

99
public string PluralName { get; } = "service policies";
1010

11+
public string ConfigurationKey { get; } = "policies";
12+
1113
public static ServicePolicyResource Instance { get; } = new();
1214
}

0 commit comments

Comments
 (0)