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 optional utoipa to generated prisma macro #447

Open
askasp opened this issue Mar 25, 2024 · 1 comment
Open

Add optional utoipa to generated prisma macro #447

askasp opened this issue Mar 25, 2024 · 1 comment

Comments

@askasp
Copy link

askasp commented Mar 25, 2024

I wanted to generate a openapi schema from the prisma types.
I tried doing the following, but i cant get the prisma-cli to compile.

quote! {
        #[derive(Debug, Clone, ::serde::Serialize, ::serde::Deserialize, utoipa::ToSchema)]
        #specta_derive
        pub struct Data {
            #(#struct_fields),*
        }

        impl Data {
            #(#relation_accessors)*
        }
    }
}

When i try to do prisma-generate it sais i need cargo to enable postgresql feature.

However, when i try to add postgresql in the dependency list here

[package]
name = "prisma-cli"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[features]
postgresql = ["prisma-client-rust-cli/postgresql"]

[dependencies]
prisma-client-rust-cli = { features = [
  "migrations",
  # "mutation-callbacks",
], default_features = false, path = "../../prisma-client-rust/crates/cli" }

i get an error on

tcp_keepalive = tcp_keepalive.with_interval(interval); ^^^^^^^^^^^^^ method not found in TcpKeepalive

If you can give me a pointer on how to get past this step i'll gladly try to set up a PR for an optional toSchema derivation on the prisma data structures!

@Brendonovich
Copy link
Owner

I think this is a dependency issue I may have recently resolved, but aside from that I'd recommend applying the utopia::ToSchema conditionally as is done in Specta, unless you don't intend on PRing this change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants