from apispec import APISpec from apispec.ext.marshmallow import MarshmallowPlugin from core_apispec.apispec import CoreApiSpec from atlas_um.api.v2.views import api_v2 from atlas_um.oauth import oauth def register_apispec(app): description = "User account management for SME Data & Analytics" terms_of_service = "https://www.sonymusic.com/terms-and-conditions/" version = "v2" blueprints = (oauth, api_v2) spec = APISpec( title="AtlasUM API", version=version, info={ "description": description, "termsOfService": terms_of_service, "license": { "name": "Proprietary", }, }, openapi_version="3.0.2", plugins=[MarshmallowPlugin()], security=[ {"bearerAuth": []}, {"cookieAuth": []}, ], components={ "securitySchemes": { "cookieAuth": { "type": "apiKey", "in": "cookie", "name": "dna_bearer_token", }, "bearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT", }, }, }, ) docs = CoreApiSpec( app=app, document_options=False, spec=spec, version=version, swagger_url=f"/api/{version}/swagger/", swagger_ui_url=f"/api/{version}/docs/", blueprints=blueprints, ) docs.register_blueprints()