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

pica_add() doesn't work if hash key 'record' not exists #77

Closed
jorol opened this issue Mar 4, 2022 · 2 comments
Closed

pica_add() doesn't work if hash key 'record' not exists #77

jorol opened this issue Mar 4, 2022 · 2 comments
Labels

Comments

@jorol
Copy link
Contributor

jorol commented Mar 4, 2022

$ echo '{"title":"code4lib"}' | catmandu convert JSON to PICA --type Plain --fix 'pica_add(title,021A$a)'
PICA record must be array reference
$  echo '{"title":"code4lib"}' | catmandu convert JSON to PICA --type Plain --fix 'pica_add(title,021A$a,record:"pica")'
PICA record must be array reference
$echo '{"title":"code4lib"}' | catmandu convert JSON to YAML --fix 'pica_add(title,021A$a)'
---
title: code4lib
...

Works if key is defined beforehand:

echo '{"title":"code4lib"}' | catmandu convert JSON to PICA --type Plain --fix 'set_array(record);pica_add(title,021A$a)'
021A $acode4lib

@nichtich nichtich added the bug label Apr 8, 2022
@nichtich
Copy link
Member

I'll create pica_update(PATH, value) instead and depracte pica_add because of the order of arguments (see #82).

@nichtich
Copy link
Member

Fixed in 1.14 to be released today.

nichtich added a commit that referenced this issue May 26, 2023
Changelog diff is:

diff --git a/Changes b/Changes
index a229989..5626a88 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,8 @@
 Changelog for Catmandu-PICA
 
 {{$NEXT}}
+
+1.14 2023-05-26T06:13:27Z
   - pica_add creates missing record (#77)
 
 1.13 2023-04-14T09:01:25Z
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants