-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade OpenAPI Implementation (#101)
- Loading branch information
Showing
11 changed files
with
636 additions
and
279 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,53 +8,64 @@ description = "enstate" | |
repository = "https://github.com/v3xlabs/enstate" | ||
authors = [ | ||
"Luc van Kampen <[email protected]>", | ||
"Jakob Helgesson <[email protected]>", | ||
"Antonio Fran Trstenjak <[email protected]>", | ||
"Miguel Piedrafita <[email protected]>", | ||
] | ||
|
||
[dependencies] | ||
enstate_shared = { path = "../shared" } | ||
|
||
ethers = "2" | ||
axum = "0.6.18" | ||
anyhow = "1.0.71" | ||
tracing = "0.1.27" | ||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } | ||
# Server | ||
dotenvy = "0.15.7" | ||
serde_json = "1.0.96" | ||
serde = { version = "1.0", features = ["derive"] } | ||
axum = "0.7.5" | ||
anyhow = "1.0.71" | ||
thiserror = "1.0.48" | ||
futures = "0.3.29" | ||
tokio = { version = "1.28.0", features = ["full", "tracing"] } | ||
tokio-util = "0.7.10" | ||
futures = "0.3.29" | ||
utoipa = { version = "4.1.0", features = ["axum_extras"] } | ||
utoipa-swagger-ui = { version = "4.0.0", features = ["axum"] } | ||
redis = { version = "0.23.0", features = ["connection-manager", "tokio-comp"] } | ||
tower-http = { version = "0.4.4", features = ["cors", "tracing", "trace"] } | ||
tokio-stream = "0.1.14" | ||
tower-http = { version = "0.5.2", features = ["cors", "tracing", "trace"] } | ||
rand = "0.8.5" | ||
chrono = "0.4.31" | ||
regex = "1.9.5" | ||
hex-literal = "0.4.1" | ||
axum-macros = "0.4.1" | ||
lazy_static = "1.4.0" | ||
rustc-hex = "2.0.1" | ||
|
||
# Serde | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0.96" | ||
serde_with = "3.3.0" | ||
serde_qs = "0.13.0" | ||
|
||
# Logging & Tracing | ||
tracing = "0.1.27" | ||
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] } | ||
opentelemetry = "0.22.0" | ||
opentelemetry_sdk = { version = "0.22.1", features = ["rt-tokio"] } | ||
opentelemetry-otlp = "0.15.0" | ||
tracing-opentelemetry = "0.23.0" | ||
|
||
# Ethereum | ||
ethers = "2" | ||
ethers-contract = "2.0.9" | ||
ethers-core = "2.0.9" | ||
hex = "0.4.3" | ||
thiserror = "1.0.48" | ||
regex = "1.9.5" | ||
rustls = "0.21.7" | ||
|
||
# Hashing | ||
bs58 = "0.5.0" | ||
sha2 = "0.10.7" | ||
digest = "0.10.7" | ||
hex-literal = "0.4.1" | ||
axum-macros = "0.3.8" | ||
lazy_static = "1.4.0" | ||
base32 = "0.4.0" | ||
crc16 = "0.4.0" | ||
blake2 = "0.10.6" | ||
rustc-hex = "2.0.1" | ||
serde_with = "3.3.0" | ||
bech32 = "0.10.0-alpha" | ||
crc32fast = "1.3.2" | ||
|
||
# Other | ||
hex = "0.4.3" | ||
redis = { version = "0.25.3", features = ["connection-manager", "tokio-comp"] } | ||
rustls = "0.23" | ||
digest = "0.10.7" | ||
ciborium = "0.2.1" | ||
serde_qs = "0.12.0" | ||
tokio-stream = "0.1.14" | ||
opentelemetry = "0.22.0" | ||
opentelemetry_sdk = { version = "0.22.1", features = ["rt-tokio"] } | ||
opentelemetry-otlp = "0.15.0" | ||
tracing-opentelemetry = "0.23.0" | ||
utoipa = "4.2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<title>API Reference</title> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
</head> | ||
<body> | ||
<script | ||
id="api-reference" | ||
data-url="/docs/openapi.json" | ||
></script> | ||
<script> | ||
var configuration = { | ||
theme: "blue", | ||
}; | ||
|
||
var apiReference = document.getElementById("api-reference"); | ||
apiReference.dataset.configuration = JSON.stringify(configuration); | ||
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
use crate::models::bulk::{BulkResponse, ListResponse}; | ||
use crate::models::error::ErrorResponse; | ||
use crate::models::profile::ENSProfile; | ||
use utoipa::openapi::{ExternalDocs, License}; | ||
use utoipa::OpenApi; | ||
|
||
#[derive(OpenApi)] | ||
#[openapi( | ||
info( | ||
title = "enstate.rs", | ||
description = "A hosted ENS API allowing for easy access to ENS data.", | ||
), | ||
paths( | ||
crate::routes::address::get, crate::routes::name::get, crate::routes::universal::get, | ||
crate::routes::address::get_bulk, crate::routes::name::get_bulk, crate::routes::universal::get_bulk | ||
), | ||
components(schemas(ENSProfile, ListResponse<BulkResponse<ENSProfile>>, ErrorResponse)) | ||
)] | ||
pub struct ApiDoc; | ||
|
||
pub async fn openapi() -> String { | ||
let mut doc = ApiDoc::openapi(); | ||
|
||
let license = License::new("GPLv3"); | ||
|
||
doc.info.license = Some(license); | ||
doc.external_docs = Some(ExternalDocs::new("https://github.com/v3xlabs/enstate")); | ||
|
||
doc.to_json().unwrap() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters