Uploaded image for project: 'mod-orders'
  1. mod-orders
  2. MODORDERS-128

PUT orders - handle empty array of the PO lines

    XMLWordPrintable

Details

    • Story
    • Status: Closed (View Workflow)
    • P3
    • Resolution: Done
    • None
    • 3.0.0
    • None
    • ACQ Sprint 55, ACQ Sprint 56
    • 2
    • Thunderjet

    Description

      Requirement:
      In case a request that contains an empty po_lines array, all the PO Lines should be removed... e.g. per the "if the po_line exists in the database but not in the request, remove the po_line" rule.

      Current situation:
      The resulting CompositePurchaseOrder.java model generated based on composite_purchase_order.json schema has

          @JsonProperty("po_lines")
          @JsonPropertyDescription("a list of completely de-referenced purchase order lines")
          @Valid
          private List<PoLine> poLines = new ArrayList<PoLine>();
      

      This means that if request does not include po_lines or includes "po_lines": [] the result is the same i.e. empty List.

      Required change:
      The schema change is required to make these 2 cases different:

      ...
          "po_lines": {
            "description": "a list of completely de-referenced purchase order lines",
            "id": "po_lines",
            "type": "array",
            "items": {
              "type": "object",
              "$ref": "composite_po_line.json"
            },
            "default": null
          },
      ...
      

      In this case if the request does not include po_lines or includes "po_lines": null the result will be absolutely the same i.e. "do not touch PO lines". The business logic should start processing the PO lines only if the field is not null.

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                cmcnally Craig McNally
                piotr_kalashuk Piotr Kalashuk
                Craig McNally Craig McNally
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases