# OpenAPI Document
You're OpenAPI document will need to include x-controller
and x-operation
(or operationId
) properties that the Enforcer Middleware will link to routes in your code. This page explains how those extensions are to be used.
Take the following OpenAPI document:
openapi: '3.0.0'
info:
title: Employee's API
version: "1.0.0"
paths:
/employee/{employee_id}:
get:
x-controller: myController
x-operation: myOperation
parameters:
- name: employee_id
in: path
required: true
schema:
type: string
responses:
200:
description: An employee object
Notice that within the Operation Object (opens new window) (the part labeled get
) that we have two extensions.
x-controller
defines the name of the controller object and it can be defined at:The Operation Object (opens new window) level, taking highest priority.
The PathItem Object (opens new window) (labeled
/employee/{employee_id}
) taking secondary priority.The root OpenAPI Object (opens new window) taking final priority.
x-operation
defines the name of the function within that controller that should be called.