Newer
Older
web-services / biblio-tools / v1 / crossref / prefixes / expand.ini
@Nicolas Thouvenin Nicolas Thouvenin on 25 May 2022 2 KB fix: use standard parser
# OpenAPI Documentation - JSON format (dot notation)
mimeType = application/json

post.operationId = post-v1-crossref-prefixes-expand
post.description = Verbalisation du préfixe DOI à partir d'un DOI complet ou juste à partir du préfixe
post.summary = verbalisation à partir d'un tableau d'objets avec à minima un champ value contenant le DOI
post.tags.0 = biblio-tools
post.requestBody.content.application/json.example.0.id = 1
post.requestBody.content.application/json.example.0.value = 10.4000/edc.9014
post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream
post.requestBody.required = true
post.responses.default.content.application/json.example.0.id = 1
post.responses.default.content.application/json.example.0.value = OpenEdition
post.responses.default.content.application/json.schema.$ref =  #/components/schemas/JSONStream
post.responses.default.description = Les prefixes DOI en verion textuel
post.parameters.0.description = Indenter le JSON résultant
post.parameters.0.in = query
post.parameters.0.name = indent
post.parameters.0.schema.type = boolean


# Necessary plugins
[use]
plugin = basics
plugin = analytics

# Flow configuration
[JSONParse]
separator = *

[expand]
path = value
size = 1
cacheName = post-v1-crossref-prefixes-expand

[expand/assign]
path = value
value = get('value').split('/').filter(i => i.match(/^10./)).pop()

# On crée une URL uniqument avec les prefixes non vides
[expand/swing]
test = get('value').isEmpty()
reverse = true

[expand/swing/assign]
path = url
value = fix('https://api.crossref.org/prefixes', self.value).join('/')

[expand/swing/URLFetch]
target = result
url = get('url')
json = true
timeout = 60000
noerror = true
retries = 1

[expand/swing/replace]
path = id
value = get('id')

path = value
value = get('result.message.name', 'n/a')

[expand/transit]

# On marque les prefixes vides (qui n'ont pas été traité par le swing précédent)
[expand/swing]
test = get('value').isEmpty()

[expand/swing/assign]
path = value
value = fix('n/a')

[dump]
indent = env('indent', false)