-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support generating types 'by example', using example JSON document instead of a JSON Schema #42
Comments
From joelittl...@gmail.com on February 24, 2012 21:55:31 This project operates on JSON Schema documents (http://json-schema.org). It should be pretty easy to write one for your case. It would look something like: { |
From pavel.finkelshtein on February 25, 2012 05:48:32 |
From joelittl...@gmail.com on February 25, 2012 22:52:25 As you say though, I'm sure it would be quite simple to implement such a tool that could generate POJOs by example (given example json) rather than schema. That's not really the goal of this project but it's something that I might have a play with at some point. I think we can turn this ticket into an enhancement request. If there's enough interest then we could look at including support for this kind of input into jsonschema2pojo. |
From pavel.finkelshtein on February 26, 2012 05:47:06 Thank you for your interest! |
From joelittl...@gmail.com on August 28, 2012 22:25:18 In 0.3.3 documentation for Maven/Ant/CLI will describe a new config property sourceType that can take the value JSONSCHEMA (default) or JSON. Using sourceType=JSON will activate this new behaviour and source files will be assumed to contain example json. |
From pavel.finkelshtein on December 28, 2012 11:47:07 I'm again on way to write new uTorrent client :) Thank you again! Best, |
From joelittl...@gmail.com on January 02, 2013 09:46:05 If you could provide an example then we could discuss some options. |
From pavel.finkelshtein on January 02, 2013 12:57:34 {"build":27079,"files": ["18A6780C343EB9AA52457E875AC750EB4772C952", Here you can see example of really bad API, because things which are objects really are represented as Arrays, but I can't change it, so I should work with what I get. The only thing that may be possible is for every array-object create class, extending some List implementation (e.g. ArrayList) with overriden modification functions - add, addAll and so on. Other way is to implement own realization of List, but I really think that any of this ways will be pain for you. |
From joelittl...@gmail.com on January 03, 2013 09:49:54 |
From pavel.finkelshtein on January 03, 2013 10:08:40 |
Original author: pavel.finkelshtein (February 24, 2012 21:47:31)
What steps will reproduce the problem?
1.create file torrent.json
with contents
{"build":25053, "props":[
{
"hash":"71D6FC08482AEF2903C5994C4842455D5C97CD63",
"trackers":"http://bt.rutracker.org/ann?uk=11111111\r\n\r\nhttp://retracker.local/announce\r\n\r\nhttp://ix.rutracker.net/ann?uk=111111111\r\n
"ulrate":0,
"dlrate":0,
"superseed":0,
"dht":1,
"pex":1,
"seed_override":0,
"seed_ratio":1500,
"seed_time":0
}
]}
What is the expected output?
Some POJO
What do you see instead?
Instead I see emty directory "java-gen"
What version of the product are you using? On what operating system?
I'm using jsonschema2pojo-cli-0.2.1.jar
Ubuntu 11.10 x64
java version "1.7.0_02"
Java(TM) SE Runtime Environment (build 1.7.0_02-b13)
Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode)
Original issue: http://code.google.com/p/jsonschema2pojo/issues/detail?id=42
The text was updated successfully, but these errors were encountered: