1
1
package apiSpecDoc
2
2
3
- //ApiSpecDoc represents full API Specification document
4
- //with all required data to view and execute requests
5
- //Propose to not store something like components at the initial stage - leave it as update to simplify logic
6
- //So each ApiMethod need to keep all schema (some duplication, but we could update it faster with extending of the model)
3
+ // ApiSpecDoc represents full API Specification document
4
+ // with all required data to view and execute requests
5
+ // Propose to not store something like components at the initial stage - leave it as update to simplify logic
6
+ // So each ApiMethod need to keep all schema (some duplication, but we could update it faster with extending of the model)
7
7
type ApiSpecDoc struct {
8
8
//Type of API definition
9
9
//It's possible to be OpenApi, gRPC and others
@@ -13,15 +13,15 @@ type ApiSpecDoc struct {
13
13
//It relates to:
14
14
//Tags - Open API specs
15
15
//Services - RPCs
16
- Groups []Group
16
+ Groups []* Group
17
17
18
18
//Methods at the root level without groups
19
- Methods []ApiMethod
19
+ Methods []* ApiMethod
20
20
}
21
21
22
- //Group represents some grouping rule
23
- //Tags for the open API
24
- //Services for the gRPC
22
+ // Group represents some grouping rule
23
+ // Tags for the open API
24
+ // Services for the gRPC
25
25
type Group struct {
26
26
//Name of the group
27
27
Name string
@@ -30,10 +30,10 @@ type Group struct {
30
30
Description string
31
31
32
32
//Methods is a set of request methods related to the group
33
- Methods []ApiMethod
33
+ Methods []* ApiMethod
34
34
}
35
35
36
- //ApiMethod represents particular API method to call
36
+ // ApiMethod represents particular API method to call
37
37
type ApiMethod struct {
38
38
//Path to send request
39
39
//For example /open/api/info/
@@ -52,7 +52,7 @@ type ApiMethod struct {
52
52
Type MethodType
53
53
54
54
//RequestBody is a description of ApiMethod request body, nil if no request body
55
- RequestBody * MediaTypeObject
55
+ RequestBody * RequestBody
56
56
57
57
//Servers represent available paths for requests with description.
58
58
//In the case of swagger we need to calculate it taking the deepest nested servers definition
@@ -135,29 +135,29 @@ type Schema struct {
135
135
136
136
//Nested describe nested object/properties
137
137
//If it's object and contain nested fields
138
- Fields []Schema
138
+ Fields []* Schema
139
139
}
140
140
141
- //MediaTypeObject represents schema for the different media types
142
- //i.e. "application/json" and etc.
141
+ // MediaTypeObject represents schema for the different media types
142
+ // i.e. "application/json" and etc.
143
143
type MediaTypeObject struct {
144
- Schema Schema
144
+ Schema * Schema
145
145
}
146
146
147
- //RequestBody is a representation of request body
147
+ // RequestBody is a representation of request body
148
148
type RequestBody struct {
149
149
Description string
150
150
151
151
//Content represents request object for the different media types
152
- Content map [string ]MediaTypeObject
152
+ Content map [string ]* MediaTypeObject
153
153
154
154
//Required define is request body required
155
155
Required bool
156
156
}
157
157
158
- //Server represents server description
159
- //To use in the address line of view
160
- //https://swagger.io/specification/#server-object
158
+ // Server represents server description
159
+ // To use in the address line of view
160
+ // https://swagger.io/specification/#server-object
161
161
type Server struct {
162
162
//Url to access server (no templates, real url)
163
163
Url string
@@ -166,8 +166,8 @@ type Server struct {
166
166
Description string
167
167
}
168
168
169
- //Parameter is abstraction of additional data to request
170
- //It is headers for the REST API and metadata for the gRPC
169
+ // Parameter is abstraction of additional data to request
170
+ // It is headers for the REST API and metadata for the gRPC
171
171
type Parameter struct {
172
172
Name string
173
173
@@ -183,9 +183,9 @@ type Parameter struct {
183
183
Required bool
184
184
}
185
185
186
- //ExternalDoc may be available for the Open API
187
- //And contain link to description of request method
188
- //Maybe useful also for debugging - to find failed API description rapidly
186
+ // ExternalDoc may be available for the Open API
187
+ // And contain link to description of request method
188
+ // Maybe useful also for debugging - to find failed API description rapidly
189
189
type ExternalDoc struct {
190
190
Description string
191
191
0 commit comments