-
Hi. I want to add OpenApi feature for my current Poem app. Each endpoint is located in its own module (/api/queries/endpoint_name.rs). ❯ exa --git-ignore -T meta
meta
├── api
│ └── queries
│ ├── find_meta.rs
❯ exa --git-ignore -T health/
health
├── api
│ └── queries
│ ├── find_health.rs I did the same with async-graphql and I can use MergedObject to merge my Quries and Mutations that scattered in each own module. // src/health/resolver.rs
#[Object]
impl HealthQuery {
pub async fn health(&self, ctx: &Context<'_>) -> FieldResult<Health> {
...
}
}
// src/meta/resolver.rs
#[Object]
impl MetaQuery {
pub async fn meta(&self, ctx: &Context<'_>) -> FieldResult<Meta> {
...
}
}
// main.rs
#[derive(MergedObject, Default)]
pub struct Query(
MetaQuery,
HealthQuery,
); Could I do something simmiar? Thanks in advance |
Beta Was this translation helpful? Give feedback.
Answered by
sunli829
Mar 7, 2022
Replies: 1 comment 1 reply
-
You can combine multiple APIs. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
azzamsa
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can combine multiple APIs.
poem/examples/openapi/combined-apis/src/main.rs
Line 41 in 9326e97