arazzo: 1.0.1
info:
  title: CCA data-service discovery workflows
  version: 1.0.0
  description: Common read-only workflows beginning with the canonical catalog.
sourceDescriptions:
  - name: catalog
    url: https://services.datasourceapi.com/openapi.json
    type: openapi
workflows:
  - workflowId: discoverService
    summary: Find and inspect a fleet service
    description: Filter the catalog and retrieve the authoritative metadata record before calling a service.
    inputs:
      type: object
      properties:
        capability:
          type: string
      required:
        - capability
    steps:
      - stepId: searchCatalog
        operationId: listServices
        parameters:
          - name: capability
            in: query
            value: $inputs.capability
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          serviceId: $response.body#/services/0/id
      - stepId: readService
        operationId: getService
        parameters:
          - name: id
            in: path
            value: $steps.searchCatalog.outputs.serviceId
        successCriteria:
          - condition: $statusCode == 200
        outputs:
          canonicalUrl: $response.body#/canonicalUrl
          openapiUrl: $response.body#/openapiUrl
    outputs:
      canonicalUrl: $steps.readService.outputs.canonicalUrl
      openapiUrl: $steps.readService.outputs.openapiUrl
