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

[FEATURE REQUEST] Deeply / recursively export components into openapi #1025

Closed
clotodex opened this issue Sep 5, 2024 · 5 comments · Fixed by #1066 or #1071
Closed

[FEATURE REQUEST] Deeply / recursively export components into openapi #1025

clotodex opened this issue Sep 5, 2024 · 5 comments · Fixed by #1066 or #1071
Labels
enhancement New feature or request

Comments

@clotodex
Copy link

clotodex commented Sep 5, 2024

(I am using axum and the axum bindings)
I noticed that to completely export a type I also have to list all subtypes in the components.
While this offers 100% felxibility, I am trying to export generated code which means I need to import and list every single subtype manually, which is errorprone.

Example:

  • assume you have an enum
// Define the structs for each shape type
struct Circle {
    radius: f64,
}

struct Rectangle {
    width: f64,
    height: f64,
}

struct Triangle {
    base: f64,
    height: f64,
}

// Define the enum that wraps the different shape structs
enum Shape {
    Circle(Circle),
    Rectangle(Rectangle),
    Triangle(Triangle),
}

Then I cannot just list Shape in the components but have to list Shape, Rectangle, Triangle, Circle ...

Is this feasible? I used schemars with okapi before where they somehow made this work

@juhaku
Copy link
Owner

juhaku commented Sep 5, 2024

At the moment they need to be listed manually. But I'm planning to improve this eventually to the 5.0.0 version.

@juhaku juhaku added the enhancement New feature or request label Sep 5, 2024
@jayvdb
Copy link
Contributor

jayvdb commented Sep 9, 2024

I believe this is a dup of #465

@juhaku
Copy link
Owner

juhaku commented Sep 9, 2024

Yeah it actually touches the same topic.

@juhaku
Copy link
Owner

juhaku commented Sep 22, 2024

There is now WIP branch for work related to this one. https://github.com/juhaku/utoipa/pull/new/feature-auto-collect-schemas

@juhaku
Copy link
Owner

juhaku commented Oct 7, 2024

I could consider this as done, as all mandatory things for this is implemented excluding support for ToReponse and IntoReponses. Those can be followed in a separate issue and I link the issue here as well.

@juhaku juhaku closed this as completed Oct 7, 2024
@juhaku juhaku moved this from Done to Released in utoipa kanban Oct 15, 2024
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
3 participants