Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to set prefixes/suffixes for generated classes #258

Closed
wants to merge 6 commits into from

Conversation

eimarfandino
Copy link
Contributor

No description provided.

@joelittlejohn
Copy link
Owner

Thanks for contributing this. We need some integration tests to make sure this feature works (and is not broken in a future version).

If you check out the tests here:
https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-integration-tests/src/test/java/org/jsonschema2pojo/integration/config

it should be easy to work out how they are written. There are helper functions to invoke the plugin and compile the result.

Could you add a PrefixSuffixIT there? Cheers

@eimarfandino
Copy link
Contributor Author

Sure, I'll add PrefixSuffixIT

@eimarfandino
Copy link
Contributor Author

Done.

@joelittlejohn
Copy link
Owner

Thanks Eimar, it looks like the tests aren't currently passing. Could you take a look?

https://travis-ci.org/joelittlejohn/jsonschema2pojo/jobs/38265276

@eimarfandino
Copy link
Contributor Author

The tests have been updated and they are now passing.

@joelittlejohn
Copy link
Owner

Sorry for the delay. Looking at the code there is just one case I that I think may not work, do your changes in ObjectRule support classes in the default package? (no . in the name)

Also, would you mind squashing all commits into one before I merge this? Many thanks.

@eimarfandino
Copy link
Contributor Author

sure, i'll put them in one commit. why that? I'll check the case you mention tomorrow and you'll see the commit popping up. I think this pull request can be closed, right?

@eimarfandino
Copy link
Contributor Author

How do you pass the default package? like this: ?

ClassLoader resultsClassLoader = generateAndCompile("/schema/properties/primitiveProperties.json", ".", config("classNamePrefix","Abstract"));

@joelittlejohn
Copy link
Owner

Hi Eimar.

sure, i'll put them in one commit. why that?

This is simply to keep a clean history. There's a little discussion of this here:

http://www.booleanknot.com/blog/2013/09/07/pull-requests.html

How do you pass the default package?

Using this test helper you could use an empty string as the package name:

generateAndCompile("/schema/properties/primitiveProperties.json", "", config("classNamePrefix","Abstract"));

@joelittlejohn joelittlejohn added this to the 0.4.7 milestone Nov 29, 2014
@joelittlejohn joelittlejohn changed the title Adding prefix and suffix to the properties Add ability to set prefixes/suffixes for generated classes Nov 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants