Skip to content

Commit 72fc67d

Browse files
author
David Andersson
committed
Update documentation
1 parent 99e2c7e commit 72fc67d

File tree

8 files changed

+434
-0
lines changed

8 files changed

+434
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
- Add check enforcing unique `x-tablename` values.
2424
- Add check enforcing unique `x-secondary` values.
2525
- Add custom association schemas validation
26+
- Add support for custom association tables
2627

2728
## Version 1.5.4 - 2020-10-10
2829

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ An example API has been defined using connexion and Flask here:
143143
- one to one relationships,
144144
- one to many relationships,
145145
- many to many relationships,
146+
- many to many relationships with custom association tables,
146147
- custom foreign keys for relationships,
147148
- back references for relationships,
148149
- `allOf` inheritance for columns and models,
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
openapi: "3.0.0"
2+
3+
info:
4+
title: Test Schema
5+
description: API to illustrate Many to Many Relationships.
6+
version: "0.1"
7+
8+
paths:
9+
/project:
10+
get:
11+
summary: Used to retrieve all projects.
12+
responses:
13+
200:
14+
description: Return all projects from the database.
15+
content:
16+
application/json:
17+
schema:
18+
type: array
19+
items:
20+
"$ref": "#/components/schemas/Project"
21+
/employee:
22+
get:
23+
summary: Used to retrieve all employees.
24+
responses:
25+
200:
26+
description: Return all employees from the database.
27+
content:
28+
application/json:
29+
schema:
30+
type: array
31+
items:
32+
"$ref": "#/components/schemas/Employee"
33+
34+
components:
35+
schemas:
36+
Project:
37+
description: A large sized business objective.
38+
type: object
39+
x-tablename: project
40+
properties:
41+
id:
42+
type: integer
43+
description: Unique identifier for the project.
44+
example: 0
45+
x-primary-key: true
46+
name:
47+
type: string
48+
description: The name of the project.
49+
example: Expand to the USA
50+
Employee:
51+
description: Person that works for a company.
52+
type: object
53+
x-tablename: employee
54+
properties:
55+
id:
56+
type: integer
57+
description: Unique identifier for the employee.
58+
example: 0
59+
x-primary-key: true
60+
name:
61+
type: string
62+
description: The name of the employee.
63+
example: David Andersson
64+
projects:
65+
type: array
66+
items:
67+
allOf:
68+
- "$ref": "#/components/schemas/Project"
69+
- x-secondary: employee_project
70+
description: The projects the employee is working on.
71+
EmployeeProject:
72+
type: object
73+
x-tablename: employee_project
74+
properties:
75+
employee_id:
76+
type: integer
77+
x-primary-key: true
78+
x-foreign-key: employee.id
79+
project_id:
80+
type: integer
81+
x-primary-key: true
82+
x-foreign-key: project.id
83+
required:
84+
- employee_id
85+
- project_id
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from open_alchemy import init_yaml
2+
3+
init_yaml("pre-defined-example-spec.yml", models_filename="pre_defined_models_auto.py")

0 commit comments

Comments
 (0)