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

At least one identifier should be required for parties and locations, version 3.0.0 #129

Closed larsolofsson closed 2 months ago

larsolofsson commented 5 months ago

In current schema all of them are optional. At least one of them should be required. I propose adding the following to parties anyOf:

A propose adding the following to locations anyOf:

patricekrakow commented 5 months ago

We really need to make a working prototype of this technique (I think the properties section needs to be repeated in every anyOf choice. We also need to verify that Swagger Editor shows it properly.

larsolofsson commented 5 months ago

My proposed schema construct works with Swagger Editor, https://editor.swagger.io, to make at least one identifier required for parties and locations.

It didn't work for Patrice at the last meeting, but he was using the New Swagger Editor, https://editor-next.swagger.io, which is only a beta version.

larsolofsson commented 4 months ago

Schema for making at least one identifier required for a party

    buyerParty:
      type: object
      anyOf:
        - required:
            - id
        - required:
            - partyIdentifiers
      properties:
        id:
          type: string
          format: uuid
        partyIdentifiers:
          type: array
          minItems: 1
          items:
            type: object
            required:
              - value
              - assignedBy
            properties:
              value:
                type: string
                minLength: 1
              assignedBy:
                type: string
                enum:
                  - Supplier
                  - Customer
patricekrakow commented 2 months ago

Done, see commit 13f0199.