Skip to main content

any2nix_api/
responses.rs

1// SPDX-FileCopyrightText: 2026 Gabriel Santos de Souza <gabriel.santosdesouza@dcomp.ufs.br>
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5use serde::Serialize;
6#[cfg(feature = "utoipa")]
7use utoipa::ToSchema;
8
9/// Response structure for a successful conversion. Includes only one "nix"
10/// key.
11#[derive(Serialize)]
12#[cfg_attr(feature = "utoipa", derive(ToSchema))]
13pub struct ConvertResponse {
14    /// Houses the converted data.
15    pub nix: String,
16}
17
18/// Response structure for an unsuccessful conversion. Includes only one "error" key.
19#[derive(Serialize)]
20#[cfg_attr(feature = "utoipa", derive(ToSchema))]
21pub struct ErrorResponse {
22    /// Houses the error message of the error.
23    pub error: String,
24}
25
26/// Response structure for the root endpoint. Inclues crate information.
27#[derive(Serialize)]
28#[cfg_attr(feature = "utoipa", derive(ToSchema))]
29pub struct RootResponse {
30    pub description: String,
31    #[cfg(feature = "utoipa-swagger-ui")]
32    pub docs: String,
33    pub name: String,
34    #[cfg(feature = "utoipa")]
35    pub openapi: String,
36    pub version: String,
37}