-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
Description
When defining routes with a specific domain in AdonisJS (v7), the tuyau registry generator ignores the domain property. This results in:
- All routes being grouped under a flat
routesobject without domain distinction. urlForgenerating relative paths (e.g.,/v1/teste) that fail when the application expects a specific subdomain (e.g.,api.localhost).- Type definitions not reflecting the domain constraints of the routes.
Reproduction
In start/routes.ts:
router
.get('teste', ctx => {
return ctx.response.json({ message: 'Hello World' })
})
.domain('api')
.prefix('v1')
.as('api.v1.teste')Output of node ace list:routes --json:
[
{
"domain": "root",
"routes": [ ... ]
},
{
"domain": "api",
"routes": [
{
"name": "api.v1.teste",
"pattern": "/v1/teste",
"methods": ["GET"],
...
}
]
}
]Generated .adonisjs/client/registry/index.ts:
const routes = {
// ... other routes
'api.v1.teste': {
methods: ["GET","HEAD"],
pattern: '/v1/teste',
tokens: [...],
types: placeholder as Registry['api.v1.teste']['types'],
},
} as const satisfies Record<string, AdonisEndpoint>Note that there is no domain property in the generated routes object for api.v1.teste.
Environment
@tuyau/core: 1.0.0-beta.9@adonisjs/core: 7.0.0-next.16- Node.js: 25.0.3
Expected Behavior
The generated registry should include domain information for each route, and urlFor should respect these domains when generating URLs (potentially including the domain in the output if it differs from the current one).
Metadata
Metadata
Assignees
Labels
No labels