Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

http://host/docs parameters are missing #220

Closed
4 tasks done
WP-LKL opened this issue Mar 21, 2022 · 3 comments
Closed
4 tasks done

http://host/docs parameters are missing #220

WP-LKL opened this issue Mar 21, 2022 · 3 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation question Further information is requested

Comments

@WP-LKL
Copy link

WP-LKL commented Mar 21, 2022

First Check

  • I added a very descriptive title to this issue.
  • I already read and followed all the tutorial in the docs and didn't find an answer.
  • I already checked if it is not related to AuthX but to Pydantic.
  • I already checked if it is not related to AuthX but to FastAPI.

Example Code

from fastapi import APIRouter, Depends, FastAPI
from starlette.config import Config

from authx import Authentication, User

app = FastAPI(
    title="AuthX",
    description="AuthX is a simple authentication system for fastapi.",
    version="0.1.0",
)

config = Config(".env")

auth = Authentication(
    debug=config("DEBUG", default=False, cast=bool),
    base_url=config("BASE_URL", default="http://localhost:8000"),
    site=config("SITE", default="authx"),
    database_backend=config("DATABASE_BACKEND", default="sqlite"),
    callbacks=[],
    access_cookie_name=config("ACCESS_COOKIE_NAME", default="access_token"),
    refresh_cookie_name=config("REFRESH_COOKIE_NAME", default="refresh_token"),
    private_key=config("PRIVATE_KEY", default="private_key"),
    public_key=config("PUBLIC_KEY", default="public_key"),
    access_expiration=config("ACCESS_EXPIRATION", default=3600),
    refresh_expiration=config("REFRESH_EXPIRATION", default=86400),
    smtp_username=config("SMTP_USERNAME", default="username"),
    smtp_password=config("SMTP_PASSWORD", default="password"),
    smtp_host=config("SMTP_HOST", default="smtp.gmail.com"),
    smtp_tls=config("SMTP_TLS", default=True),
    display_name=config("DISPLAY_NAME", default="AuthX"),
    recaptcha_secret=config("RECAPTCHA_SECRET", default="secret"),
    social_providers=[],
    social_creds=None,
)

router = APIRouter()


app.include_router(auth.auth_router, prefix="/api/auth", tags=["auth"])
app.include_router(auth.password_router, prefix="/api/password", tags=["password"])
app.include_router(auth.admin_router, prefix="/api/admin", tags=["admin"])
app.include_router(auth.search_router, prefix="/api/search", tags=["search"])

# Set Anonymous User
@router.get("/anonym")
def anonym_test(user: User = Depends(auth.get_user)):
    pass


# Set Authenticated User
@router.get("/user")
def user_test(user: User = Depends(auth.get_authenticated_user)):
    pass


# Set Admin User
@router.get("/admin", dependencies=[Depends(auth.admin_required)])
def admin_test():
    pass

---
# authx/routers/auth.py
    ...
    router = APIRouter()

    @router.post("/register", name="auth:register")
    async def register(*, request: Request, response: Response):
        """
        register a new user
        Args:
            request: Request
            response: Response

        Returns:
            Response
        """
        data = await request.json()
        service = AuthService()

        tokens = await service.register(data)
        set_tokens_in_response(response, tokens)
        return None
        ...

Description

Running either the new example/cache or example/main (modified for dependencies) one finds that the API docs are without parameter suggestions for most endpoints.

Operating System

Linux

Operating System Details

Using Docker within Arch distro.

FastAPI Version

0.68.1

Python Version

3.9, 3.8

Additional Context

The project looks promising in many ways, and I hope it gets there.

@WP-LKL WP-LKL added the question Further information is requested label Mar 21, 2022
@yezz123 yezz123 added bug Something isn't working documentation Improvements or additions to documentation labels Mar 21, 2022
@yezz123
Copy link
Owner

yezz123 commented Mar 21, 2022

Hello, @WP-LKL Still didn't get what issue you got really, I guess you mean the docs Swagger or redoc? i guess its related to this one mostly #62

@WP-LKL
Copy link
Author

WP-LKL commented Mar 21, 2022

Thanks for the quick response. Maybe the screenshot below describes it better:

2022-03-21_22-45

I assume this rather is an issue with my (or the example code) utilization of the module, hence the attached code.

@yezz123
Copy link
Owner

yezz123 commented Mar 24, 2022

Thanks for the quick response. Maybe the screenshot below describes it better:

2022-03-21_22-45

I assume this rather is an issue with my (or the example code) utilization of the module, hence the attached code.

I guess its related to examples i will enhance them ASAP thanks for the report 🙏🏻

Repository owner locked and limited conversation to collaborators Mar 6, 2023
@yezz123 yezz123 converted this issue into discussion #379 Mar 6, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Something isn't working documentation Improvements or additions to documentation question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants