-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
feat(common): add template definition schema (#1655)
Showing
2 changed files
with
43 additions
and
2 deletions.
There are no files selected for viewing
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,40 @@ | ||
use serde::{Deserialize, Serialize}; | ||
|
||
/// Schema used in `examples/templates.toml` and services that parses it | ||
#[derive(Debug, Default, Serialize, Deserialize)] | ||
pub struct TemplateDefinition { | ||
/// Title of the template | ||
title: String, | ||
/// A short description of the template | ||
description: Option<String>, | ||
/// Path relative to the repo root | ||
path: Option<String>, | ||
/// "starter" OR "template" (default) OR "tutorial" | ||
#[serde(default)] | ||
r#type: TemplateType, | ||
/// List of areas where this template is useful. Examples: "Web app", "Discord bot", "Monitoring", "Automation", "Utility" | ||
use_cases: Vec<String>, | ||
/// List of keywords that describe the template. Examples: "axum", "serenity", "typescript", "saas", "fullstack", "database" | ||
tags: Vec<String>, | ||
/// URL to a live instance of the template (if relevant) | ||
live_demo: Option<String>, | ||
|
||
/// If this template is available in the `cargo shuttle init --template` short-hand options, add that name here | ||
template: Option<String>, | ||
|
||
/// Set this to true if this is a community template outside of the shuttle-examples repo | ||
community: Option<bool>, | ||
/// GitHub username of the author of the community template | ||
author: Option<String>, | ||
/// URL to the repo of the community template | ||
repo: Option<String>, | ||
} | ||
|
||
#[derive(Debug, Default, Serialize, Deserialize)] | ||
#[serde(rename_all = "lowercase")] | ||
pub enum TemplateType { | ||
Starter, | ||
#[default] | ||
Template, | ||
Tutorial, | ||
} |