diff --git a/radicle-httpd/src/api.rs b/radicle-httpd/src/api.rs index 0de97c4e..36bb531c 100644 --- a/radicle-httpd/src/api.rs +++ b/radicle-httpd/src/api.rs @@ -34,7 +34,9 @@ use crate::api::error::Error; use crate::cache::Cache; use crate::Options; -pub const VERSION: &str = env!("RADICLE_VERSION"); +pub const RADICLE_VERSION: &str = env!("RADICLE_VERSION"); +// This version has to be updated on every breaking change to the radicle-httpd API. +pub const API_VERSION: &str = "0.1.0"; /// Identifier for sessions type SessionId = String; diff --git a/radicle-httpd/src/api/v1.rs b/radicle-httpd/src/api/v1.rs index 437cc715..3815091b 100644 --- a/radicle-httpd/src/api/v1.rs +++ b/radicle-httpd/src/api/v1.rs @@ -11,7 +11,7 @@ use axum::routing::get; use axum::Router; use serde_json::json; -use crate::api::{Context, VERSION}; +use crate::api::{Context, API_VERSION, RADICLE_VERSION}; pub fn router(ctx: Context) -> Router { let root_router = Router::new() @@ -34,7 +34,8 @@ async fn root_handler(State(ctx): State) -> impl IntoResponse { let response = json!({ "message": "Welcome!", "service": "radicle-httpd", - "version": format!("{}-{}", VERSION, env!("GIT_HEAD")), + "version": format!("{}-{}", RADICLE_VERSION, env!("GIT_HEAD")), + "apiVersion": API_VERSION, "nid": ctx.profile.public_key, "path": "/api/v1", "links": [ diff --git a/radicle-httpd/src/api/v1/node.rs b/radicle-httpd/src/api/v1/node.rs index 0181868d..2e42b587 100644 --- a/radicle-httpd/src/api/v1/node.rs +++ b/radicle-httpd/src/api/v1/node.rs @@ -12,7 +12,7 @@ use radicle::node::{policy, AliasStore, Handle, NodeId, DEFAULT_TIMEOUT}; use radicle::Node; use crate::api::error::Error; -use crate::api::{self, Context, PoliciesQuery, VERSION}; +use crate::api::{self, Context, PoliciesQuery, RADICLE_VERSION}; use crate::axum_extra::{Path, Query}; pub fn router(ctx: Context) -> Router { @@ -47,7 +47,7 @@ async fn node_handler(State(ctx): State) -> impl IntoResponse { }; let response = json!({ "id": node_id.to_string(), - "version": format!("{}-{}", VERSION, env!("GIT_HEAD")), + "version": format!("{}-{}", RADICLE_VERSION, env!("GIT_HEAD")), "config": config, "state": node_state, });