Skip to content

Conversation

pieterdp
Copy link
Contributor

Add the raw_parser option to pass XML parsed by AOI::Parser::raw directly to the exporter. See this issue in Datahub-Factory.

my $response;

$response = $self->client->post($url, Content_Type => 'application/lido+xml', Authorization => sprintf('Bearer %s', $token), Content => $data);
my $enc_data = encode_utf8($data);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you this here? What's the added benefit of doing an encode_utf8()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If $data contains non-ascii-characters, the client will fail.

return $self->api->update($data->{'id'}, $data->{'_'});

if ($self->store->raw_parser == 1) {
return $self->api->add($data->{'_metadata'});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the Datahub API should make any assumptions about the datamodel of the incoming data. the _metadata construct is a typical ouptput of OAI. I think this would violate the open/closed principle.

Maybe a separate optional parser object could be injected here. Maybe not in the API implementation itself, but right before the data is passed of to this method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, should be part of the transformation (perhaps in a fix?).

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.

2 participants