File: serialize_as_any.yaml

package info (click to toggle)
python-datamodel-code-generator 0.45.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 9,052 kB
  • sloc: python: 29,621; makefile: 15
file content (49 lines) | stat: -rw-r--r-- 1,324 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
openapi: "3.0.0"
info:
  version: 1.0.0
  title: SerializeAsAny Test
  description: Test schema for SerializeAsAny annotation on types with subtypes
paths: {}
components:
  schemas:
    User:
      type: object
      description: Base user model
      properties:
        name:
          type: string
          description: User's name
      required:
        - name

    AdminUser:
      allOf:
        - $ref: '#/components/schemas/User'
        - type: object
          description: Admin user with additional permissions
          properties:
            admin_level:
              type: integer
              description: Admin permission level
          required:
            - admin_level

    Container:
      type: object
      description: Container that holds user references
      properties:
        admin_user_field:
          $ref: '#/components/schemas/AdminUser'
          description: Field that should not use SerializeAsAny
        user_field:
          $ref: '#/components/schemas/User'
          description: Field that should use SerializeAsAny
        user_list:
          type: array
          description: List of users that should use SerializeAsAny
          items:
            $ref: '#/components/schemas/User'
      required:
        - user_field
        - user_list
        - admin_user_field