Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

RAML to JAX-RS: Overrule the convention for the resource interface name #111

Closed
ok11 opened this issue Jun 25, 2015 · 2 comments
Closed

Comments

@ok11
Copy link

ok11 commented Jun 25, 2015

I would appreciate if you provide a way to give custom names to the generated resource interfaces.
The problem is, that the current generator seems to take the name for the "root" resource (i.e. the top one) to give a name to the resource interface.
In my case the resources, described in the RAML file, have the following path:

/{tenantId}/{userId}/images/...

So semantically speaking, "Images" would be the right name, whereas in reality I get "TenantId". Not really a big deal, but looks a bit weird.
Neither in the Configuration class nor in the AbstractGenerator/Generator I found a way to overrule that. Did I miss anything? If not, would it be possible to add such a feature?

Thanks in advance.

@KonstantinSviridov
Copy link
Contributor

Hi, @ok11

We have implemented extensions for custom interface naming. The interface is

org.raml.jaxrs.codegen.core.ext.InterfaceNameBuilderExtension

and here you may learn how to use extensions: #105

Note that inside any extension you have access to the whole RAML model. Thus, you may use information about the whole set of resources when composing name for each of them.

Regards, Konstantin.

@KonstantinSviridov
Copy link
Contributor

Hi, @ok11

My exmaple in #105 contained one error: returning false in the AddParameterFilter method prevents all RAML parameters from apperaing as arguments of JAX RS method. So, the method must return true.

Please, keep it in mind.

I've edited the comment in order to make it a correct example.

Regards,
Konstantin

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants