Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Communications Backbone System
backbone-message-format
Commits
3a1cdab5
Commit
3a1cdab5
authored
2 years ago
by
Trishna Saeharaseelan
Browse files
Options
Download
Email Patches
Plain Diff
refactor(docs): update model names
parent
7ceab743
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
20 deletions
+8
-20
docs/generate_swagger.py
docs/generate_swagger.py
+8
-20
No files found.
docs/generate_swagger.py
View file @
3a1cdab5
...
...
@@ -5,15 +5,12 @@ Command:
2/ Go to http://127.0.0.1:5000/soardocs
WARNING: API Endpoints are NOT functional. Purely for easy-reading.
"""
# from .formats.autonomy_configuration import autonomy_configuration_schema
from
flask
import
Flask
,
request
from
flasgger
import
Swagger
,
LazyString
from
flask_restx
import
Api
,
fields
,
Resource
app
=
Flask
(
__name__
)
# app.json_encoder = LazyJSONEncoder
api
=
Api
(
app
)
swagger_template
=
dict
(
info
=
{
...
...
@@ -59,7 +56,7 @@ message_header_schema = api.model(
)
platform_schema
=
api
.
model
(
"Platform
Schema
"
,
"Platform"
,
{
"platform_ID"
:
fields
.
Integer
(
required
=
True
,
...
...
@@ -85,7 +82,7 @@ platform_schema = api.model(
)
squad_metadata_schema
=
api
.
model
(
"SquadMetadata
Schema
"
,
"SquadMetadata"
,
{
"squad_ID"
:
fields
.
Integer
(
required
=
True
,
...
...
@@ -117,7 +114,7 @@ squad_metadata_schema = api.model(
)
constraints_schema
=
api
.
model
(
"Constraints
Schema
"
,
"Constraints"
,
# TODO: Should this be per platform instead of squad?
{
"min_altitude"
:
fields
.
Float
(
...
...
@@ -147,7 +144,7 @@ environment_config_schema = api.model( # TODO: Discuss how regions are defined
)
# Main Autonomy Configuration Schema
autonomy_configuration_schema
=
api
.
model
(
"Configuration
Schema
"
,
"Configuration"
,
{
"message"
:
fields
.
Nested
(
message_header_schema
,
...
...
@@ -316,11 +313,10 @@ swagger_config = {
"produces"
:
[
"application/json"
],
"consumes"
:
[
"application/json"
],
}
swagger
=
Swagger
(
app
,
template
=
swagger_template
,
config
=
swagger_config
)
ns1
=
api
.
namespace
(
"message"
,
description
=
"Message Header Format"
)
@
ns1
.
route
(
"/header"
)
class
MessageHeader
(
Resource
):
@
ns1
.
response
(
200
,
"Success"
,
message_header_schema
)
...
...
@@ -329,8 +325,6 @@ class MessageHeader(Resource):
ns2
=
api
.
namespace
(
"platform_status"
,
description
=
"Platform Status Message Format"
)
@
ns2
.
route
(
""
)
class
PlatformStatus
(
Resource
):
@
ns2
.
response
(
200
,
"Success"
,
platform_status_message_schema
)
...
...
@@ -342,7 +336,6 @@ ns3 = api.namespace(
"autonomy_configuration"
,
description
=
"Autonomy Configuration Format"
)
@
ns3
.
route
(
""
)
class
AutonomyConfiguration
(
Resource
):
@
ns3
.
response
(
200
,
"Success"
,
autonomy_configuration_schema
)
...
...
@@ -352,23 +345,18 @@ class AutonomyConfiguration(Resource):
# @api.route('/mission-plan/<str:platform_type')
# @api.doc(params={"platform_type": "The type of platform of the mission plan to target."})
ns4
=
api
.
namespace
(
"mission_plan"
,
description
=
"Mission Plan Format per Platform"
)
ns4
=
api
.
namespace
(
"mission_plan"
,
description
=
"Mission Plan Format Per Platform"
)
@
ns4
.
route
(
"/ecosub"
)
class
MissionPlanEcosub
(
Resource
):
@
ns4
.
response
(
200
,
"Success"
,
message_header_schema
)
def
get
(
self
):
pass
@
ns4
.
route
(
"/hydrosurv"
)
class
MissionPlanHydrosurv
(
Resource
):
@
ns4
.
route
(
"/reav"
)
class
MissionPlanReav
(
Resource
):
@
ns4
.
response
(
200
,
"Success"
,
message_header_schema
)
def
get
(
self
):
pass
@
ns4
.
route
(
"/autosubhover"
)
class
MissionPlanAutosubHover
(
Resource
):
@
ns4
.
response
(
200
,
"Success"
,
message_header_schema
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment