Skip to content

api.yaml reference

Applies to version 0.1

The overlay file, one per folder under apis/: the API contract (direction, semantic types, exposed names and more) over the PCML call contract. Generated from its JSON Schema.

Field Type Description
pcml string PCML file, relative to this file.
version string
title string Title of the API in the OpenAPI document; the API name (the folder name, lower-cased) when absent.
call auto or pcml or raw
program string
id string
route string
method GET or POST or PUT or PATCH or DELETE
summary string
description string
tags array
inject object Parameters filled by the runtime: a literal, or ${environment.<name>} / ${tenant.<name>}.
parameters object
error object
error.when object
error.when.field string
error.when.equals string or number or boolean
error.when.notEquals string or number or boolean
error.when.in array
error.code string
error.message string
error.httpStatus integer
error.statusByCode object
cache object
cache.ttlSeconds integer
operations array

One overlay file per folder under apis/. Common form: route and method at the top level. Several operations: an operations list. The loader applies further rules that a schema cannot express (for example that a parameter exists in the PCML).

program: ORDSTATUS
pcml: ORDSTATUS.pcml
route: /orders/{orderNumber}/status
method: GET
version: 1.0.0
summary: Returns the status of a purchase order

inject:
  P0ENV: ${environment.code}

parameters:
  P0ORDN: { name: orderNumber, type: integer, pad: left, padChar: "0" }
  P0STAT: { name: status }
  P0DATE: { name: deliveryDate, type: date, format: yyyyMMdd }
  P0ERR: { direction: internal }
  P0ERRC: { direction: internal }
  P0XERR: { direction: internal }

error:
  when: { field: P0ERR, equals: "KO" }
  code: P0ERRC
  message: P0XERR
  httpStatus: 422
  statusByCode: { E404: 404 }