tmtsoftware / icd

ICD - Interface Control Document Management
Other
12 stars 5 forks source link

Nested array command argument rendered with incorrect dimensions #24

Closed edwardchapin closed 8 years ago

edwardchapin commented 8 years ago

I have been experimenting with release 0.1 and notice that the following command description (this is one element of "receive" in command-model.conf):

{
        name = MOVE_PROBES
        description = "Move probes to the target X, Y position in ICRS coordinates and stop."
        requiredArgs = [moveFlag, moveCoords]
        args = [
            {
                name = moveFlag
                description = "Indicate which probes are to be moved."
                type = array
                dimensions: [3]
                items = {
                    type = boolean
                }
            }
            {
                name = moveCoords
                description = "X,Y coordinate pairs for each probe (mm)"
                type = array
                dimensions: [3]
                items = {
                    type = array
                    dimensions: [2]
                    items = {
                        type = float
                    }
                }
            }
        ]
    }

Is rendered both in the web page and the PDF as:

moveFlag  Indicate which probes are to be moved. array[3] of boolean
moveCoords X,Y coordinate pairs for each probe (mm) array[3] of array[3] of float

The "type" column should say array[3] of array[2] of float instead of array[3] of array[3] of float.

abrighton commented 8 years ago

I'll look into the bug. In this release we added an easier way to define arrays that comes out correct. Try using this format:

  {
    name = MOVE_PROBES
    description = "Move probes to the target X, Y position in ICRS coordinates and stop."
    requiredArgs = [moveFlag, moveCoords]
    args = [
      {
        name = moveFlag
        description = "Indicate which probes are to be moved."
        type = array
        dimensions: [3, 2]
        items = {
          type = boolean
        }
      }
      {
        name = moveCoords
        description = "X,Y coordinate pairs for each probe (mm)"
        type = array
        dimensions: [3, 2]
        items = {
          type = float
        }
      }
    ]
  }

In this case dimensions is a list of array dimensions, so that you don't need to nest the JSON array declarations.

edwardchapin commented 8 years ago

This alternative is basically letting me define an n-dimensional array which isn't quite the same thing, but clearly it will suffice for the time being.

abrighton commented 8 years ago

I checked in a fix for this to the icd master branch.