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 java codegen from json schema #14

Merged
merged 6 commits into from
Aug 8, 2020
Merged

Conversation

cgardens
Copy link
Contributor

@cgardens cgardens commented Aug 7, 2020

This PR:

  • adds the json schema discussed in the config PR (todo: i need to add ids to all the objects, e.g. source id, sync attempt id, etc)
  • generates java objects based on json schema. Subsequent PRs will rely on this so that when we deserialize configs from disk we can treat them as strongly typed java objects instead of json blobs.
  • note: we will probably have to write converters to convert from these generated types to the swagger generated types, which is a bit of a slog, but i can't think of anything better. (i miss typescript duck typing :D)

dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'

// Required if generating JSR-303 annotations
Copy link
Contributor Author

Choose a reason for hiding this comment

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

todo: i need to understand these configs a little better, i suspect we just need the jackson and joda ones.

group 'io.dataline.conduit'
version '0.1.0'

//https://github.com/joelittlejohn/jsonschema2pojo/tree/master/jsonschema2pojo-gradle-plugin
Copy link
Contributor Author

@cgardens cgardens Aug 7, 2020

Choose a reason for hiding this comment

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

todo: i'm a little at a loss here. i think this project is deprecated, but there is a replacement. there are also new releases on maven central. need to do a little more homework to make sure i'm using the right one / non-deprecated one.

compile 'javax.validation:validation-api:1.1.0.CR2'
// Required if generating Jackson 2 annotations
compile 'com.fasterxml.jackson.core:jackson-databind:2.9.7'
// Required if generating JodaTime data types
Copy link
Contributor

Choose a reason for hiding this comment

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

Can't you generate in Java8 format? (almost of clone of joda)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

probably. i'll check.

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