Smart naming when generating services
See original GitHub issueHi,
I’m consuming an API that has this path: /api/v1/management/organizations
This generates a OrganizationsService
, which is fine, but there is no mention of management, or even v1 anywhere.
If we assume that the service name should be whatever comes after /api
We could get V1ManagementOrganizationsService
It’s horrible, but it works.
Another option is to generate those services in folders following the path, so:
/core
/models
/services
/v1
/management
OrganizationsService.ts
v1 and management don’t have anything so we could create just a placeholder object to have the reference to the children:
export class V1{
public static Management: Management = Management
}
export class Management{
public static Organizations: OrganizationsService = OrganizationsService
}
//we have this already
export class OrganizationsService {
}
Following the previous snippet, I could now just V1.Management.Organizations.getAll()
I’m doing this currently by hand, and would be nice to automate it 😃
Cheers
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (2 by maintainers)
Top Results From Across the Web
10 Do's And Don'ts For Smart Naming
9. Do embrace emotion. Reason alone does not a great name make. Instead of being totally left-brain, you should let some intuition guide...
Read more >A Smarter Approach to Naming Conventions - Adverity
A powerful aspect of the Smart Naming Conventions feature is its ability to spot missing values based on neighbouring ones. It then politely ......
Read more >The Power of Smart Document Names - The Grizzly Labs
Smart Document Names are a powerful feature of Genius Scan+ (the pro ... To create a smart document name, you can combine various...
Read more >Configure the Name Generator Service - Intergraph Smart 3D
Search for and open Services. The Services window displays. Right-click the Intergraph Smart 3D Name Generator service, and then select Properties.
Read more >268 Creative Business Name Ideas (Curated, Not Generated!)
Ditch the business name generators and use this list of over 200 creative, catchy, ... Catchy business name ideas; Smart business name ideas ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
x-service-name: string[]
is what we used in the past.@ferdikoomen Came here to say I would really like this feature. I’ve built some custom-generators using the openAPI library and it was super easy to just extend the SpringCodeGen and write some custom normalization logic for my method names. It’s a game changer for me.