-
Notifications
You must be signed in to change notification settings - Fork 303
Add CSV mapper for REST server #606
Comments
Remove sample ThreadLocals
Module CSV
Just stumbled over your work here. Nice feature enhancement. I wanted to suggest that you put that code to a separate module but as it seems you already did all that ( |
BTW: Are you also proposing this for large arrays to reduce overhead (we discovered some bandwidth issues for larger array datasets with JSON as all the property names are redundantly repeated). As it seems your solution is based on jackson and therefore perfectly integrated. Excited to see this coming... |
Hi Jörg and thanks for your encouraging comments ! This feature was intended to filter out columns we don't want to see in a CSV file. In fact Jackson parses every property and this may throw exceptions if the property is a composite object. The CSV values must always be simple object like Strings. Indeed it seems it can be used to reduce overhead for large arrays but it hasn't been tested this way. |
The PR has been created here Still I do not understand why the build does not work... Edit : resolved by ignoring not implemented test CsvProviderTest |
Ignore not implemented test
Multiple DateFormats
A default JSON mapper is already bundled with OASP4J. It may also include a default CSV mapper.
This CSV mapper should :
@Produces
and@Consumes
on the targeted APICSV format
HTTP Headers
What we send
We are sending CSV.
Order and column names (as seen by Jackson). It should correspond to Eto fields.
Column name can differ from field name with
@JsonProperty
annotation.If not specified client should include column names at the first line of its body.
CSV default separator is
,
but client may use another one.If not specified server should use
,
separator.CSV default quote char is
"
but client may use another one.If not specified server should use
"
quote char.What we want to receive
We want to receive CSV.
Order and column names we want to receive. See
Content-Columns
.The
Content-Columns
of the server response must exactly match this client header.If not specified server may use whatever columns it wants to include in its response.
Same as
Content-Column-Separator
when we want the server to use a specific CSV separator.If not specified server should use
,
separator or server should include a correctContent-Column-Separator
to specify which separator is used.Same as
Content-Quote-Char
when we want the server to use a specific CSV quote character.If not specified server should use
"
quote character or server should include a correctContent-Quote-Char
to specify which separator is used.CsvFormat Object
Here is what can be configured :
Usage
You can create a default CSV Format :
And create another one based on this one :
Then we may read some CSV content :
Or write Eto to a CSV file :
The text was updated successfully, but these errors were encountered: