nsip / specgen_input_au

Capture of specgen input files
2 stars 0 forks source link

enums are defined as strings, but types resolving to objects #49

Closed opoudjis closed 1 year ago

opoudjis commented 1 year ago

This is something that the Ruby validation under JSON Schema has not caught, but it is a clear error:

enum are defined in JSON Schema as strings:

  AUCodeSetsElectronicIdType:
    type: string
    title: Electronic Id Type
    description: >-

      <ul>
        <li>'01' - Barcode</li>
        <li>'02' - Magstripe</li>
        <li>'03' - PIN</li>
        <li>'04' - RFID</li>
      </ul>
    oneOf:
    - enum: [ "01" ]
      title: Barcode
    - enum: [ "02" ]
      title: Magstripe
    - enum: [ "03" ]
      title: PIN
    - enum: [ "04" ]
      title: RFID

But references to enums are being marked up as objects!

  ElectronicId:
    type: object
    properties:
      value:
      - description: >-
          <p> Common element used to specify entity identifiers that are read by electronic equipment. </p>
        type: string 
      Type: 
        type: object
        description: >-
          <p>Electronic ID type.</p>
          <ul>
              <li>'01' - Barcode</li>
              <li>'02' - Magstripe</li>
              <li>'03' - PIN</li>
              <li>'04' - RFID</li>
          </ul>
        $ref: '#/definitions/AUCodeSetsElectronicIdType'
        xml:
          attribute: true

"Type" is clearly not of type object at all, and this JSON Schema treatment of codeset references is in error.

This class of warnings,

Example value must conform to the schema: ... property type must be object

accounts for 1242 of 15792 warnings.

opoudjis commented 1 year ago

With this fix and the fix to enums https://github.com/nsip/specgen_input_au/issues/44:

Was 11398 errors and 15792 warnings

Is now 1808 errors and 14848 warnings