Skip to content

Commit d3776cc

Browse files
committed
feat(openrpc): Добавил servers в method_spec
1 parent a820b5b commit d3776cc

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

fastapi_jsonrpc/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,6 +1521,8 @@ def get_openrpc(self):
15211521
for error in route.errors:
15221522
errors_by_code[error.CODE].add(error)
15231523

1524+
servers_list = self.servers or [{'url': 'http://localhost'}]
1525+
15241526
method_spec = {
15251527
'name': route.name,
15261528
'params': [
@@ -1547,6 +1549,15 @@ def get_openrpc(self):
15471549
}
15481550
for code in sorted({error.CODE for error in route.errors})
15491551
],
1552+
'servers': [
1553+
{
1554+
"name": route.name,
1555+
"server": f"{server.url}/{route.path}",
1556+
"description": route.description,
1557+
"summary": route.summary,
1558+
}
1559+
for server in servers_list
1560+
]
15501561
}
15511562
if route.summary:
15521563
method_spec['summary'] = route.summary

0 commit comments

Comments
 (0)