Skip to content

Update swagger Dashboard Colors to be types individual types usign OneOf for validation #17030

Open
@jsteenb2

Description

@jsteenb2

Right now we have the following, which doesn't validatie the needs of a given view. This allows for any colors to be provided, not necessarily the ones that are required. I'd recommend making these color validations accurate, where for Gauge it would require the min and max for instance. I'm assuming these are required for gauge, that may be in error. Would be nice to provide swagger that provides a wholistic view of the View properties' color requirements.

GaugeViewProperties:
      type: object
      required: [type, queries, colors, shape, note, showNoteWhenEmpty, prefix, tickPrefix, suffix, tickSuffix, legend, decimalPlaces]
      properties:
        type:
          type: string
          enum: [gauge]
        queries:
          type: array
          items:
            $ref: "#/components/schemas/DashboardQuery"
        colors:
          description: Colors define color encoding of data into a visualization
          type: array
          items:
            $ref: "#/components/schemas/DashboardColor"
        shape:
          type: string
          enum: ['chronograf-v2']
        note:
          type: string
        showNoteWhenEmpty:
          description: If true, will display note when empty
          type: boolean
        prefix:
          type: string
        tickPrefix:
          type: string
        suffix:
          type: string
        tickSuffix:
          type: string
        legend:
          $ref: '#/components/schemas/Legend'
        decimalPlaces:
          $ref: "#/components/schemas/DecimalPlaces"

# snip
DashboardColor:
      type: object
      description: Defines an encoding of data value into color space.
      required: [id, type, hex, name, value]
      properties:
        id:
          description: The unique ID of the view color.
          type: string
        type:
          description: Type is how the color is used.
          type: string
          enum:
            - min
            - max
            - threshold
            - scale
            - text
            - background
        hex:
          description: The hex number of the color
          type: string
          maxLength: 7
          minLength: 7
        name:
          description: The user-facing name of the hex color.
          type: string
        value:
          description: The data value mapped to this color.
          type: number
          format: float

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions