Skip to content

Commit 945481d

Browse files
committed
Align Yahoo test configuration with provider settings
Root cause: Yahoo credentials and behavior had drifted away from the shared provider-configuration pattern, which left tests, sample config, and README guidance out of sync. This restores Yahoo credential gating in tests under Providers:Yahoo while keeping the sample app clear that Yahoo stays out of the runnable surface because the legacy provider still uses insecure endpoints.
1 parent c0a0894 commit 945481d

7 files changed

Lines changed: 28 additions & 25 deletions

File tree

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Includes a model and interface for communicating with current geocoding provider
99
| Bing Maps | `Geocoding.Microsoft` | Deprecated compatibility | Bing Maps enterprise key | `BingMapsGeocoder` remains available for existing consumers and is marked obsolete for new development. |
1010
| HERE Geocoding and Search | `Geocoding.Here` | Supported | HERE API key | Uses the current HERE Geocoding and Search API. |
1111
| MapQuest | `Geocoding.MapQuest` | Supported | API key | Commercial API only. OpenStreetMap mode is no longer supported. |
12-
| Yahoo PlaceFinder/BOSS | `Geocoding.Yahoo` | Deprecated | None verified | Legacy package retained only for source compatibility and planned removal. |
12+
| Yahoo PlaceFinder/BOSS | `Geocoding.Yahoo` | Deprecated | OAuth consumer key + secret | Legacy package retained for compatibility, but the service remains deprecated and unverified. |
1313

1414
The API returns latitude/longitude coordinates and normalized address information. This can be used to perform address validation, real time mapping of user-entered addresses, distance calculations, and much more.
1515

@@ -64,7 +64,7 @@ var country = addresses.Where(a => !a.IsPartialMatch).Select(a => a[GoogleAddres
6464
Console.WriteLine("Country: " + country.LongName + ", " + country.ShortName); //Country: United States, US
6565
```
6666

67-
The Microsoft providers expose `AzureMapsAddress`, and the legacy `BingMapsGeocoder` / `BingAddress` surface remains available as an obsolete compatibility layer. The Yahoo package remains deprecated.
67+
The Microsoft providers expose `AzureMapsAddress`, and the legacy `BingMapsGeocoder` / `BingAddress` surface remains available as an obsolete compatibility layer. The Yahoo package also remains deprecated and should only be used for compatibility scenarios.
6868

6969
## API Keys
7070

@@ -78,7 +78,7 @@ MapQuest requires a [developer API key](https://developer.mapquest.com/user/me/a
7878

7979
HERE requires a [HERE API key](https://www.here.com/docs/category/identity-and-access-management).
8080

81-
Yahoo credential onboarding could not be validated and the package is deprecated.
81+
Yahoo still uses the legacy OAuth consumer key and consumer secret flow, but onboarding remains unverified and the package is deprecated.
8282

8383
## How to Build from Source
8484

@@ -95,14 +95,14 @@ Alternatively, if you are on Windows, you can open the solution in [Visual Studi
9595

9696
You will need to generate API keys for each respective service to run the service tests. Make a `settings-override.json` as a copy of `settings.json` in the test project and put in your API keys. Then you should be able to run the tests.
9797

98-
Most provider-backed integration tests skip with a message indicating which setting is required when credentials are missing. The Yahoo suite remains explicitly skipped while the provider is deprecated.
98+
Most provider-backed integration tests skip with a message indicating which setting is required when credentials are missing. The Yahoo suite now follows the same credential gating, but the provider remains deprecated and unverified.
9999

100100
## Sample App
101101

102-
The sample app in `samples/Example.Web` is an ASP.NET Core 10 minimal API that can geocode and reverse geocode against any configured provider, including the deprecated Bing compatibility option when explicitly enabled.
102+
The sample app in `samples/Example.Web` is an ASP.NET Core 10 minimal API that can geocode and reverse geocode against any configured provider, including the deprecated Bing compatibility option when explicitly enabled. Yahoo remains excluded from the sample because the legacy provider still targets discontinued non-TLS endpoints.
103103

104104
```bash
105105
dotnet run --project samples/Example.Web/Example.Web.csproj
106106
```
107107

108-
Configure a provider in `samples/Example.Web/appsettings.json` or via environment variables such as `Providers__Google__ApiKey`, `Providers__Azure__ApiKey`, `Providers__Bing__ApiKey`, `Providers__Here__ApiKey`, or `Providers__MapQuest__ApiKey`. Once the app is running, use `samples/Example.Web/sample.http` to call `/providers`, `/geocode`, and `/reverse`.
108+
Configure a provider in `samples/Example.Web/appsettings.json` or via environment variables such as `Providers__Azure__ApiKey`, `Providers__Bing__ApiKey`, `Providers__Google__ApiKey`, `Providers__Here__ApiKey`, or `Providers__MapQuest__ApiKey`. Once the app is running, use `samples/Example.Web/sample.http` to call `/providers`, `/geocode`, and `/reverse`.

samples/Example.Web/Example.Web.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk.Web">
1+
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
44
<TargetFramework>net10.0</TargetFramework>
@@ -15,4 +15,4 @@
1515
<ProjectReference Include="../../src/Geocoding.Microsoft/Geocoding.Microsoft.csproj" />
1616
</ItemGroup>
1717

18-
</Project>
18+
</Project>

samples/Example.Web/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,14 +109,14 @@ static string[] GetConfiguredProviders(ProviderOptions options)
109109
{
110110
var configuredProviders = new List<string>();
111111

112-
configuredProviders.Add("google");
113-
114112
if (!String.IsNullOrWhiteSpace(options.Azure.ApiKey))
115113
configuredProviders.Add("azure");
116114

117115
if (!String.IsNullOrWhiteSpace(options.Bing.ApiKey))
118116
configuredProviders.Add("bing");
119117

118+
configuredProviders.Add("google");
119+
120120
if (!String.IsNullOrWhiteSpace(GetHereApiKey(options)))
121121
configuredProviders.Add("here");
122122

@@ -204,7 +204,7 @@ static bool TryCreateGeocoder(string provider, ProviderOptions options, out IGeo
204204

205205
default:
206206
geocoder = default!;
207-
error = $"Unknown provider '{provider}'. Use one of: google, azure, bing, here, mapquest.";
207+
error = $"Unknown provider '{provider}'. Use one of: azure, bing, google, here, mapquest.";
208208
return false;
209209
}
210210
}
@@ -245,9 +245,9 @@ internal sealed record AddressResponse(string FormattedAddress, string Provider,
245245

246246
internal sealed class ProviderOptions
247247
{
248-
public GoogleProviderOptions Google { get; init; } = new();
249248
public AzureProviderOptions Azure { get; init; } = new();
250249
public BingProviderOptions Bing { get; init; } = new();
250+
public GoogleProviderOptions Google { get; init; } = new();
251251
public HereProviderOptions Here { get; init; } = new();
252252
public MapQuestProviderOptions MapQuest { get; init; } = new();
253253
}

samples/Example.Web/appsettings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"Providers": {
3-
"Google": {
4-
"ApiKey": ""
5-
},
63
"Azure": {
74
"ApiKey": ""
85
},
96
"Bing": {
107
"ApiKey": ""
118
},
9+
"Google": {
10+
"ApiKey": ""
11+
},
1212
"Here": {
1313
"ApiKey": ""
1414
},

test/Geocoding.Tests/SettingsFixture.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public String MapQuestKey
4343

4444
public String YahooConsumerKey
4545
{
46-
get { return GetValue("yahooConsumerKey"); }
46+
get { return GetValue("Providers:Yahoo:ConsumerKey", "yahooConsumerKey"); }
4747
}
4848

4949
public String YahooConsumerSecret
5050
{
51-
get { return GetValue("yahooConsumerSecret"); }
51+
get { return GetValue("Providers:Yahoo:ConsumerSecret", "yahooConsumerSecret"); }
5252
}
5353

5454
private String GetValue(params string[] keys)

test/Geocoding.Tests/YahooGeocoderTest.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,9 @@ public YahooGeocoderTest(SettingsFixture settings)
1414

1515
protected override IGeocoder CreateGeocoder()
1616
{
17-
Assert.Skip("Yahoo PlaceFinder/BOSS remains deprecated and unverified in this branch; see docs/plan.md and upstream issue #27.");
18-
return default!;
17+
SettingsFixture.SkipIfMissing(_settings.YahooConsumerKey, nameof(SettingsFixture.YahooConsumerKey));
18+
SettingsFixture.SkipIfMissing(_settings.YahooConsumerSecret, nameof(SettingsFixture.YahooConsumerSecret));
19+
return new YahooGeocoder(_settings.YahooConsumerKey, _settings.YahooConsumerSecret);
1920
}
2021
}
2122
#pragma warning restore CS0618

test/Geocoding.Tests/settings.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,23 @@
11
{
22
"Providers": {
3-
"Google": {
4-
"ApiKey": ""
5-
},
63
"Azure": {
74
"ApiKey": ""
85
},
96
"Bing": {
107
"ApiKey": ""
118
},
9+
"Google": {
10+
"ApiKey": ""
11+
},
1212
"Here": {
1313
"ApiKey": ""
1414
},
1515
"MapQuest": {
1616
"ApiKey": ""
17+
},
18+
"Yahoo": {
19+
"ConsumerKey": "",
20+
"ConsumerSecret": ""
1721
}
18-
},
19-
"yahooConsumerKey": "",
20-
"yahooConsumerSecret": ""
22+
}
2123
}

0 commit comments

Comments
 (0)