Skip to content

Conversation

luolingchun
Copy link
Owner

@luolingchun luolingchun commented Sep 12, 2023

Checklist:

  • Run pytest tests and no failed.
  • Run flake8 flask_openapi3 tests examples and no failed.
  • Run mypy flask_openapi3 and no failed.
  • Run mkdocs serve and no failed.

Regarding the idea of supporting raw requests, there is no data validation and support for OpenAPI UI.

from flask_openapi3 import OpenAPI
from flask_openapi3 import RawModel

app = OpenAPI(__name__)


class BookRaw(RawModel):
    mimetypes = ["text/csv", "application/json"]


@app.post("/book")
def get_book(raw: BookRaw):
    # raw equals to flask.request
    print(raw.data)
    print(raw.mimetype)
    return "ok"


if __name__ == "__main__":
    app.run(debug=True)

@luolingchun luolingchun marked this pull request as ready for review September 28, 2023 02:32
@luolingchun luolingchun merged commit 19cea55 into master Oct 15, 2023
@luolingchun luolingchun deleted the Support_raw_request branch October 15, 2023 08:41
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.

1 participant