Commit e9e33ad7 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Fixed broken optimade flask restplus models.

parent 4bc3ca75
Pipeline #62563 passed with stages
in 34 minutes and 34 seconds
......@@ -21,8 +21,8 @@ from nomad.metainfo.optimade import OptimadeEntry
from .api import api, url
from .models import json_api_single_response_model, entry_listing_endpoint_parser, Meta, \
Links, CalculationDataObject, single_entry_endpoint_parser, base_endpoint_parser,\
json_api_info_response_model
Links, CalculationDataObject, single_entry_endpoint_parser, base_endpoint_parser, \
json_api_info_response_model, json_api_list_response_model
from .filterparser import parse_filter, FilterException
......@@ -51,7 +51,7 @@ class CalculationList(Resource):
@api.doc('list_calculations')
@api.response(400, 'Invalid requests, e.g. bad parameter.')
@api.expect(entry_listing_endpoint_parser, validate=True)
@api.marshal_with(json_api_single_response_model, skip_none=True, code=200)
@api.marshal_with(json_api_list_response_model, skip_none=True, code=200)
def get(self):
""" Retrieve a list of calculations that match the given Optimade filter expression. """
request_fields = base_request_args()
......
......@@ -208,6 +208,7 @@ json_api_data_object_model = api.model('DataObject', {
'attributes': fields.Raw(
description='A dictionary, containing key-value pairs representing the entries properties')
# TODO
# further optional fields: links, meta, relationships
})
......@@ -276,7 +277,7 @@ json_api_single_response_model = api.inherit(
})
json_api_list_response_model = api.inherit(
'SingleResponse', json_api_response_model, {
'ListResponse', json_api_response_model, {
'data': fields.List(
fields.Nested(json_api_data_object_model),
required=True,
......@@ -284,7 +285,7 @@ json_api_list_response_model = api.inherit(
})
json_api_info_response_model = api.inherit(
'SingleResponse', json_api_response_model, {
'InfoResponse', json_api_response_model, {
'data': fields.Nested(
model=json_api_calculation_info_model,
required=True,
......
Supports Markdown
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