fix(gateway): route /locale/** to services-system
The language registry answered 404 through the gateway, so the public language list failed with a 500. Found in the live check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EFUzfiCVCgCVJZq4NDEqZs
This commit is contained in:
1 parent
a73614424e
commit
48a6180c0a
3 files changed
+34
-1
No files matched your search
@@ -25,6 +25,7 @@ Verify commands:
|
||||
## 3. Gateway
|
||||
|
||||
- [x] 3.1 Narrow the token bypass from any `/message/` URL to the exact read paths in use (grep the callers first), plus `/locale/findAllEnabled`. Tests cover open reads and token-gated writes. Security code: read the whole diff.
|
||||
- Found in the live check: the gateway had no `/locale/**` route, so the registry answered 404. Added the route with a test.
|
||||
- Verify: `mvn -T 1C -B -q -pl solvway-api-gateway -am verify`
|
||||
|
||||
## 4. mobile-api
|
||||
@@ -48,7 +49,7 @@ Verify commands:
|
||||
## 6. Chinese
|
||||
|
||||
- [x] 6.1 `zh_CN.seed.json` for every `defaultMessages.ts` key, following the glossary in design decision 7. Guard tests: full coverage, equal placeholders, no extra keys.
|
||||
- [ ] 6.2 Generator `npm run i18n:sql` writing `sql/03-zh-cn-messages.sql`. It upserts zh_CN, inserts missing rows with English, aligns the four English rows and bumps the version. A test checks the committed SQL matches the generator. Mirror it into `local/seed/04-zh-cn-messages.sql`.
|
||||
- [x] 6.2 Generator `npm run i18n:sql` writing `sql/03-zh-cn-messages.sql`. It upserts zh_CN, inserts missing rows with English, aligns the four English rows and bumps the version. A test checks the committed SQL matches the generator. Mirror it into `local/seed/04-zh-cn-messages.sql`.
|
||||
- Verify: portal verify, then apply the SQL to the local DB and confirm the catalog endpoint returns Chinese for a sample of keys.
|
||||
|
||||
## 7. Release
|
||||
|
||||
@@ -53,6 +53,10 @@ spring:
|
||||
uri: http://${app.services.name.system}
|
||||
predicates:
|
||||
- Path=/message/**
|
||||
- id: locale
|
||||
uri: http://${app.services.name.system}
|
||||
predicates:
|
||||
- Path=/locale/**
|
||||
- id: module
|
||||
uri: http://${app.services.name.system}
|
||||
predicates:
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.solvway.gateway;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
/** add-zh-cn-messages: mobile-api reaches services-system's /locale/* language registry through the gateway. */
|
||||
class LocaleRouteTest {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("unchecked")
|
||||
void localePathsRouteToServicesSystem() throws Exception {
|
||||
try (InputStream in = getClass().getResourceAsStream("/application.yml")) {
|
||||
Map<String, Object> yml = new Yaml().load(in);
|
||||
Map<String, Object> gateway = (Map<String, Object>) ((Map<String, Object>) ((Map<String, Object>) yml.get("spring")).get("cloud")).get("gateway");
|
||||
List<Map<String, Object>> routes = (List<Map<String, Object>>) gateway.get("routes");
|
||||
assertThat(routes).anySatisfy(r -> {
|
||||
assertThat(r.get("uri")).isEqualTo("http://${app.services.name.system}");
|
||||
assertThat((List<String>) r.get("predicates")).contains("Path=/locale/**");
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user