Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quest][wip] stateless metadata rendering #790

Draft
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

aaxelb
Copy link
Contributor

@aaxelb aaxelb commented Dec 17, 2021

quick lil experiment: use share as a renderer for (potentially private) metadata -- just render on request, don't store anything

all specifics still up in the air

example usage:

import requests

# works for only oai_dc at the moment
url = 'http://localhost:8000/api/v2/pls-render-metadata?metadata_formats=oai_dc'
request_body = [
  {'@id': '_:a', '@type': 'creativework', 'title': 'foo'},
  {
    '@id': '_:b',
    '@type': 'workidentifier',
    'creative_work': {'@id': '_:a', '@type': 'creativework'},
    'uri': 'http://example.com/foo',
  },
]
response = requests.post(url, json.dumps(request_body))
assert response.json() == ['<oai_dc:dc xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ http://www.openarchives.org/OAI/2.0/oai_dc.xsd"><dc:title>foo</dc:title><dc:type>creativework</dc:type><dc:identifier>http://example.com/foo</dc:identifier></oai_dc:dc>']

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.03%) to 84.333% when pulling 2070b57 on aaxelb:quest/stateless-metadata-render into c7715af on CenterForOpenScience:develop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants