Skip to content

Commit

Permalink
Added note on the purpose of build_action_schema
Browse files Browse the repository at this point in the history
  • Loading branch information
jtc42 committed May 28, 2020
1 parent 326d509 commit 752fd97
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/labthings/server/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,15 @@ def generate_links(self, data, **kwargs):


def build_action_schema(output_schema: Schema, input_schema: Schema, name: str = None):
"""
Builds a complete schema for a given ActionView. That is, it reads any input and output
schemas attached to the POST method, and nests them within the input/output fields of
the generic ActionSchema.
NOTE: This is only for documentation purposes. When Action responses are built by the
HTTP server, the generic ActionSchema will be used for marshaling. This is because the
post() functions return value will already be marshaled because of its @marshal_with
decorator, and thus will already be a formatted dictionary object.
"""
# Create a name for the generated schema
if not name:
name = str(id(output_schema))
Expand Down

0 comments on commit 752fd97

Please sign in to comment.