Open sravanthik07 opened 4 years ago
You may be going about this the wrong way. Should I do what you want, you would be breaking the RAML spec: Your declaration should be
types:
mytype:
billingAccountId: string | nil
I'll check with the parser to make sure.
Otherwise, there are two ways to do this:
1) Redefine the contents of the jackson plugin by having a META-INF/ramltopojo-plugin.properties
file with your own plugin definition like:
myown.jackson2=\
myown.jacksonfix.JacksonBasicExtension,\
org.raml.ramltopojo.extensions.jackson2.JacksonDiscriminatorInheritanceTypeExtension,\
org.raml.ramltopojo.extensions.jackson2.JacksonScalarTypeSerialization,\
org.raml.ramltopojo.extensions.jackson2.JacksonUnionExtension,\
org.raml.ramltopojo.extensions.jackson2.JacksonEnumExtension,\
org.raml.ramltopojo.extensions.jackson2.JacksonAdditionalProperties
The myown.jacksonfix.JacksonBasicExtension
would contain the fixed JacksonBasicExtension code.
2) You could write you own plugin that could fix the annotation so that you get what you want.
I'll get back to you on thursday.
Hi JP Belanger, Thank you for the quick response. I tried this option - billingAccountId: string | nil Exception on maven build : Error generating Java classes from: null: can't fetch type named string | nil
I will try the other approach's too.
Yes, the string|nil fix was recently fixed. try the current snapshot version from the mulesoft maven repository.
I'm going to be releasing it next week.
Ok sure. I will check on it. We have another use case to solve. Here is the screenshot:
Any way that RAML can add schema to the XML payload? How to get rid of wrappers in xml payload?
Hi @jpbelang , Any clues on adding schema to XML payload?
Sorry, got Christmassed.
Looking now.
I 'm pretty sure I support this:
I think, this will help, but i have to construct the response payload based on the ACCEPT.MEDIATYPE from Request headers. For example, if ACCEPT is json, the following code should give me JSON payload. But since, the Person if having xml attribute, will json works here?
types:
Person:
properties:
name:
type: string
xml:
attribute: true # serialize it as an XML attribute
name: "fullname" # attribute should be called fullname
addresses:
type: Address[]
xml:
wrapped: true # serialize it into its own
The annotations are on the data objects. The serialization should depend on the incoming HTTP headers.
Hi, I have requirement to print 'null' values in json response. For that the generated java classes should @JsonInclude(JsonInclude.Include.ALWAYS). I tried to get some help inn searching across the git but I found "NOT_NULL" is hard coded in "JacksonBasicExtension". Please help us to find the solution.