Skip to content

Commit

Permalink
update: openapi style
Browse files Browse the repository at this point in the history
  • Loading branch information
fankaiLiu committed May 10, 2024
1 parent 348f0a0 commit 18eb4ec
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "salvo-cli"
version = "0.1.49"
version = "0.1.50"
edition = "2021"
authors = ["Fankai Liu [email protected]","mrxiaozhuox [email protected]"]
keywords = ["salvo", "cli","template"]
Expand Down
18 changes: 18 additions & 0 deletions locales/readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,24 @@ build_yml_description:
th: ไฟล์ YAML นี้กำหนดค่าไปป์ไลน์การรวมต่อเนื่อง (CI) สำหรับโปรเจกต์ มันกำหนดขั้นตอนที่จะดำเนินการโดยอัตโนมัติเมื่อมีการผลักดันโค้ดเข้าสู่ที่เก็บข้อมูล ซึ่งรวมถึงงานเช่นการสร้างซอฟต์แวร์ การทดสอบการทำงาน และการปรับใช้แอปพลิเคชันหากเงื่อนไขเป็นไปตามที่กำหนด
el: Αυτό το αρχείο YAML διαμορφώνει τη διαδικασία συνεχούς ένταξης (CI) για το έργο. Καθορίζει τα βήματα που εκτελούνται αυτόματα όταν κώδικας αναρτάται στο αποθετήριο. Αυτό περιλαμβάνει εργασίες όπως η δημιουργία του λογισμικού, η εκτέλεση δοκιμών και η ανάπτυξη της εφαρμογής εάν τα κριτήρια έχουν επιτευχθεί.
da: Denne YAML-fil konfigurerer det kontinuerlige integrationspipeline (CI) for projektet. Det definerer de trin, der udføres automatisk, når kode skubbes til repositoriet. Dette inkluderer opgaver som at bygge softwaren, køre tests, og udrulle applikationen, hvis betingelserne er opfyldt.
git_cliff:
zh_CN: 请替换 cliff.toml 文件第 49 行的 url 为该仓库的 url,用来触发自动生成变更日志。
en: Please replace the url in line 49 of the cliff.toml file with the repository url to trigger the automatic generation of changelogs.
zh_TW: 請替換 cliff.toml 文件第 49 行的 url 為該倉庫的 url,用來觸發自動生成變更日誌。
fr: Veuillez remplacer l'url à la ligne 49 du fichier cliff.toml par l'url du dépôt pour déclencher la génération automatique des journaux de modifications.
ja: cliff.toml ファイルの 49 行目の url をリポジトリの url に置き換えて、変更ログの自動生成をトリガーしてください。
es: Por favor, reemplace la url en la línea 49 del archivo cliff.toml con la url del repositorio para activar la generación automática de registros de cambios.
de: Bitte ersetzen Sie die URL in Zeile 49 der Datei cliff.toml durch die URL des Repositories, um das automatische Erstellen von Änderungsprotokollen auszulösen.
ru: Пожалуйста, замените url в строке 49 файла cliff.toml на url репозитория, чтобы инициировать автоматическое создание журналов изменений.
it: Si prega di sostituire l'url nella linea 49 del file cliff.toml con l'url del repository per attivare la generazione automatica del changelog.
pt: Por favor, substitua o url na linha 49 do arquivo cliff.toml pelo url do repositório para acionar a geração automática de changelogs.
ko: cliff.toml 파일의 49번째 줄 url을 저장소 url로 바꿔서 변경 로그의 자동 생성을 트리거하세요.
no: Vennligst erstatt url-en i linje 49 i cliff.toml-filen med repositoriets url for å utløse automatisk generering av endringslogger.
is: Vinsamlegast skiptu út url í línu 49 í cliff.toml skránni með url geymslunnar til að virkja sjálfvirka myndun breytingaskráa.
uk: Будь ласка, замініть url у рядку 49 файла cliff.toml на url репозиторію, щоб ініціювати автоматичне створення журналів змін.
th: โปรดแทนที่ url ในบรรทัดที่ 49 ของไฟล์ cliff.toml ด้วย url ของที่เก็บข้อมูลเพื่อเรียกใช้การสร้างบันทึกการเปลี่ยนแปลงโดยอัตโนมัติ
el: Παρακαλώ αντικαταστήστε το url στη γραμμή 49 του αρχείου cliff.toml με το url του αποθετηρίου για να ενεργοποιήσετε την αυτόματη δημιουργία καταγραφών αλλαγών.
da: Erstat venligst url'en på linje 49 i cliff.toml-filen med url'et til repositoriet for at udløse automatisk generering af ændringslogfiler.
cliff_toml:
zh_CN: 用于 git-cliff 生成变更日志
en: For generating changelogs with git-cliff
Expand Down
2 changes: 2 additions & 0 deletions src/template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,7 @@ cargo test
``` shell
cargo install --locked cargo-deny && cargo deny check
```
# git cliff
{{git_cliff}}
# {{about_salvo}}
{{about_salvo_text}}
2 changes: 1 addition & 1 deletion src/template/cliff.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ footer = """
trim = true
# postprocessors
postprocessors = [
{ pattern = '\$REPO', replace = "https://github.com/tyrchen/geektime-rust-live-coding" }, # replace repository URL
{ pattern = '\$REPO', replace = "https://github.com/user/repo" }, # replace repository URL
]

[git]
Expand Down
4 changes: 2 additions & 2 deletions src/template/src/main_template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async fn main() {
match CFG.server.ssl {
true => {
println!(
"📖 {{open_api_page}}: https://{}/swagger-ui",
"📖 {{open_api_page}}: https://{}/scalar",
&CFG.server.address.replace("0.0.0.0", "127.0.0.1")
);
{{#if is_web_site}}
Expand All @@ -100,7 +100,7 @@ async fn main() {
}
false => {
println!(
"📖 {{open_api_page}}: http://{}/swagger-ui",
"📖 {{open_api_page}}: http://{}/scalar",
&CFG.server.address.replace("0.0.0.0", "127.0.0.1")
);
{{#if is_web_site}}
Expand Down
16 changes: 8 additions & 8 deletions src/template/src/routers/mod.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{#if is_web_site}}
use crate::middleware::jwt::jwt_middleware;
use salvo::{
prelude::{CatchPanic, Logger, OpenApi, SwaggerUi},
prelude::{CatchPanic, Logger, OpenApi, Scalar},
Router,
};

Expand Down Expand Up @@ -49,12 +49,12 @@ pub fn router() -> Router {
let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router);
router
.push(doc.into_router("/api-doc/openapi.json"))
.push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui"))
.push(Scalar::new("/api-doc/openapi.json").into_router("scalar"))
}
{{else}}
use crate::middleware::{cors::cors_middleware, jwt::jwt_middleware};
use salvo::{
prelude::{CatchPanic, Logger, OpenApi, SwaggerUi},
prelude::{CatchPanic, Logger, OpenApi, Scalar},
Router,
};

Expand Down Expand Up @@ -99,13 +99,13 @@ pub fn router() -> Router {
let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router);
router
.push(doc.into_router("/api-doc/openapi.json"))
.push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui"))
.push(Scalar::new("/api-doc/openapi.json").into_router("scalar"))
}
{{/if}}
{{else}}
{{#if is_web_site}}
use salvo::{
prelude::{CatchPanic, Logger, OpenApi, SwaggerUi},
prelude::{CatchPanic, Logger, OpenApi, Scalar},
Router,
};
use crate::middleware::cors::cors_middleware;
Expand All @@ -125,11 +125,11 @@ pub fn router() -> Router {
let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router);
router
.push(doc.into_router("/api-doc/openapi.json"))
.push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui"))
.push(Scalar::new("/api-doc/openapi.json").into_router("scalar"))
}
{{else}}
use salvo::{
prelude::{CatchPanic, Logger, OpenApi, SwaggerUi},
prelude::{CatchPanic, Logger, OpenApi, Scalar},
Router,
};
use crate::middleware::cors::cors_middleware;
Expand All @@ -149,7 +149,7 @@ pub fn router() -> Router {
let doc = OpenApi::new("salvo web api", "0.0.1").merge_router(&router);
router
.push(doc.into_router("/api-doc/openapi.json"))
.push(SwaggerUi::new("/api-doc/openapi.json").into_router("swagger-ui"))
.push(Scalar::new("/api-doc/openapi.json").into_router("scalar"))
}
{{/if}}
{{/if}}
1 change: 1 addition & 0 deletions src/utils/create_project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ pub fn write_project_file(
handlebars::JsonValue::String(t!("database_connection_failed"));
data["user_does_not_exist"] = handlebars::JsonValue::String(t!("user_does_not_exist"));
data["rust_version_tip"] = handlebars::JsonValue::String(t!("rust_version_tip"));
data["git_cliff"] = handlebars::JsonValue::String(t!("git_cliff"));
let mut dependencies = data["dependencies"].clone();
handle_dependencies(
&mut dependencies,
Expand Down

0 comments on commit 18eb4ec

Please sign in to comment.