Open jpbelang opened 4 years ago
I found the place where to fix. I'm on it. I will send you a pull request when i'm finished.
OK, i'm done. Just need to write some test cases, to show that everyhing is working correctly.
All currently setup tests are running without any problems. My changes are more extensive then i thought in the beginning.
Following things needed to be changed:
TODO:
I hope this will help you and it will find its way into the next release as soon as possible. There is already one more feature i've seen that needs to be done. It's the validation of url parameters (i will do that in the next week, requiring jsr349 standard).
Best regards Philipp
I'm going to be reviewing this Sunday (work has me busy....)
I've merged and added a couple of tests.
NilUnionTypeImpl nilUnionType = new NilUnionTypeImpl();
ObjectMapper mapper = new ObjectMapper();
StringWriter out = new StringWriter();
mapper.writeValue(out, nilUnionType);
NilUnionType b = mapper.readValue(new StringReader(out.toString()), NilUnionType.class);
assertTrue(b.isNil());
}
This seems to fail. I'm working on something to fix it from .getNullValue(ctxt)
from the Deserializer class. Would you agree ?
Also, not sure if this generated code is necessary for nil types.
if (node.isNull()) {
return new NilUnionTypeImpl(null);
}
In #42. (I just don't want to break or go against your very helpful pull request).
Oh yeah, that's the bug. Null types should be created by the emtpy constructor, otherwise the value construcot is used and thhe wrong enum is set. Therfore we should also add a not null test to value constructors. I can do this tomorrow if you want. I'll send you a new request for this.
I'll merge the other PR. Give it a look then.
Damn, that's a big class full of if statements. That parser gets on my nerves :-)
There is one thing I would ask you to do: look at this class org.raml.ramltopojo.extensions.jackson1.JacksonScalarTypeSerialization#fieldBuilt
: dates need to be formatted according to RAML rules. Could you add appropriate logic please and one or two tests ?
If you don't have the time, I'll merge on the weekend and do the work. (Last stretch before christmas at work, I don't have tons of time during the week).
I'm on it
I fixed the date stuff and added some tests. The commit was added to the pull request (Fix/union #43).
The serialization needed to be handled seperately. JacksonScalarTypeSerialization can't be used for this, as unions are not serialized as objects, but only single entries of it. I added a date formatter for writing and reading objects with patterns defined in JacksonScalarTypeSerialization.
Should be fine so far.
Best regards
https://github.com/mulesoft-labs/raml-for-jax-rs/issues/414