Skip to content

[BUG] SecurityScheme(name="auth_apiKey) #270

@bekishev04

Description

@bekishev04

I dont know this is bug of spec_tree or openapi.

I use SecurityScheme like here https://github.com/0b01001001/spectree/blob/master/tests/common.py#L84. But when i use this scheme and I register the token in the documentation (/apidoc/swagger). The token is not in the headers. I dont see it anywhere

Code example

from collections import OrderedDict

from flask import Flask
from flask_cors import CORS
from pydantic import EmailStr
from spectree import SpecTree
from spectree.config import Contact
from spectree.models import (
    Server,
    SecurityScheme,
    SecuritySchemeData,
    SecureType,
)

from ..config import cfg
from ..database import db, migrate


spec_tree = SpecTree(
    "flask",
    mode="strict",
    title="Docs AuthService API",
    version=cfg.API_VERSION,
    annotations=True,
    contact=Contact(
        name="Бекишев Матвей",
        email=EmailStr("[email protected]"),
    ),
    servers=[
        Server(
            url="http://127.0.0.1:5555/",
            description="Local Server",
        ),
    ],
    security_schemes=[
        SecurityScheme(
            # todo баг библиотеки
            name="auth_apiKey",
            data={"type": "apiKey", "name": "Authorization", "in": "header"},
        ),
        # SecurityScheme(
        #     name="ApiKey",
        #     data=SecuritySchemeData(
        #         type=SecureType.HTTP,
        #         description="Access Token in AuthService API",
        #         scheme="bearer",
        #         bearerFormat="UUID",
        #     ),
        # ),
    ],
    security=dict(
        ApiKey=[],
    ),
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions