diff --git a/affiliations-tools/examples.http b/affiliations-tools/examples.http index f9f91f8..a4f4728 100644 --- a/affiliations-tools/examples.http +++ b/affiliations-tools/examples.http @@ -36,11 +36,13 @@ Content-Type: application/json [ - { "id":1, "value": "CNRS UMR AMAP MONTPELLIER FRA" }, - { "id":2, "value": "IRD UMR AMAP MONTPELLIER FRA" }, - { "id":3, "value": "University of Bordeaux, IMS, CNRS UMR5218, Talence, F-33405, France" }, - { "id":4, "value": "CENBG, CNRS/IN2P3, Chemin du Solarium B. P. 120, Gradignan, F-33175, France" }, - { "id":5, "value": "Nulle part" } + { "id":1, "value": { "year": "2021", "address": "CNRS UMR AMAP MONTPELLIER FRA" } }, + { "id":2, "value": { "year": "2021", "address": "IRD UMR AMAP MONTPELLIER FRA" } }, + { "id":3, "value": { "year": "2021", "address": "University of Bordeaux, IMS, CNRS UMR5218, Talence, F-33405, France" } }, + { "id":4, "value": { "year": "2021", "address": "CENBG, CNRS/IN2P3, Chemin du Solarium B. P. 120, Gradignan, F-33175, France" } }, + { "id":5, "value": { "year": "2021", "address": "Nulle part" } } + { "id":6, "value": { "address": "Intemporel" } } + { "id":7, "value": { "address": "Inist-CNRS, UPS76, 2 rue Jean Zay, Vandoeuvre-lès-Nancy" } } ] ### diff --git a/affiliations-tools/swagger.json b/affiliations-tools/swagger.json index f214376..523201c 100644 --- a/affiliations-tools/swagger.json +++ b/affiliations-tools/swagger.json @@ -95,6 +95,52 @@ "RNSR": { "type": "string", "pattern": "^[0-9]{9}[A-Z]$" + }, + "IdYearAddresses": { + "type": "array", + "items": { + "$ref": "#/components/IdYearAddress" + } + }, + "IdYearAddress": { + "type": "object", + "properties": { + "id": { + "type": "number" + }, + "value": { + "type": { + "$ref": "#/components/YearAddress" + } + } + } + }, + "YearAddress": { + "type": "object", + "properties": { + "year": { + "type": "string", + "format": "date" + }, + "address": { + "type": "string" + } + } + }, + "IdRNSRs": { + "type": "array", + "items": { + "$ref": "#/components/IdRNSR" + } + }, + "IdRNSR": { + "type": "object", + "properties": { + "id": "number", + "value": { + "$ref": "#/components/RNSR" + } + } } } } \ No newline at end of file diff --git a/affiliations-tools/v1/rnsr/json.ini b/affiliations-tools/v1/rnsr/json.ini index de8f281..a972d0b 100644 --- a/affiliations-tools/v1/rnsr/json.ini +++ b/affiliations-tools/v1/rnsr/json.ini @@ -1,33 +1,20 @@ # OpenAPI Documentation - JSON format (dot notation) post.responses.default.description = Return a JSON, composed of `id`, `value`, where value is found `RNSR`(s) -post.responses.default.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.responses.default.content.application/json.schema.$ref = #/components/IdYearAddresses post.summary = Find RNSR to address given in `value`, when possible post.requestBody.required = true -post.requestBody.content.application/json.schema.$ref = #/components/schemas/JSONStream +post.requestBody.content.application/json.schema.$ref = #/components/IdRNSRs post.requestBody.content.examples.bordeaux.summary = University of Bordeaux address post.requestBody.content.examples.bordeaux.value.id = 3 -post.requestBody.content.examples.bordeaux.value.value = University of Bordeaux, IMS, CNRS UMR5218, Talence, F-33405, France +post.requestBody.content.examples.bordeaux.value.value.address = University of Bordeaux, IMS, CNRS UMR5218, Talence, F-33405, France +post.requestBody.content.examples.bordeaux.value.value.year = 2021 [use] plugin = basics plugin = conditor [JSONParse] -[replace] -path = id -value = get("id") - -path = authors -value = get("value").toArray("Chaîne").reduce((s,c) => [{affiliations:[{address:s[0].affiliations[0].address+c}]}], [{affiliations:[{address:""}]}]) - -[affAlign] - -[replace] -path = id -value = get("id") - -path = value -value = get("authors.0.affiliations.0.conditorRnsr") +[getRnsr] [JSONString] indent = env('indent', true)