-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmodel.feature
79 lines (74 loc) · 2.21 KB
/
model.feature
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
Feature: Model object generation
Scenario: Simple object creation
When generating an API from the following specification
"""
{
"openapi":"3.0.2",
"info" : {"title": "test", "version": "0.0.0"},
"paths": {},
"components": {
"schemas": {
"ObjectResponse": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"value": { "type": "string" }
}
}
}
}
}
"""
Then it should generate a model object named ObjectResponse
And ObjectResponse should have an optional property named id of type number
And ObjectResponse should have an optional property named value of type string
Scenario: Required properties
When generating an API from the following specification
"""
{
"openapi":"3.0.2",
"info" : {"title": "test", "version": "0.0.0"},
"paths": {},
"components": {
"schemas": {
"ObjectResponse": {
"type": "object",
"properties": {
"id": { "type": "integer" },
"value": { "type": "string" }
},
"required": ["id"]
}
}
}
}
"""
Then it should generate a model object named ObjectResponse
And ObjectResponse should have a required property named id of type number
And ObjectResponse should have an optional property named value of type string
Scenario: Object references
When generating an API from the following specification
"""
{
"openapi":"3.0.2",
"info" : {"title": "test", "version": "0.0.0"},
"paths": {},
"components": {
"schemas": {
"ChildObject": {
"type": "object",
"properties": {}
},
"ParentObject": {
"type": "object",
"properties": {
"child": { "$ref": "#/components/schemas/ChildObject" }
}
}
}
}
}
"""
Then it should generate a model object named ChildObject
And it should generate a model object named ParentObject
And ParentObject should have an optional property named child of type ChildObject