Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Discussion options

I currently have an endpoint with the decorator:

@api.route("/action/<string:action_id>")
class ApiAction(Resource):
    @api.doc(
        responses={200: "The action object", 404: "Action not found"}
    )
    def get(self, action_id: UUID):
        ...

which generates:

      responses:
        "200":
          description: Newly created action

I want to generate:

      responses:
        "200":
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Action'
          description: Newly created action

Is it possible to add this content data with Flask-Restx

You must be logged in to vote

Replies: 1 comment

Comment options

You can specify a model that gets returned from flask-restx using something like @api.response(200, 'Success', model). (You can have multiple responses per endpoint too).

See this bit of the docs: https://flask-restx.readthedocs.io/en/latest/swagger.html#documenting-with-the-api-response-decorator

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
🙏
Q&A
Labels
None yet
2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.