Skip to content

Commit a3a3724

Browse files
Corrige valeur de config jsonschema_validator_impl (#5284)
1 parent e5fbd5a commit a3a3724

2 files changed

Lines changed: 23 additions & 1 deletion

File tree

apps/transport/test/build_test.exs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,28 @@ defmodule TransportWeb.BuildTest do
8989
"Your javascript package for #{dep} is out of date.\nPlease update it with:\n\ncd apps/transport/client && yarn upgrade #{dep}"
9090
end
9191

92+
test "make sure configured _impl and _client modules exist in config.exs" do
93+
# Read config.exs directly to get the production modules (not the test mocks)
94+
config_content = File.read!("../../config/config.exs")
95+
96+
# Extract all _impl and _client configurations with their module values
97+
# Pattern matches lines like: key_impl: Module.Name or key_client: Module.Name,
98+
modules =
99+
Regex.scan(~r/(\w+(?:_impl|_client)):\s+([A-Z][\w.]+)/, config_content)
100+
|> Enum.map(fn [_, config_key, module_string] ->
101+
{config_key, String.to_atom("Elixir." <> module_string)}
102+
end)
103+
104+
# Sanity check: ensure we found some configurations
105+
assert length(modules) > 15,
106+
"Expected to find more than 15 _impl/_client configurations, found #{length(modules)}"
107+
108+
for {config_key, module} <- modules do
109+
assert Code.ensure_loaded?(module),
110+
"Module #{inspect(module)} configured for #{config_key} in config.exs does not exist"
111+
end
112+
end
113+
92114
# figuring out you have forgotten to upgrade the assets can be tricky, so we add a little reminder here
93115
test "make sure LiveView client assets are up to date" do
94116
{output, 0} = System.cmd("yarn", ["list", "--pattern", "phoenix_live_view"], cd: "client")

config/config.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ config :transport,
7878
rambo_impl: Transport.Rambo,
7979
gbfs_metadata_impl: Transport.GBFSMetadata,
8080
availability_checker_impl: Transport.AvailabilityChecker,
81-
jsonschema_validator_impl: Shared.Validation.JSONSchemaValidator,
81+
jsonschema_validator_impl: Transport.Validators.JSONSchema,
8282
tableschema_validator_impl: Transport.Validators.TableSchema,
8383
schemas_impl: Transport.Schemas,
8484
hasher_impl: Hasher,

0 commit comments

Comments
 (0)