Skip to content

Commit

Permalink
fix(data-format): add SDMX-CSV options
Browse files Browse the repository at this point in the history
The SDMX-CSV predefined media type did not include support for the 2 optional extensions (labels &
timeFormat).

fix #134
  • Loading branch information
sosna committed Aug 17, 2020
1 parent 1acc973 commit 41549bb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/data/data-format.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ formats =
# The SDMX-JSON 1.0.0 data format.
SDMX_JSON_1_0_0: 'application/vnd.sdmx.data+json;version=1.0.0'

# The SDMX-CSV 1.0.0 data format.
# The SDMX-CSV 1.0.0 data format, with default labels and non-normalized periods
SDMX_CSV_1_0_0: 'application/vnd.sdmx.data+csv;version=1.0.0'

# Shortcut for the latest version of SDMX-JSON
Expand All @@ -34,6 +34,15 @@ formats =
# Shortcut for the latest version of SDMX-CSV
SDMX_CSV: 'application/vnd.sdmx.data+csv;version=1.0.0'

# The SDMX-CSV 1.0.0 data format, with ID and name as labels
SDMX_CSV_WITH_BOTH_LABELS: 'application/vnd.sdmx.data+csv;version=1.0.0;labels=both'

# The SDMX-CSV 1.0.0 data format, with normalized periods
SDMX_CSV_WITH_NORMALIZED_PERIODS: 'application/vnd.sdmx.data+csv;version=1.0.0;timeFormat=normalized'

# The SDMX-CSV 1.0.0 data format, with default ID and name as labels, as well as normalized periods
SDMX_CSV_WITH_BOTH_LABELS_AND_NORMALIZED_PERIODS: 'application/vnd.sdmx.data+csv;version=1.0.0;labels=both;timeFormat=normalized'

# Shortcut for the latest version of SDMX-ML Generic
SDMX_ML_GENERIC: 'application/vnd.sdmx.genericdata+xml;version=2.1'

Expand Down
3 changes: 3 additions & 0 deletions test/data/data-format.test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ describe 'Data formats', ->
'application/vnd.sdmx.data+json;version=1.0.0-cts'
'application/vnd.sdmx.data+json;version=1.0.0'
'application/vnd.sdmx.data+csv;version=1.0.0'
'application/vnd.sdmx.data+csv;version=1.0.0;labels=both'
'application/vnd.sdmx.data+csv;version=1.0.0;timeFormat=normalized'
'application/vnd.sdmx.data+csv;version=1.0.0;labels=both;timeFormat=normalized'
]

it 'contains all the expected formats and only those', ->
Expand Down

0 comments on commit 41549bb

Please sign in to comment.