Skip to content

Generate nested resource #2127

@amirtaherkhani

Description

@amirtaherkhani

Describe the bug
Running the relational resource generator with a nested path creates an extra leading dash segment and nests files incorrectly (e.g., src/transactions/-sleeves-transactions/transactions/...) instead of the expected src/transactions/sleeves-transactions/....

Steps :

Run npm run generate:resource:relational -- transactions/SleevesTransaction.
Inspect the generated folders/files under src/transactions.
See files placed in src/transactions/-sleeves-transactions/transactions/ with duplicated transactions and a leading dash in the slug.
Expected behavior
The generator should respect the provided nested path and produce files in src/transactions/sleeves-transactions/ with correctly sluggified names (no leading dash, no duplicated folder).

Screenshots
Image

OS: MacOS 26.2
NodeJS Version : 24.11.0
Database: PostgreSQL

Additional context:
The Hygen templates for relational-resource use h.inflection.transform(name, ['pluralize','underscore','dasherize']) directly on the input string, so when the input includes a path (transactions/SleevesTransaction), the slash is treated as text and produces the extra - segment.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions