Commit 3a1cdab5 authored by Trishna Saeharaseelan's avatar Trishna Saeharaseelan
Browse files

refactor(docs): update model names

parent 7ceab743
...@@ -5,15 +5,12 @@ Command: ...@@ -5,15 +5,12 @@ Command:
2/ Go to http://127.0.0.1:5000/soardocs 2/ Go to http://127.0.0.1:5000/soardocs
WARNING: API Endpoints are NOT functional. Purely for easy-reading. WARNING: API Endpoints are NOT functional. Purely for easy-reading.
""" """
# from .formats.autonomy_configuration import autonomy_configuration_schema
from flask import Flask, request from flask import Flask, request
from flasgger import Swagger, LazyString from flasgger import Swagger, LazyString
from flask_restx import Api, fields, Resource from flask_restx import Api, fields, Resource
app = Flask(__name__) app = Flask(__name__)
# app.json_encoder = LazyJSONEncoder
api = Api(app) api = Api(app)
swagger_template = dict( swagger_template = dict(
info={ info={
...@@ -59,7 +56,7 @@ message_header_schema = api.model( ...@@ -59,7 +56,7 @@ message_header_schema = api.model(
) )
platform_schema = api.model( platform_schema = api.model(
"PlatformSchema", "Platform",
{ {
"platform_ID": fields.Integer( "platform_ID": fields.Integer(
required=True, required=True,
...@@ -85,7 +82,7 @@ platform_schema = api.model( ...@@ -85,7 +82,7 @@ platform_schema = api.model(
) )
squad_metadata_schema = api.model( squad_metadata_schema = api.model(
"SquadMetadataSchema", "SquadMetadata",
{ {
"squad_ID": fields.Integer( "squad_ID": fields.Integer(
required=True, required=True,
...@@ -117,7 +114,7 @@ squad_metadata_schema = api.model( ...@@ -117,7 +114,7 @@ squad_metadata_schema = api.model(
) )
constraints_schema = api.model( constraints_schema = api.model(
"ConstraintsSchema", "Constraints",
# TODO: Should this be per platform instead of squad? # TODO: Should this be per platform instead of squad?
{ {
"min_altitude": fields.Float( "min_altitude": fields.Float(
...@@ -147,7 +144,7 @@ environment_config_schema = api.model( # TODO: Discuss how regions are defined ...@@ -147,7 +144,7 @@ environment_config_schema = api.model( # TODO: Discuss how regions are defined
) )
# Main Autonomy Configuration Schema # Main Autonomy Configuration Schema
autonomy_configuration_schema = api.model( autonomy_configuration_schema = api.model(
"ConfigurationSchema", "Configuration",
{ {
"message": fields.Nested( "message": fields.Nested(
message_header_schema, message_header_schema,
...@@ -316,11 +313,10 @@ swagger_config = { ...@@ -316,11 +313,10 @@ swagger_config = {
"produces": ["application/json"], "produces": ["application/json"],
"consumes": ["application/json"], "consumes": ["application/json"],
} }
swagger = Swagger(app, template=swagger_template, config=swagger_config) swagger = Swagger(app, template=swagger_template, config=swagger_config)
ns1 = api.namespace("message", description="Message Header Format") ns1 = api.namespace("message", description="Message Header Format")
@ns1.route("/header") @ns1.route("/header")
class MessageHeader(Resource): class MessageHeader(Resource):
@ns1.response(200, "Success", message_header_schema) @ns1.response(200, "Success", message_header_schema)
...@@ -329,8 +325,6 @@ class MessageHeader(Resource): ...@@ -329,8 +325,6 @@ class MessageHeader(Resource):
ns2 = api.namespace("platform_status", description="Platform Status Message Format") ns2 = api.namespace("platform_status", description="Platform Status Message Format")
@ns2.route("") @ns2.route("")
class PlatformStatus(Resource): class PlatformStatus(Resource):
@ns2.response(200, "Success", platform_status_message_schema) @ns2.response(200, "Success", platform_status_message_schema)
...@@ -342,7 +336,6 @@ ns3 = api.namespace( ...@@ -342,7 +336,6 @@ ns3 = api.namespace(
"autonomy_configuration", description="Autonomy Configuration Format" "autonomy_configuration", description="Autonomy Configuration Format"
) )
@ns3.route("") @ns3.route("")
class AutonomyConfiguration(Resource): class AutonomyConfiguration(Resource):
@ns3.response(200, "Success", autonomy_configuration_schema) @ns3.response(200, "Success", autonomy_configuration_schema)
...@@ -352,23 +345,18 @@ class AutonomyConfiguration(Resource): ...@@ -352,23 +345,18 @@ class AutonomyConfiguration(Resource):
# @api.route('/mission-plan/<str:platform_type') # @api.route('/mission-plan/<str:platform_type')
# @api.doc(params={"platform_type": "The type of platform of the mission plan to target."}) # @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") @ns4.route("/ecosub")
class MissionPlanEcosub(Resource): class MissionPlanEcosub(Resource):
@ns4.response(200, "Success", message_header_schema) @ns4.response(200, "Success", message_header_schema)
def get(self): def get(self):
pass pass
@ns4.route("/reav")
class MissionPlanReav(Resource):
@ns4.route("/hydrosurv")
class MissionPlanHydrosurv(Resource):
@ns4.response(200, "Success", message_header_schema) @ns4.response(200, "Success", message_header_schema)
def get(self): def get(self):
pass pass
@ns4.route("/autosubhover") @ns4.route("/autosubhover")
class MissionPlanAutosubHover(Resource): class MissionPlanAutosubHover(Resource):
@ns4.response(200, "Success", message_header_schema) @ns4.response(200, "Success", message_header_schema)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment