#Trying to generate a OpenAPI C client - repeatedly fails to generate "any_type.h"

18 messages · Page 1 of 1 (latest)

frigid sedge
#

👋

Trying to explore and see if Convex might be a good choice for a simple side project. I'm basically looking to interact with Convex through a Zig application.

That being the case, it seemed like generating a C client is the right call, unfortunately the generator appears to constantly fail to generate the necessary files. When I go to build, the compiler keeps complaining about a missing file called any_type.h

Not sure whether it's an issue with the spec generator or OpenAPI itself; figured I'd ask here first.

If it matters I'm on Windows.

For reference, this is pretty much the api I need:

`import {mutation, query} from "./_generated/server";
import {v} from "convex/values"

export const get = query({
args: {}, handler: async (ctx) => {
return await ctx.db.query("links").collect()
}
})

export const add = mutation({
args: {
label: v.string(),
city: v.string(),
ip: v.string(),
link_id: v.string()
},
handler: async (ctx, args) => {

    return await ctx.db.insert("stats", {...args})
}

})`

Thank you!🎉

mild craneBOT
#

Thanks for posting in #1088161997662724167.
Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets.

  • Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.)
  • Use search.convex.dev to search Docs, Stack, and Discord all at once.
  • Additionally, you can post your questions in the Convex Community's #1228095053885476985 channel to receive a response from AI.
  • Avoid tagging staff unless specifically instructed.

Thank you!

quartz yacht
#

hi! one wild aside, not to dodge your original question... but we have a high quality (https://crates.io/crates/convex) rust crate that we've been building python, kotlin, and swift bindings with lately. dunno if @restive jolt (who has been doing this work lately) has any tips on ending up with a nice C API from the rust crate

terse shuttle
#

hi! i can also help with debugging this issue. can you please tell me which OpenAPI generator you are using and the full error message?

frigid sedge
frigid sedge
frigid sedge
#

ok, I think I have something working in Rust but still need to test. That said it's a bit more verbose than I would have liked.

Still open to any ideas on how to generate via OpenAPI or where to look next.

quartz yacht
#

I'm just using whatever the latest one is thats on NPM.
I'm guessing you're referring to our spec generator -- Convex -> OpenAPI spec

#

I think Jordan was asking about the generator that goes from the OpenAPI spec to a C project (.c/.h), which one of those you're using

frigid sedge
restive jolt
#

it looks like there's 3rd party C++ support for binding generation, although it looks like it doesn't support async functions

#

the Rust ConvexClient exposes async methods, so that probably won't work for your use case

frigid sedge
#

Thanks for the link @restive jolt ! I didn't know this project exists. Bookmarking for later.

I actually managed to cobble something together; after testing my duct-tapped library using your folks' Rust crate it looks like it'll work well enough for my purposes. Not sure how to mark this as "closed" but feel free to close this.

But that said, I think it would still be great to figure out why the openapi cli isn't generating the any_type.h header.

terse shuttle
#

i can help you further debug the OpenAPI spec generator. .h is a C++ file type, so i’m curious if there is something weird going on with the generator.

#

which version of the generator are you using?

#

after a quick search, i saw this

#

it may be worth trying another generator to see if that also runs into the same issue