Skip to content

Commit ba0d868

Browse files
authored
fix swagger schema (#5056)
1 parent a4e2878 commit ba0d868

File tree

4 files changed

+16
-21
lines changed

4 files changed

+16
-21
lines changed

ydb/core/viewer/json_nodelist.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ struct TJsonRequestSchema<TJsonNodeList> {
101101
type: string
102102
Port:
103103
type: integer
104-
required:
105-
- Id
106-
- Address
107-
- Port
108104
)___");
109105
}
110106
};

ydb/core/viewer/json_pdisk_restart.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,6 @@ YAML::Node TJsonRequestSwagger<TJsonPDiskRestart>::GetSwagger() {
184184
post:
185185
tags:
186186
- pdisk
187-
produces:
188-
- application/json
189187
summary: Restart PDisk
190188
description: Restart PDisk on the specified node
191189
parameters:
@@ -211,18 +209,20 @@ YAML::Node TJsonRequestSwagger<TJsonPDiskRestart>::GetSwagger() {
211209
responses:
212210
200:
213211
description: OK
214-
schema:
215-
type: object
216-
properties:
217-
result:
218-
type: boolean
219-
description: was operation successful or not
220-
error:
221-
type: string
222-
description: details about failed operation
223-
forceRetryPossible:
224-
type: boolean
225-
description: if true, operation can be retried with force flag
212+
content:
213+
application/json:
214+
schema:
215+
type: object
216+
properties:
217+
result:
218+
type: boolean
219+
description: was operation successful or not
220+
error:
221+
type: string
222+
description: details about failed operation
223+
forceRetryPossible:
224+
type: boolean
225+
description: if true, operation can be retried with force flag
226226
400:
227227
description: Bad Request
228228
403:

ydb/core/viewer/viewer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,6 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {
253253
if (swagger.IsNull()) {
254254
auto get = path["get"];
255255
get["tags"].push_back(tag);
256-
get["produces"].push_back("application/json");
257256
if (auto summary = handler->GetRequestSummary()) {
258257
get["summary"] = summary;
259258
}
@@ -263,7 +262,7 @@ class TViewer : public TActorBootstrapped<TViewer>, public IViewer {
263262
get["parameters"] = handler->GetRequestParameters();
264263
auto responses = get["responses"];
265264
auto response200 = responses["200"];
266-
response200["schema"] = handler->GetResponseJsonSchema();
265+
response200["content"]["application/json"]["schema"] = handler->GetResponseJsonSchema();
267266
} else {
268267
path = swagger;
269268
}

ydb/core/viewer/yaml/yaml.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ YAML::Node TProtoToYaml::ProtoToYamlSchema(const ::google::protobuf::Descriptor*
3131
auto property = properties[fieldDescriptor->name()];
3232
if (fieldDescriptor->is_repeated()) {
3333
property["type"] = "array";
34-
property = property["items"];
34+
property.reset(property["items"]);
3535
}
3636
if (fieldDescriptor->cpp_type() == FieldDescriptor::CPPTYPE_MESSAGE) {
3737
if (fieldDescriptor->message_type()->full_name() == google::protobuf::Timestamp::descriptor()->full_name()) {

0 commit comments

Comments
 (0)