Skip to content
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

Add derive IntoResponses support #433

Merged
merged 2 commits into from
Jan 12, 2023
Merged

Conversation

juhaku
Copy link
Owner

@juhaku juhaku commented Jan 12, 2023

Add support for derive IntoResponses. Supported syntax:

 #[derive(utoipa::IntoResponses)]
 struct SuccessResponse {
     value: String,
 };

 #[derive(utoipa::IntoResponses)]
 struct NotFound;

 #[derive(utoipa::IntoResponses)]
 struct CreatedResponse(Foo);

 #[derive(utoipa::IntoResponses)]
 enum UserResponses {
     /// Success response
     #[response(status = 200)]
     Success { value: String },

     #[response(status = 404)]
     NotFound,

     #[response(status = 400)]
     BadRequest(BadRequest),

     #[response(status = 500)]
     ServerError(#[ref_response] Response),

     #[response(status = 418)]
     TeaPot(#[to_response] Response),
 }

Add docs for IntoResponses and update docs overall.

Resolves #412

Add support for derive `IntoResponses`. Supported syntax:
```rust
 #[derive(utoipa::IntoResponses)]
 struct SuccessResponse {
     value: String,
 };

 #[derive(utoipa::IntoResponses)]
 struct NotFound;

 #[derive(utoipa::IntoResponses)]
 struct CreatedResponse(Foo);

 #[derive(utoipa::IntoResponses)]
 enum UserResponses {
     /// Success response
     #[response(status = 200)]
     Success { value: String },

     #[response(status = 404)]
     NotFound,

     #[response(status = 400)]
     BadRequest(BadRequest),

     #[response(status = 500)]
     ServerError(#[ref_response] Response),

     #[response(status = 418)]
     TeaPot(#[to_response] Response),
 }
```

Add docs for `IntoResponses` and update docs overall.

wip IntoResponses derive implementaiton

Wip IntoResponses derive implementation

Add support for IntoResponses derive

Add IntoResponses docs and update docs overall
@juhaku juhaku added the enhancement New feature or request label Jan 12, 2023
@juhaku juhaku merged commit 4a08316 into master Jan 12, 2023
@juhaku juhaku deleted the feature-into-responses-derive branch January 12, 2023 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

Derive Responses implementation
1 participant