Skip to content

Commit

Permalink
Merge pull request #206 from rominf/rominf/add_servers
Browse files Browse the repository at this point in the history
Add servers
  • Loading branch information
koxudaxi authored Nov 28, 2021
2 parents 4f93df2 + 987a91a commit 5df9721
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fastapi_code_generator/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,12 @@ def __init__(
self.imports_for_fastapi: Imports = Imports()
self.data_types: List[DataType] = []

def parse_info(self) -> Optional[List[Dict[str, List[str]]]]:
return self.raw_obj.get('info')
def parse_info(self) -> Optional[Dict[str, Any]]:
result = self.raw_obj.get('info', {}).copy()
servers = self.raw_obj.get('servers')
if servers:
result['servers'] = servers
return result or None

def parse_parameters(self, parameters: ParameterObject, path: List[str]) -> None:
super().parse_parameters(parameters, path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
title='Swagger Petstore',
license={'name': 'MIT'},
description='This description is for testing\nmulti-line\ndescription\n',
servers=[{'url': 'http://petstore.swagger.io/v1'}],
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
title='Swagger Petstore',
license={'name': 'MIT'},
description='This description is for testing\nmulti-line\ndescription\n',
servers=[{'url': 'http://petstore.swagger.io/v1'}],
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
title='Swagger Petstore',
license={'name': 'MIT'},
description='This description is for testing\nmulti-line\ndescription\n',
servers=[{'url': 'http://petstore.swagger.io/v1'}],
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
title='Swagger Petstore',
license={'name': 'MIT'},
description='This description is for testing\nmulti-line\ndescription\n',
servers=[{'url': 'http://petstore.swagger.io/v1'}],
)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
title='Swagger Petstore',
license={'name': 'MIT'},
description='This description is for testing\nmulti-line\ndescription\n',
servers=[{'url': 'http://petstore.swagger.io/v1'}],
)


Expand Down

0 comments on commit 5df9721

Please sign in to comment.