Uploaded image for project: 'RAML Module Builder'
  1. RAML Module Builder
  2. RMB-538

JSON validation: read-only sub-fields, translation code

    XMLWordPrintable

Details

    • CP: Roadmap backlog
    • 2
    • Core: Platform

    Description

      Working on MODINVSTOR-392 I have faced with the issue that RMB is not able to handle readonly sub-fields, i.e.:

      // Item
      {
        "status": {
          "description": "The status of the item",
          "type": "object",
          "properties": {
            "name": {
              "description": "Name of the status e.g. Available, Checked out, In transit",
              "type": "string"
            },
            "date": { // <-- date here is readonly.
              "description": "Date and time when the status was last changed",
              "type": "string",
              "format": "date-time",
              "readonly": true
            }
          },
          "additionalProperties": false
        }
      }
      

      As you can see status.date here is read only field. however status.name is not.

      The issue seems here RestVerticle.java#L1506.

      RMB tries to remove the field:

      ((JsonObject)content).remove(cv.getPropertyPath().toString());
      

      But cv.getPropertyPath() has status.date value, which is not valid argument for the remove method and it should be content.getJsonObject("status").remove("date") instead.

      TestRail: Results

        Attachments

          Issue Links

            Activity

              People

                Unassigned Unassigned
                bohdan-suprun Bohdan Suprun
                Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved:

                  TestRail: Runs

                    TestRail: Cases