Skip to content

Commit

Permalink
#119: Fix OpenAPI YAML to use camelCase attribute names
Browse files Browse the repository at this point in the history
  • Loading branch information
MRichards99 committed Jan 28, 2021
1 parent edba864 commit 3c086a6
Show file tree
Hide file tree
Showing 2 changed files with 874 additions and 870 deletions.
8 changes: 6 additions & 2 deletions datagateway_api/src/resources/entities/entity_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ def create_entity_models():
endpoint_table = EntityHelper.get_entity_object_from_name(endpoints[endpoint])
endpoint_inspection = inspect(endpoint_table)
for column in endpoint_inspection.columns:
# Needed to ensure camelCase field names are used, rather than SNAKE_CASE
attribute_field_name = endpoint_inspection.get_property_by_column(
column,
).key
python_type = (
column.type.impl.python_type
if hasattr(column.type, "impl")
Expand All @@ -94,8 +98,8 @@ def create_entity_models():
if column.doc:
param["description"] = column.doc
if not column.nullable:
required.append(column.name)
params[column.name] = param
required.append(attribute_field_name)
params[attribute_field_name] = param

for (
relationship_name,
Expand Down
Loading

0 comments on commit 3c086a6

Please sign in to comment.