Skip to content

Commit 43c7885

Browse files
committed
add new files
1 parent 564f4e0 commit 43c7885

24 files changed

+1773
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Petstore::Cow
2+
3+
## Properties
4+
5+
| Name | Type | Description | Notes |
6+
| ---- | ---- | ----------- | ----- |
7+
8+
## Example
9+
10+
```ruby
11+
require 'petstore'
12+
13+
instance = Petstore::Cow.new()
14+
```
15+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Petstore::Mammal
2+
3+
## Class instance methods
4+
5+
### `openapi_one_of`
6+
7+
Returns the list of classes defined in oneOf.
8+
9+
#### Example
10+
11+
```ruby
12+
require 'petstore'
13+
14+
Petstore::Mammal.openapi_one_of
15+
# =>
16+
# [
17+
# :'Whale',
18+
# :'Zebra'
19+
# ]
20+
```
21+
22+
### `openapi_discriminator_name`
23+
24+
Returns the discriminator's property name.
25+
26+
#### Example
27+
28+
```ruby
29+
require 'petstore'
30+
31+
Petstore::Mammal.openapi_discriminator_name
32+
# => :'classname'
33+
```
34+
```
35+
36+
### build
37+
38+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
39+
40+
#### Example
41+
42+
```ruby
43+
require 'petstore'
44+
45+
Petstore::Mammal.build(data)
46+
# => #<Whale:0x00007fdd4aab02a0>
47+
48+
Petstore::Mammal.build(data_that_doesnt_match)
49+
# => nil
50+
```
51+
52+
#### Parameters
53+
54+
| Name | Type | Description |
55+
| ---- | ---- | ----------- |
56+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
57+
58+
#### Return type
59+
60+
- `Whale`
61+
- `Zebra`
62+
- `nil` (if no type matches)
63+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Petstore::MammalAnyof
2+
3+
## Properties
4+
5+
| Name | Type | Description | Notes |
6+
| ---- | ---- | ----------- | ----- |
7+
| **has_baleen** | **Boolean** | | [optional] |
8+
| **has_teeth** | **Boolean** | | [optional] |
9+
| **classname** | **String** | | |
10+
| **type** | **String** | | [optional] |
11+
12+
## Example
13+
14+
```ruby
15+
require 'petstore'
16+
17+
instance = Petstore::MammalAnyof.new(
18+
has_baleen: null,
19+
has_teeth: null,
20+
classname: null,
21+
type: null
22+
)
23+
```
24+
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Petstore::MammalWithoutDiscriminator
2+
3+
## Class instance methods
4+
5+
### `openapi_one_of`
6+
7+
Returns the list of classes defined in oneOf.
8+
9+
#### Example
10+
11+
```ruby
12+
require 'petstore'
13+
14+
Petstore::MammalWithoutDiscriminator.openapi_one_of
15+
# =>
16+
# [
17+
# :'Whale',
18+
# :'Zebra'
19+
# ]
20+
```
21+
22+
### build
23+
24+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
25+
26+
#### Example
27+
28+
```ruby
29+
require 'petstore'
30+
31+
Petstore::MammalWithoutDiscriminator.build(data)
32+
# => #<Whale:0x00007fdd4aab02a0>
33+
34+
Petstore::MammalWithoutDiscriminator.build(data_that_doesnt_match)
35+
# => nil
36+
```
37+
38+
#### Parameters
39+
40+
| Name | Type | Description |
41+
| ---- | ---- | ----------- |
42+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
43+
44+
#### Return type
45+
46+
- `Whale`
47+
- `Zebra`
48+
- `nil` (if no type matches)
49+
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Petstore::OneOfPrimitiveTypes
2+
3+
## Class instance methods
4+
5+
### `openapi_one_of`
6+
7+
Returns the list of classes defined in oneOf.
8+
9+
#### Example
10+
11+
```ruby
12+
require 'petstore'
13+
14+
Petstore::OneOfPrimitiveTypes.openapi_one_of
15+
# =>
16+
# [
17+
# :'Array<Boolean>',
18+
# :'Array<Date>',
19+
# :'Array<Float>',
20+
# :'Array<Integer>',
21+
# :'Array<String>',
22+
# :'Array<Time>',
23+
# :'Boolean',
24+
# :'Date',
25+
# :'Float',
26+
# :'Integer',
27+
# :'String',
28+
# :'Time'
29+
# ]
30+
```
31+
32+
### build
33+
34+
Find the appropriate object from the `openapi_one_of` list and casts the data into it.
35+
36+
#### Example
37+
38+
```ruby
39+
require 'petstore'
40+
41+
Petstore::OneOfPrimitiveTypes.build(data)
42+
# => #<Array<Boolean>:0x00007fdd4aab02a0>
43+
44+
Petstore::OneOfPrimitiveTypes.build(data_that_doesnt_match)
45+
# => nil
46+
```
47+
48+
#### Parameters
49+
50+
| Name | Type | Description |
51+
| ---- | ---- | ----------- |
52+
| **data** | **Mixed** | data to be matched against the list of oneOf items |
53+
54+
#### Return type
55+
56+
- `Array<Boolean>`
57+
- `Array<Date>`
58+
- `Array<Float>`
59+
- `Array<Integer>`
60+
- `Array<String>`
61+
- `Array<Time>`
62+
- `Boolean`
63+
- `Date`
64+
- `Float`
65+
- `Integer`
66+
- `String`
67+
- `Time`
68+
- `nil` (if no type matches)
69+
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Petstore::PropertyNameMapping
2+
3+
## Properties
4+
5+
| Name | Type | Description | Notes |
6+
| ---- | ---- | ----------- | ----- |
7+
| **http_debug_operation** | **String** | | [optional] |
8+
| **_type** | **String** | | [optional] |
9+
| **type** | **String** | | [optional] |
10+
| **type_** | **String** | | [optional] |
11+
12+
## Example
13+
14+
```ruby
15+
require 'petstore'
16+
17+
instance = Petstore::PropertyNameMapping.new(
18+
http_debug_operation: null,
19+
_type: null,
20+
type: null,
21+
type_: null
22+
)
23+
```
24+
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Petstore::Whale
2+
3+
## Properties
4+
5+
| Name | Type | Description | Notes |
6+
| ---- | ---- | ----------- | ----- |
7+
| **has_baleen** | **Boolean** | | [optional] |
8+
| **has_teeth** | **Boolean** | | [optional] |
9+
| **classname** | **String** | | |
10+
11+
## Example
12+
13+
```ruby
14+
require 'petstore'
15+
16+
instance = Petstore::Whale.new(
17+
has_baleen: null,
18+
has_teeth: null,
19+
classname: null
20+
)
21+
```
22+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Petstore::Zebra
2+
3+
## Properties
4+
5+
| Name | Type | Description | Notes |
6+
| ---- | ---- | ----------- | ----- |
7+
| **type** | **String** | | [optional] |
8+
| **classname** | **String** | | |
9+
10+
## Example
11+
12+
```ruby
13+
require 'petstore'
14+
15+
instance = Petstore::Zebra.new(
16+
type: null,
17+
classname: null
18+
)
19+
```
20+
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
=begin
2+
#OpenAPI Petstore
3+
4+
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
5+
6+
The version of the OpenAPI document: 1.0.0
7+
8+
Generated by: https://openapi-generator.tech
9+
Generator version: 7.16.0-SNAPSHOT
10+
11+
=end
12+
13+
require 'date'
14+
require 'time'
15+
16+
module Petstore
17+
class Cow
18+
BLACK_AND_WHITE_COW = "BlackAndWhiteCow".freeze
19+
BROWN_COW = "BrownCow".freeze
20+
21+
def self.all_vars
22+
@all_vars ||= [BLACK_AND_WHITE_COW, BROWN_COW].freeze
23+
end
24+
25+
# Builds the enum from string
26+
# @param [String] The enum value in the form of the string
27+
# @return [String] The enum value
28+
def self.build_from_hash(value)
29+
new.build_from_hash(value)
30+
end
31+
32+
# Builds the enum from string
33+
# @param [String] The enum value in the form of the string
34+
# @return [String] The enum value
35+
def build_from_hash(value)
36+
return value if Cow.all_vars.include?(value)
37+
raise "Invalid ENUM value #{value} for class #Cow"
38+
end
39+
end
40+
end
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
=begin
2+
#OpenAPI Petstore
3+
4+
#This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\
5+
6+
The version of the OpenAPI document: 1.0.0
7+
8+
Generated by: https://openapi-generator.tech
9+
Generator version: 7.16.0-SNAPSHOT
10+
11+
=end
12+
13+
require 'date'
14+
require 'time'
15+
16+
module Petstore
17+
module Mammal
18+
class << self
19+
# List of class defined in oneOf (OpenAPI v3)
20+
def openapi_one_of
21+
[
22+
:'Whale',
23+
:'Zebra'
24+
]
25+
end
26+
27+
# Discriminator's property name (OpenAPI v3)
28+
def openapi_discriminator_name
29+
:'classname'
30+
end
31+
32+
# Builds the object
33+
# @param [Mixed] Data to be matched against the list of oneOf items
34+
# @return [Object] Returns the model or the data itself
35+
def build(data)
36+
discriminator_value = data[openapi_discriminator_name]
37+
return nil if discriminator_value.nil?
38+
Petstore.const_get(discriminator_value).build_from_hash(data)
39+
end
40+
end
41+
end
42+
43+
end

0 commit comments

Comments
 (0)