Petersoj / alpaca-java

A Java API for Alpaca, the commission free, algo friendly, stock trading broker. https://alpaca.markets
https://petersoj.github.io/alpaca-java/
MIT License
197 stars 82 forks source link

jsonschema2pojo causes exception failed: trying to create the same field twice: t #33

Closed peterboivin closed 4 years ago

peterboivin commented 4 years ago

I did some research on this and I don't think you could do anything about this, but I thought I would just make you aware of it.

Failed to execute goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:1.0.1:generate (default) on project alpaca-java: Execution default of goal org.jsonschema2pojo:jsonschema2pojo-maven-plugin:1.0.1:generate failed: trying to create the same field twice: t -> [Help 1]

Petersoj commented 4 years ago

This shouldn't be happening on the latest master branch.

git clone https://github.com/mainstringargs/alpaca-java/
cd alpaca-java/
./gradlew clean build

works flawlessly. My merged PR #21, uses schemas instead of JSON sources so we can better control the actual names in the generated POJOs. I actually created a PR in jsonschema2pojo for this very issue when using JSON sources here: https://github.com/joelittlejohn/jsonschema2pojo/pull/1031 Again, this isn't a problem anymore (in this library anyway) because we're using schemas. Please try the script above and confirm that it builds.

mainstringargs commented 4 years ago

Thanks @udarnick, please advise if @Petersoj's suggestions fixed your issue.

peterboivin commented 4 years ago

After using gradle (I am usually a maven guy), it worked for me. Maybe this will be reason enough to convert me over to gradle.

Petersoj commented 4 years ago

Yeah the way we're creating the POJOs from JSON schemas really requires gradle so that we can do a lot more configuration to that build task rather than simply using the provided configuration in XML tags. This sounds like it's good to close @mainstringargs