APIMatic · Arazzo Workflow

APIMatic Import, Validate and Generate SDK

Version 1.0.0

Import an API spec, lint it, and only generate an SDK when it is valid.

1 workflow 1 source API 1 provider
View Spec View on GitHub API TransformationCode GenerationDeveloper ExperienceDocumentationSDK GenerationArazzoWorkflows

Provider

apimatic

Workflows

import-validate-generate-sdk
Import a spec, validate it, then generate an SDK if the spec is valid.
Creates an API entity from an uploaded specification, lints it for errors and best-practice violations, and generates an SDK only when validation reports the definition as valid.
3 steps inputs: authorization, file, platform outputs: apiEntityId, sdkDownloadUrl, valid
1
importSpec
importApiDefinition
Upload the API specification file as multipart form data to create a new API entity in APIMatic.
2
validateSpec
validateApiDefinition
Validate and lint the imported definition, capturing whether it is valid along with any errors and warnings.
3
generateSdk
generateSdk
Generate an SDK for the validated API entity in the requested platform and return the download URL.

Source API Descriptions

Arazzo Workflow Specification

apimatic-import-validate-generate-sdk-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: APIMatic Import, Validate and Generate SDK
  summary: Import an API spec, lint it, and only generate an SDK when it is valid.
  description: >-
    The core APIMatic developer-experience pipeline. The workflow imports an API
    specification file to create an API entity, validates and lints the
    resulting definition, and branches on the validation result: when the
    definition is valid it generates an SDK in the requested platform and
    returns the download URL, and when it is invalid it stops without wasting a
    generation run. Every step spells out its request inline so the flow can be
    read and executed without opening the underlying OpenAPI description.
  version: 1.0.0
sourceDescriptions:
- name: apimaticApi
  url: ../openapi/apimatic-platform-api.yaml
  type: openapi
workflows:
- workflowId: import-validate-generate-sdk
  summary: Import a spec, validate it, then generate an SDK if the spec is valid.
  description: >-
    Creates an API entity from an uploaded specification, lints it for errors
    and best-practice violations, and generates an SDK only when validation
    reports the definition as valid.
  inputs:
    type: object
    required:
    - authorization
    - file
    - platform
    properties:
      authorization:
        type: string
        description: API key passed in the Authorization header.
      file:
        type: string
        description: The API specification file contents to import.
      platform:
        type: string
        description: >-
          Target SDK platform, e.g. PYTHON_GENERIC_LIB, JAVA_ECLIPSE_JRE_LIB,
          TYPESCRIPT_GENERIC_LIB, CS_NET_STANDARD_LIB, PHP_GENERIC_LIB,
          RUBY_GENERIC_LIB or GO_GENERIC_LIB.
  steps:
  - stepId: importSpec
    description: >-
      Upload the API specification file as multipart form data to create a new
      API entity in APIMatic.
    operationId: importApiDefinition
    parameters:
    - name: Authorization
      in: header
      value: $inputs.authorization
    requestBody:
      contentType: multipart/form-data
      payload:
        file: $inputs.file
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      apiEntityId: $response.body#/id
  - stepId: validateSpec
    description: >-
      Validate and lint the imported definition, capturing whether it is valid
      along with any errors and warnings.
    operationId: validateApiDefinition
    parameters:
    - name: Authorization
      in: header
      value: $inputs.authorization
    - name: apiEntityId
      in: path
      value: $steps.importSpec.outputs.apiEntityId
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      valid: $response.body#/valid
      errors: $response.body#/errors
    onSuccess:
    - name: specIsValid
      type: goto
      stepId: generateSdk
      criteria:
      - context: $response.body
        condition: $.valid == true
        type: jsonpath
    - name: specIsInvalid
      type: end
      criteria:
      - context: $response.body
        condition: $.valid == false
        type: jsonpath
  - stepId: generateSdk
    description: >-
      Generate an SDK for the validated API entity in the requested platform and
      return the download URL.
    operationId: generateSdk
    parameters:
    - name: Authorization
      in: header
      value: $inputs.authorization
    - name: apiEntityId
      in: path
      value: $steps.importSpec.outputs.apiEntityId
    requestBody:
      contentType: application/json
      payload:
        platform: $inputs.platform
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      downloadUrl: $response.body#/downloadUrl
      expiresAt: $response.body#/expiresAt
  outputs:
    apiEntityId: $steps.importSpec.outputs.apiEntityId
    valid: $steps.validateSpec.outputs.valid
    sdkDownloadUrl: $steps.generateSdk.outputs.downloadUrl