Closed SOHELAHMED7 closed 1 year ago
I'd prefer definition on the property itself, but it is not directly possible because $ref
does not allow adding additional properties.
There is an allOf
construct which essentially means that the schema must match all sub-schemas.
One could do this like:
# Task:
title: Task
x-table: tasks
type: object
description: Database schema of a Task.
required:
- id
- creator # creator_id
properties:
creator: # creator_id
allOf:
- $ref: '../openapi.yaml#/components/schemas/User'
- x-fk-on-update: CASCADE
- x-fk-on-delete: SET NULL
id:
type: integer
example: 12531
It would probably be useful to be able to understand the allOf
syntax in general so when it occurs, the sub-arrays should be merged.
Add ability to add "ON DELETE" and "ON UPDATE" foreign key constraints in yii2-open-api spec definitions.
Consider a user can create one or more tasks.
Now if we want to provide "ON DELETE" and "ON UPDATE" foreign key constraints in OpenAPI spec then : (initial thought about the syntax which is yet to be implemented)
@cebe feel free to provide your thoughts about how we should define foreign key constraints.