OpenAPI core module

class kinto.core.openapi.AnyTypeConverter(dispatcher)

Convert type agnostic parameter to swagger.

class kinto.core.openapi.OpenAPI(services, request)

OpenAPI documentation generator.

custom_type_converters = {<class 'kinto.core.schema.Any'>: <class 'kinto.core.openapi.AnyTypeConverter'>}

Kinto additional type converters.

security_definitions = {}

Kinto security definitions. May be used for setting other security methods.

security_roles = {}

Kinto resource security roles. May be used for setting OAuth roles by plugins.

classmethod expose_authentication_method(method_name, definition)

Allow security extensions to expose authentication methods on the OpenAPI documentation. The definition field should correspond to a valid OpenAPI security definition. Refer the OpenAPI 2.0 specification for more information. https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md

Below are some examples for BasicAuth and OAuth2:

{
    "type": "basic",
    "description" "My basicauth method."

}

{
    "type": "oauth2",
    "authorizationUrl": "https://oauth-stable.dev.lcip.org/v1",
    "flow": "implicit",
    "scopes": {"kinto": "Kinto user scope."}
}
generate()

Generate a Swagger 2.0 documentation. Keyword arguments may be used to provide additional information to build methods as such ignores.

Parameters
  • title – The name presented on the swagger document.

  • version – The version of the API presented on the swagger document.

  • base_path – The path that all requests to the API must refer to.

  • info – Swagger info field.

  • swagger – Extra fields that should be provided on the swagger documentation.

Return type

dict

Returns

Full OpenAPI/Swagger compliant specification for the application.

default_tags(service, method)

Povides default tags to views.

default_op_ids(service, method)

Povides default operation ids to methods if not defined on view.

default_security(service, method)

Provides OpenAPI security properties based on kinto policies.