이러한 파일은 명시적인 사양 속성은 포함하지 않으나 인접한 기본 사양 파일에서 참조됩니다.
다음의 예시는 같은 디렉터리에 있는 두 파일을 포함합니다. 첫 번째 파일은 일반적인 기본 사양 파일입니다. 두 번째 파일은 첫 번째 파일에서 참조되며 따라서 사양으로 간주될 수 있다고 제안됩니다.
기본 사양 파일 openapi.yaml:
openapi: 3.1.0
components:
schemas:
CustomSchema:
description: Custom schema object
properties:
foo:
$ref: 'common.components.json#/components/schemas/CommonSchema'
사양 파일 후보 common.components.json:
{
"components": { // 'Mark file as OpenAPI specification' 강조 표시
"schemas": {
"CommonSchema": {
"description": "Common schema object reused in several specifications"
}
}
}
}