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

Enhance OpenApi nesting with tags support #932

Merged
merged 1 commit into from
May 20, 2024

Conversation

juhaku
Copy link
Owner

@juhaku juhaku commented May 20, 2024

This commits enhances the OpenApi nesting support by adding possibility to define tags [...] for the nested OpenApi endpoints. By default the fully qualified path to the nested OpenApi will become the tag for the endpoints if provided.

This commit also makes it necessary to define the argument names within the nest tuple to be constant across the utoipa macros and more readable. Path and api arguments are necessary.

Supported nesting syntax:

(path = "/path/to/nest/api", api = path::to:NestableApi, tags = [...])

Breaking! This is breaking change as this changes the utoipa::Path trait syntax to following. Prior this commit the path_item function took Option<&str> parameter to define default tag for the path operation but this is no longer necessary.

trait Path {
    fn path() -> String;
    fn path_item() -> PathItem;
}

Follow up PR for #930

Resolves #445 Resolves #872

This commits enhances the `OpenApi` nesting support by adding possiblity
to define `tags [...]` for the nested OpenApi endpoints. By default the
fully qualified path to the nested `OpenApi` will become the tag for the
endpoints if provided.

This commit also makes it necessary to define the argument names within
the nest tuple to be constant across the utoipa macros and more
readable. `Path` and `api` arguments are necesary.

Supported nesting syntax:
```rust
(path = "/path/to/nest/api", api = path::to:NestableApi, tags = [...])
```

**Breaking!** This is breaking change as this changes the `utoipa::Path`
trait syntax to following. Prior this commit the the `path_item`
function took `Option<&str>`parameter to define default `tag` for the
path operation but this is no longer necessary.
```rust
trait Path {
    fn path() -> String;
    fn path_item() -> PathItem;
}
```

Follow up PR for #930

Resolves #445 Resolves #872
@juhaku juhaku merged commit b22eb1a into master May 20, 2024
14 checks passed
@juhaku juhaku deleted the feature-enhance-api-nesting branch May 20, 2024 18:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Released
Development

Successfully merging this pull request may close these issues.

Could utoipa support nesting of ApiDoc definitions? Group and nest related paths/components
1 participant