Skip to content

Commit

Permalink
fix: allow json-ld as an rdf format
Browse files Browse the repository at this point in the history
The ckanext-dcat library allows json-ld as a format but in its CONTENT_TYPES map it doesn't include it. This could be a bug in ckanext-rdf but we can resolve it easily enough, and it allows us to override and add more options into this content types map if we like without polluting upstream.
  • Loading branch information
jrdh authored Feb 21, 2024
1 parent 2d03048 commit a145875
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion ckanext/nhm/routes/object.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@
name='specimen', import_name=__name__, url_prefix='/specimen'
)

# add to the default rdf content types to include json-ld as an alias for jsonld
rdf_content_types = {**CONTENT_TYPES, "json-ld": CONTENT_TYPES["jsonld"]}


def _context():
return {
Expand Down Expand Up @@ -106,7 +109,7 @@ def rdf(uuid, _format, version):
}
try:
result = toolkit.get_action('object_rdf')(_context(), data_dict)
return Response(result, mimetype=CONTENT_TYPES[_format])
return Response(result, mimetype=rdf_content_types[_format])
except toolkit.ValidationError as e:
toolkit.abort(409, str(e))

Expand Down

0 comments on commit a145875

Please sign in to comment.