Skip to content

Commit

Permalink
fix: toggle oslo endpoints indepentently
Browse files Browse the repository at this point in the history
  • Loading branch information
ArneD committed Oct 30, 2024
1 parent 497877c commit 15f04e5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 32 deletions.
2 changes: 1 addition & 1 deletion src/Public.Api/Address/Oslo/AddressController-Search.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ public partial class AddressOsloController
/// <response code="406">Als het gevraagde formaat niet beschikbaar is.</response>
/// <response code="429">Als het aantal requests per seconde de limiet overschreven heeft.</response>
/// <response code="500">Als er een interne fout is opgetreden.</response>
[HttpGet("adressen/zoeken", Name = nameof(SearchAddresses))]
[ApiOrder(ApiOrder.Address.V2 + 5)]
[ApiProduces(EndpointType.Json)]
[ProducesResponseType(typeof(AddressSearchResponse), StatusCodes.Status200OK)]
Expand All @@ -60,6 +59,7 @@ public partial class AddressOsloController
[SwaggerResponseExample(StatusCodes.Status500InternalServerError, typeof(InternalServerErrorResponseExamplesV2))]
[HttpCacheValidation(NoCache = true, MustRevalidate = true, ProxyRevalidate = true)]
[HttpCacheExpiration(CacheLocation = CacheLocation.Private, MaxAge = DefaultListCaching, NoStore = true, NoTransform = true)]
[HttpGet("adressen/zoeken", Name = nameof(SearchAddresses))]
public async Task<IActionResult> SearchAddresses(
[FromQuery(Name = "q")] string? query,
[FromQuery(Name="gemeenteOfPostNaam")] string? municipalityOrPostalName,
Expand Down
31 changes: 0 additions & 31 deletions src/Public.Api/Infrastructure/FeatureToggleConvention.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,40 +24,9 @@ public void Apply(ActionModel action)
return;
}

var ns = action.DisplayName.Split('.');
if (ToggleOslo(action, ns))
return;

if (ToggleTicketing(action, ns))
return;

action.ApiExplorer.IsVisible = FeatureIsEnabled(GetPossibleFeatureToggleKeys(action));
}

private bool ToggleOslo(ActionModel action, string[] ns)
{
if (ns.Length <= 2 || ns[3] != "Oslo")
{
return false;
}

var featureName = $"Is{ns[2]}OsloApiEnabled";
action.ApiExplorer.IsVisible = FeatureIsEnabled(featureName);
return true;
}

private bool ToggleTicketing(ActionModel action, string[] ns)
{
if (ns.Length <= 1 || ns[2] != "Tickets")
{
return false;
}

const string featureName = "Ticketing";
action.ApiExplorer.IsVisible = FeatureIsEnabled(featureName);
return true;
}

private bool FeatureIsEnabled(string key)
{
return !_features.ContainsKey(key) ||
Expand Down

0 comments on commit 15f04e5

Please sign in to comment.