Comments (5)
From [email protected] on December 22, 2010 16:47:27
{"description":"something with additional properties",
"id":"Example",
"properties":{"XXX":{"type":"string"}},
"additionalProperties":true
}
would make
{"XXX":"something",
"another property":"something else"}
valid, and I would expect the Java API to be like:
example.getAdditionalProperty("another property") returns "something else"
or
example.getAdditionalProperties() returns Map<String, Object>
from jsonschema2pojo.
From [email protected] on December 22, 2010 17:36:57
Actually my first code example would conflict if there was actually a property called "AdditionalProperty" - so don't try that :)
from jsonschema2pojo.
From [email protected] on December 22, 2010 19:07:47
Hi Matthew, I've already implemented this one in a local branch. I'm having some strange results when merging back into trunk though - more down to my lack of hg knowledge than any real problem with resolving conflicts.
The details are:
@JsonAnySetter
void setAdditionalProperties(String name, TYPE value) {...}
@JsonAnyGetter
Map<String,TYPE> getAdditionalProperties() {...}
The spec is a little hard to understand but I believe "additionalProperties":true is invalid. The default for additionalProperties is an empty schema (any additional props allowed), if additionalProperties is present it must be either false
(no additional props allowed) or a schema (additional props allowed, but values must be valid according to the given schema).
So "additionalProperties":true should actually be written as "additionalProperties":{} or, alternatively, by not specifying the additionalProperties property at all.
from jsonschema2pojo.
From [email protected] on December 22, 2010 20:43:36
Tip of the day: feature branches are not a good workflow for Mercurial :D
from jsonschema2pojo.
From [email protected] on December 23, 2010 00:06:52
Fixed in 0.1.3
from jsonschema2pojo.
Related Issues (20)
- javaType as Long does not work with latest version but works with 0.4.x HOT 1
- Handling class name clashes when generating POJOs from examples.
- $ref generates classes in wrong package HOT 3
- jsonschema2pojo not generating classes HOT 1
- json schema $ref request address contains separator (':') , NTFS ADS separator (':') in file name is forbidden. HOT 1
- Generated output stays empty HOT 1
- Map generation from standard JsonSchema HOT 2
- Duplicate constructors generated when all properties are required; and both includeAllPropertiesConstructor and includeRequiredPropertiesConstructor are true
- Maven Plugin: inconsistent logging of ClassAlreadyExistsException HOT 1
- Hide sensitive properties from toString() HOT 1
- Question re default keyword on objects
- Different classes are generated for the same named attribute at a different JSONPath location HOT 2
- Json file has JSONObject called Data, but library is generating a Java class called Datum instead of Data. HOT 1
- Generating same class that appears few times in the JSON file HOT 3
- Mirror "deprecated" annotation from JSON schema in the generated code
- Comparison method is created for each array type declared in JSON sample file HOT 2
- Generating constructors using JSON file HOT 13
- Generation failure after upgrade HOT 4
- When is the next release?
- SnakeYAML 1.3.3 vulnerability - upgrade dependency to v2.0 or superior HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jsonschema2pojo.