Skip to content

Commit

Permalink
Refactor oas_worker_bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
afsalthaj committed Apr 1, 2024
1 parent 6d159dc commit 062ab5f
Show file tree
Hide file tree
Showing 9 changed files with 201 additions and 193 deletions.
2 changes: 0 additions & 2 deletions golem-worker-service-base/src/api/custom_http_request_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use crate::worker_binding::golem_worker_binding::ResponseMapping;
use crate::worker_binding::worker_binding_resolver::WorkerBindingResolver;
use crate::worker_bridge::WorkerRequest;
use crate::worker_bridge::workr_request_executor::WorkerRequestExecutor;
use crate::worker_request::worker_request_to_response::WorkerRequestToResponse;
use crate::worker_request::WorkerRequest;

// Executes custom request with the help of worker_request_executor and definition_service
// This is a common API projects can make use of, similar to healthcheck service
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use serde::{Deserialize, Serialize};

use golem_common::model::TemplateId;

use crate::definition::api_definition::{ApiDefinitionId, Version};
use crate::definition::api_definition::{ApiDefinitionId, ApiVersion};
use crate::expression::expr::Expr;
use crate::http::http_api_definition::MethodPattern;

Expand All @@ -18,7 +18,7 @@ use crate::http::http_api_definition::MethodPattern;
#[oai(rename_all = "camelCase")]
pub struct HttpApiDefinition {
pub id: ApiDefinitionId,
pub version: Version,
pub version: ApiVersion,
pub routes: Vec<Route>,
}

Expand Down
6 changes: 3 additions & 3 deletions golem-worker-service-base/src/definition/api_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ impl Display for ApiDefinitionId {
}

#[derive(Debug, Clone, Eq, PartialEq, Hash, Serialize, Deserialize, Encode, Decode, NewType)]
pub struct Version(pub String);
pub struct ApiVersion(pub String);

impl Display for Version {
impl Display for ApiVersion {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
Expand All @@ -34,7 +34,7 @@ pub(crate) trait HasApiDefinitionId {
}

pub(crate) trait HasVersion {
fn get_version(&self) -> Version;
fn get_version(&self) -> ApiVersion;
}

pub(crate) trait HasGolemWorkerBindings {
Expand Down
6 changes: 3 additions & 3 deletions golem-worker-service-base/src/http/http_api_definition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use poem_openapi::Enum;
use serde::{Deserialize, Serialize, Serializer};
use serde_json::Value;

use crate::definition::api_definition::{ApiDefinitionId, HasApiDefinitionId, HasGolemWorkerBindings, HasVersion, Version};
use crate::definition::api_definition::{ApiDefinitionId, HasApiDefinitionId, HasGolemWorkerBindings, HasVersion, ApiVersion};
use crate::parser::{GolemParser, ParseError};
use crate::parser::path_pattern_parser::PathPatternParser;
use crate::worker_binding::golem_worker_binding::GolemWorkerBinding;
Expand All @@ -18,7 +18,7 @@ use crate::worker_binding::golem_worker_binding::GolemWorkerBinding;
#[serde(rename_all = "camelCase")]
pub struct HttpApiDefinition {
pub id: ApiDefinitionId,
pub version: Version,
pub version: ApiVersion,
pub routes: Vec<Route>,
}

Expand All @@ -38,7 +38,7 @@ impl HasApiDefinitionId for HttpApiDefinition {
}

impl HasVersion for HttpApiDefinition {
fn get_version(&self) -> Version {
fn get_version(&self) -> ApiVersion {
self.version.clone()
}
}
Expand Down
Loading

0 comments on commit 062ab5f

Please sign in to comment.