papinet / papiNet-API

papiNet is a global paper, forest products and bioproducts industry e-Business initiative.
http://www.papinet.org/
Apache License 2.0
9 stars 3 forks source link

Add `safetyAndEnvironmentalInformationDetails[]` to `LogisticsDeliveryNoteById.lineItems[]`, and `DeliveryInstructionById.sequences[].lineItems[]` #153

Open patricekrakow opened 1 week ago

patricekrakow commented 1 week ago

In XML, the element is called SafetyAndEnvironmentalInformation (XML). It's a bit annoying as (1) we want to have it as an array, and (2) there is no plural form of "information" in English. A way - to be discussed/approved later - to fix this is to add the suffix (...)Details. We will then use safetyAndEnvironmentalInformationDetails (JSON).

We will not JSON-ify the complete structure of the XML element SafetyAndEnvironmentalInformation, but only select the following parts:

WARNING: This list probably needs to be restricted dependending of the context, i.e. safetyAndEnvironmentalInformationDetails.

The complete structure will look like the following:

{
  "safetyAndEnvironmentalInformationDetails": [
    {
      "type": "FSCMixCredit",
      "assignedBy": "FSC",
      "chainOfCustody": {
        "value": "INS-COC-100054"
        "assignedBy": "..."
      }
    },
    { }
  ]
}
patricekrakow commented 1 week ago

Done, see commit a3218cf.

patricekrakow commented 2 days ago

I missed the Lars' proposal for the JSON-ification of SafetyAndEnvironmentalInformation (XML).

Here it is: (from email sent on Wed, Jun 26, 8:20 PM)

[Uploading papiNet API schema snippets 2024-06-10.yaml.txt…]()

safetyAndEnvironmental:
  type: object
  required:
    - type
    - assignedBy
  properties:
    # quantity and freeText existing in XML not added
    # certification now limited to a percentage, in XML a measurement value.
    type: 
      type: string
      enum:
        - Deforestation
        - FSC100%
        - FSCControlledWood
        - FSCMix_x%
        - FSCMixCredit
        - FSCRecycled_x%
        - FSCRecycledCredit
        - PEFCControlledSources
        - X%_PEFCcertified
    assignedBy:
        type: string
        enum:
          - EU
          - FSC
          - PEFC
    licenceNumber:
      type: string
      minLength: 1
    chainOfCustoty:
      type: object
      required: value
      properties:
        certificationBody:
          type: string
          minlength: 1
        value:
          type: string
          minlength: 1
    certificationPercentage:
      type: Number
      exclusiveMinimum: 0
    references:
      type: array
      minItems: 1
      items:
        type: object
        required: 
          - identifier
        properties:
          identifier:
            type: object
            required:
              - type
              - value
            properties:
              type:
                type: string
                enum:
                  - EUDRDueDiligenceStatementReferenceNumber
              value:
                type: string
                minlength: 1
          subReference:
            type: object
            required: 
              - identifier
            identifier:
              type: object
              required:
                - type
                - value
              properties:
                type:
                  type: string
                  enum:
                    - EUDRDueDiligenceStatementVerificationNumber
                value:
                  type: string
                  minlength: 1

(I have just corrected a little indentation issue).

I will update the schema accordingly, I just need 2 clarifications:

  1. Do we go for a single object or for a array of objects?
  2. "Environmental" is an adjective - see https://www.oed.com/search/dictionary/?scope=Entries&q=environmental - while property names SHOULD end with a noun. We could use "EnvironmentInformation" as in XML, however "Information" is an uncountable noun that does not have a plural form - see https://dictionary.cambridge.org/grammar/british-grammar/information - which does not make it suitable to be differentiated between a single object (singular) type and an array of objects (plural) type. That's why I would suggest to use safetyAndEnvironmentalInformationDetail or safetyAndEnvironmentalInformationDetails depending on the answer of 1. Any other suggestions?
larsolofsson commented 1 day ago
  1. Change it to an array. Several instances are needed.
  2. My proposal safetyAndEnvironmentDetails
  3. chainOfCustoty: is misspelt. Should be chainOfCustody: