How can I map a type to an external reference like with openapi-generator's typeMappings
?
#7268
Unanswered
quasi-coherent
asked this question in
Q&A
Replies: 1 comment 1 reply
-
If it is not a valid OpenAPI spec, we don't have much to do with that. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
A colleague of mine needs to use this tool to generate a GraphQL schema from an OpenAPI specification of a server. I wrote this OpenAPI schema to also generate Rust server code, but for "technical" reasons, one type is actually declared like this
The reason is that what the type of
thing
is, is actually a very complicated schema from a different OpenAPI spec, and again, for reasons, I don't want to use a$ref
. But we actually generate Rust code from that already, so this is fine, because I can configure the generator withand the generated code maps
ExternalThingSchema
to a valid reference to a type.This schema is part of a response, but since this is not "valid" OpenAPI on its own, graphql-mesh obviously can't handle it. My question is this:
Assuming that there exists already a GraphQL schema that does define the
Thing
, is there some way to achieve a similar end? I've looked through the docs andargTypeMap
is kind of along these lines, but not really, and obviously that's only for request types.The documentation on
responseSchema
is sparse, but all the examples I've seen reference a file that contains the whole schema, which sort of defeats the purpose.Maybe there's a way to generate a sort of generic placeholder type for
MySchema
(orExternalThingSchema
?), and then unify that with the one already defined that has the real type?Or maybe start with the generic placeholder type again, and then use the
replace-field
transform?Maybe a simpler question that could help a lot: how can I get it to generate something, anything from such a schema? I feel like I'd be able to try a lot of things if I could do that.
Beta Was this translation helpful? Give feedback.
All reactions