File: read_only_write_only_ref_request_response.yaml

package info (click to toggle)
python-datamodel-code-generator 0.55.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 15,792 kB
  • sloc: python: 44,931; makefile: 22
file content (68 lines) | stat: -rw-r--r-- 1,844 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
openapi: "3.0.0"
info:
  title: Read Only Write Only Ref Request Response Test API
  version: "1.0"
paths: {}
components:
  schemas:
    # Child with only readOnly fields - should generate base model when referenced directly
    ChildOnlyReadOnly:
      type: object
      properties:
        id:
          readOnly: true
          type: integer
    # Child with only writeOnly fields - should generate base model when referenced directly
    ChildOnlyWriteOnly:
      type: object
      properties:
        secret:
          writeOnly: true
          type: string
    # Child with mixed fields - should generate ChildRequest variant
    ChildMixed:
      type: object
      properties:
        id:
          readOnly: true
          type: integer
        name:
          type: string
    # Parent referencing child with only readOnly fields
    ParentWithOnlyReadOnlyChild:
      type: object
      properties:
        child:
          $ref: "#/components/schemas/ChildOnlyReadOnly"
        name:
          readOnly: true
          type: string
    # Parent referencing child with only writeOnly fields
    ParentWithOnlyWriteOnlyChild:
      type: object
      properties:
        child:
          $ref: "#/components/schemas/ChildOnlyWriteOnly"
        secret:
          writeOnly: true
          type: string
    # Parent referencing child with mixed fields
    ParentWithMixedChild:
      type: object
      properties:
        child:
          $ref: "#/components/schemas/ChildMixed"
        name:
          readOnly: true
          type: string
    # Parent with list of children (nested type reference)
    ParentWithChildList:
      type: object
      properties:
        children:
          type: array
          items:
            $ref: "#/components/schemas/ChildMixed"
        name:
          readOnly: true
          type: string