-
Notifications
You must be signed in to change notification settings - Fork 14
/
partial_oneof_module_doc.mustache
93 lines (67 loc) · 1.51 KB
/
partial_oneof_module_doc.mustache
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# {{moduleName}}::{{classname}}
## Class instance methods
### `openapi_one_of`
Returns the list of classes defined in oneOf.
#### Example
```ruby
require '{{{gemName}}}'
{{moduleName}}::{{classname}}.openapi_one_of
# =>
{{#oneOf}}
{{#-first}}
# [
{{/-first}}
# :'{{{.}}}'{{^-last}},{{/-last}}
{{#-last}}
# ]
{{/-last}}
{{/oneOf}}
```
{{#discriminator}}
{{#propertyName}}
### `openapi_discriminator_name`
Returns the discriminator's property name.
#### Example
```ruby
require '{{{gemName}}}'
{{moduleName}}::{{classname}}.openapi_discriminator_name
# => :'{{{.}}}'
```
{{/propertyName}}
{{#mappedModels}}
{{#-first}}
### `openapi_discriminator_name`
Returns the discriminator's mapping.
#### Example
```ruby
require '{{{gemName}}}'
{{moduleName}}::{{classname}}.openapi_discriminator_mapping
# =>
# {
{{/-first}}
# :'{{{mappingName}}}' => :'{{{modelName}}}'{{^-last}},{{/-last}}
{{#-last}}
# }
{{/-last}}
{{/mappedModels}}
```
{{/discriminator}}
### build
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
#### Example
```ruby
require '{{{gemName}}}'
{{moduleName}}::{{classname}}.build(data)
# => {{#oneOf}}{{#-first}}#<{{{.}}}:0x00007fdd4aab02a0>{{/-first}}{{/oneOf}}
{{moduleName}}::{{classname}}.build(data_that_doesnt_match)
# => nil
```
#### Parameters
| Name | Type | Description |
| ---- | ---- | ----------- |
| **data** | **Mixed** | data to be matched against the list of oneOf items |
#### Return type
{{#oneOf}}
- `{{{.}}}`
{{/oneOf}}
- `nil` (if no type matches)