project-flotta/flotta-operator

Fix swagger validation errors

Closed this issue · 1 comments

Once #164 is merged, swagger.yaml can be validated by running:

make validate-swagger

We'd like to include it as part of the build rule. However, in order to do so, first reported issues need to be fixed:

make validate-swagger 
docker run -it --rm -v /work/go/src/github.com/project-flotta/flotta-operator/.spectral.yaml:/tmp/.spectral.yaml -v /work/go/src/github.com/project-flotta/flotta-operator/swagger.yaml:/tmp/swagger.yaml stoplight/spectral lint --ruleset "/tmp/.spectral.yaml" /tmp/swagger.yaml 

/tmp/swagger.yaml
   1:1   warning  oas2-api-host           OpenAPI "host" must be present and non-empty string.
   2:6   warning  info-contact            Info object must have "contact" object.                        info
  30:9   warning  operation-description   Operation "description" must be present and non-empty string.  paths./data/{device_id}/in.get
  33:11  warning  operation-tag-defined   Operation tags must be defined in global tags.                 paths./data/{device_id}/in.get.tags[0]
  55:10  warning  operation-description   Operation "description" must be present and non-empty string.  paths./data/{device_id}/out.post
  58:11  warning  operation-tag-defined   Operation tags must be defined in global tags.                 paths./data/{device_id}/out.post.tags[0]
  87:9   warning  operation-description   Operation "description" must be present and non-empty string.  paths./control/{device_id}/in.get
  90:11  warning  operation-tag-defined   Operation tags must be defined in global tags.                 paths./control/{device_id}/in.get.tags[0]
 112:10  warning  operation-description   Operation "description" must be present and non-empty string.  paths./control/{device_id}/out.post
 115:11  warning  operation-tag-defined   Operation tags must be defined in global tags.                 paths./control/{device_id}/out.post.tags[0]
 140:32  warning  oas2-unused-definition  Potentially unused definition has been detected.               definitions.device-configuration-message
 152:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.device-configuration-message.properties.workloads.description
 160:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.device-configuration-message.properties.secrets.description
 175:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.device-configuration.properties.os.description
 180:24    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.device-configuration.properties.log-collection.additionalProperties.description
 260:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.metrics-configuration.properties.retention.description
 263:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.metrics-configuration.properties.system.description
 286:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.system-metrics-configuration.properties.allow_list.description
 318:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.workload.properties.data.description
 321:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.workload.properties.imageRegistries.description
 324:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.workload.properties.metrics.description
 328:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.workload.properties.configmaps.description
 364:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.metrics.properties.allow_list.description
 373:24    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.metrics.properties.containers.additionalProperties.description
 416:25  warning  oas2-unused-definition  Potentially unused definition has been detected.               definitions.registration-response
 423:21  warning  oas2-unused-definition  Potentially unused definition has been detected.               definitions.registration-info
 427:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.registration-info.properties.hardware.description
 604:13  warning  oas2-unused-definition  Potentially unused definition has been detected.               definitions.heartbeat
 619:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.heartbeat.properties.upgrade.description
 622:22    error  no-$ref-siblings        $ref must not be placed next to any other properties           definitions.heartbeat.properties.hardware.description

✖ 30 problems (16 errors, 14 warnings, 0 infos, 0 hints)

make: *** [Makefile:201: validate-swagger] Error 1

Fixed by #167