Skip to content

Commit

Permalink
fix examples part1
Browse files Browse the repository at this point in the history
  • Loading branch information
dpgaspar committed Jun 4, 2024
1 parent dbe567b commit 9d5027f
Show file tree
Hide file tree
Showing 36 changed files with 27,681 additions and 27,951 deletions.
5 changes: 2 additions & 3 deletions examples/base_api/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
from flask import Flask

from .api import ExampleApi
from .extensions import appbuilder, db
from .extensions import appbuilder


def create_app() -> Flask:
app = Flask(__name__)
app.config.from_object("config")
db.init_app(app)
with app.app_context():
appbuilder.init_app(app, db.session)
appbuilder.init_app(app)
appbuilder.add_api(ExampleApi)
return app
13 changes: 11 additions & 2 deletions examples/base_api/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
from flask_appbuilder.security.decorators import protect


greeting_schema = {"type": "object", "properties": {"name": {"type": "string"}}}
greeting_schema = {
"type": "object",
"properties": {"name": {"type": "string"}},
"required": ["name"],
}


class ExampleApi(BaseApi):
Expand Down Expand Up @@ -75,7 +79,12 @@ def greeting4(self, **kwargs):
---
get:
parameters:
- $ref: '#/components/parameters/greeting_schema'
- in: query
name: q
content:
application/json:
schema:
$ref: '#/components/schemas/greeting_schema'
responses:
200:
description: Greet the user
Expand Down
4 changes: 1 addition & 3 deletions examples/base_api/app/extensions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from flask import Flask
from flask_appbuilder import AppBuilder, SQLA
from flask_appbuilder import AppBuilder


db = SQLA()
appbuilder = AppBuilder()
Loading

0 comments on commit 9d5027f

Please sign in to comment.