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

Allow JSON to be passed as a String to SchemaMapper #475

Merged
merged 1 commit into from
Jan 6, 2016

Conversation

rr-on-gh
Copy link
Contributor

This is a proposed fix for #255 to allow example JSON to be passed to SchemaMapper as String. Currently it needs to be passed as an URL which is not always convenient. Fix #221 only added support for JSON schema. This PR adds support for example JSON as well.

switch (ruleFactory.getGenerationConfig().getSourceType()) {
case JSON:
JsonNode jsonNode = mapper.readTree(json);
schemaNode = schemaGenerator.schemaFromExample(jsonNode);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indentation problem here

@joelittlejohn
Copy link
Owner

Thanks a lot for submitting this, I've made some minor review comments. If you fix these up, I will merge and release this in 0.4.19.

@rr-on-gh
Copy link
Contributor Author

@joelittlejohn I have fixed the code as per your comments. Please review. Thanks!

@joelittlejohn
Copy link
Owner

Thanks @Raks81. One final step, please squash these commits into one.

@rr-on-gh
Copy link
Contributor Author

@joelittlejohn I have squashed the commmits. Please review. Thanks!

joelittlejohn added a commit that referenced this pull request Jan 6, 2016
Allow JSON to be passed as a String to SchemaMapper
@joelittlejohn joelittlejohn merged commit 66642bd into joelittlejohn:master Jan 6, 2016
@joelittlejohn
Copy link
Owner

👍

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.

2 participants