Skip to content

Conversation

@itsmeow
Copy link
Member

@itsmeow itsmeow commented Jun 29, 2025

Replaces flask-restful, flask-swagger-ui, flask-marshmallow, and flask-apispec. Updates the OpenAPI spec support from 2.0 to 3.1.1. Updates our swaggerui to latest and hosts the scripts from jsdelivr. Keep in mind we may need to bump that link (swagger-ui-dist@5.25.3) occasionally. Corrects swaggerui displaying schema args as JSON bodies when they should be query strings. Moves all schemas to schema.py

Improves error handling and prevents unnecessary information disclosure in several of the endpoints

Closes #32

Library working:
image
image

Old swaggerui
image
New swaggerui
image

@Crossedfall Crossedfall requested a review from Copilot June 29, 2025 22:03

This comment was marked as outdated.

@Crossedfall Crossedfall requested a review from Copilot June 29, 2025 22:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR converts the API from flask‐apispec and related libraries to flask‑smorest, bumps several dependencies, and updates the OpenAPI specification from 2.0 to 3.1.1. Key changes include:

  • Migrating resource endpoints from MethodResource to MethodView with flask‑smorest Blueprints.
  • Updating error handling to include proper status codes and logging.
  • Bumping dependency versions and updating configuration to reflect the new API structure.

Reviewed Changes

Copilot reviewed 11 out of 13 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/bapi/schemas.py Added new schema definitions for Patreon, Budget, and statistics totals.
src/bapi/resources/stats.py Converted stats endpoints with updated error logging and status codes.
src/bapi/resources/patreon.py Updated Patreon endpoints with blueprint routing and improved error responses.
src/bapi/resources/library.py Switched book list/resource endpoints to flask‑smorest with query argument parsing.
src/bapi/resources/general.py Updated general endpoints for version and player list; changed error handling and logging.
src/bapi/resources/bans.py Migrated ban list endpoint to flask‑smorest with updated argument handling.
src/bapi/db.py Updated BookSchema to use SQLAlchemyAutoSchema from marshmallow‑sqlalchemy.
src/bapi/cfg.py Bumped API version configuration.
src/bapi/blueprints/discord.py Updated Discord blueprint error responses with proper status codes.
src/bapi/init.py Replaced flask‑apispec configuration with flask‑smorest API registration and updated OpenAPI config.
pyproject.toml Upgraded several dependency versions and bumped the project version.

itsmeow and others added 3 commits June 29, 2025 18:37
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Crossedfall Crossedfall merged commit 5c54d28 into master Jun 30, 2025
4 checks passed
@itsmeow itsmeow deleted the flask-smorest branch June 30, 2025 07:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace flask-apispec

3 participants