Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Add ability to add "ON DELETE" and "ON UPDATE" foreign key constraints in yii2-open-api spec definitions #131

@SOHELAHMED7

Description

@SOHELAHMED7

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)

# Task:
title: Task
x-table: tasks
type: object

# ----------------------- FK constraint -------------------------
x-fk-on-constraint:
  creator: # creator_id
    x-on-update: CASCADE
    x-on-delete: SET NULL
# ----------------------- FK constraint -------------------------

description: Database schema of a Task.

required:
  - id
  - creator # creator_id

properties:

  creator: # creator_id
    $ref: '../openapi.yaml#/components/schemas/User'

  id:
    type: integer
    example: 12531

@cebe feel free to provide your thoughts about how we should define foreign key constraints.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions