Coverage for girder/api/describe : 98%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
#!/usr/bin/env python # -*- coding: utf-8 -*-
############################################################################### # Copyright Kitware Inc. # # Licensed under the Apache License, Version 2.0 ( the "License" ); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. ###############################################################################
""" Whenever we add new return values or new options we should increment the maintenance value. Whenever we add new endpoints, we should increment the minor version. If we break backward compatibility in any way, we should increment the major version. """
""" This class provides convenient chainable semantics to allow api route handlers to describe themselves to the documentation. A route handler function can set a description property on itself to an instance of this class in order to describe itself. """
""" Returns this description object as an appropriately formatted dict """ 'summary': self._summary, 'notes': self._notes, 'parameters': self._params, 'responseMessages': self._responses, 'responseClass': self._responseClass }
required=True): """ This helper will build a parameter declaration for you. It has the most common options as defaults, so you won't have to repeat yourself as much when declaring the APIs. """ 'name': name, 'description': description, 'paramType': paramType, 'type': dataType, 'allowMultiple': False, 'required': required })
""" This helper will build an errorResponse declaration for you. Many endpoints will be able to use the default parameter values for one of their responses. """ 'message': reason, 'code': code })
ROOT_DIR, 'clients', 'web', 'static', 'built', 'swagger', 'swagger.html'), content_type='text/html')
'apiVersion': API_VERSION, 'swaggerVersion': SWAGGER_VERSION, 'basePath': cherrypy.url(), 'apis': [{'path': '/{}'.format(resource)} for resource in sorted(docs.discovery)] }
raise RestException('Invalid resource: {}'.format(resource))
'apiVersion': API_VERSION, 'swaggerVersion': SWAGGER_VERSION, 'basePath': os.path.dirname(os.path.dirname(cherrypy.url())), 'apis': [{'path': route, 'operations': ops} for route, ops in docs.routes[resource].iteritems()] } |