-
-
Notifications
You must be signed in to change notification settings - Fork 360
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
Enhancement: Add ResponseSpec(examples=...)
#3068
Labels
Comments
Related, any thoughts about supporting @get()
def endpoint() -> Annotated[ResponseModel, ResponseSpec(examples=[...])]: ... |
This feels reasonable to me. |
tuukkamustonen
pushed a commit
to tuukkamustonen/litestar
that referenced
this issue
Feb 13, 2024
Allows to define. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
tuukkamustonen
pushed a commit
to tuukkamustonen/litestar
that referenced
this issue
Feb 13, 2024
Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
tuukkamustonen
pushed a commit
to tuukkamustonen/litestar
that referenced
this issue
Feb 13, 2024
Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
tuukkamustonen
pushed a commit
to tuukkamustonen/litestar
that referenced
this issue
Feb 13, 2024
Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
tuukkamustonen
pushed a commit
to tuukkamustonen/litestar
that referenced
this issue
Feb 13, 2024
Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
tuukkamustonen
added a commit
to tuukkamustonen/litestar
that referenced
this issue
Feb 13, 2024
Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
tuukkamustonen
added a commit
to tuukkamustonen/litestar
that referenced
this issue
Feb 13, 2024
Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Feb 13, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Feb 13, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Feb 13, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
Closed in #3100 |
provinzkraut
pushed a commit
that referenced
this issue
Feb 13, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Feb 13, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Feb 14, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
ch-iv
pushed a commit
to ch-iv/litestar
that referenced
this issue
Feb 19, 2024
feat: Support `ResponseSpec(..., examples=[...])` (litestar-org#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Mar 1, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Mar 4, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Mar 9, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
provinzkraut
pushed a commit
that referenced
this issue
Mar 10, 2024
feat: Support `ResponseSpec(..., examples=[...])` (#3068) Allows to define custom examples for the responses via `ResponseSpec`. The examples set this way are always generated locally, for each response: ```json { "paths": { "/": { "get": { "responses": { "200": { "content": { "application/json": { "schema": {...}, "examples": ... ``` Examples that go within the schema definition cannot be set by this.
A fix for this issue has been released in v2.7.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Summary
Support adding custom examples for the response body.
The inbound parameters can be defined via
Parameter
, but the same does not work for the response body.ResponseSpec
only hasgenerate_examples
, but it should support alsoexamples
for custom ones.Basic Example
No response
Drawbacks and Impact
No response
Unresolved questions
No response
Note
While we are open for sponsoring on GitHub Sponsors and
OpenCollective, we also utilize Polar.sh to engage in pledge-based sponsorship.
Check out all issues funded or available for funding on our Polar.sh dashboard
The text was updated successfully, but these errors were encountered: