Skip to content

Commit

Permalink
update for cargo-release
Browse files Browse the repository at this point in the history
  • Loading branch information
ahl committed May 3, 2023
1 parent 70a5b06 commit a25d39f
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 3 deletions.
3 changes: 0 additions & 3 deletions release.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ pre-release-replacements = [
]

pre-release-commit-message = "release typify {{version}}"
post-release-commit-message = "starting typify {{next_version}} after releasing {{version}}"
tag-message = "release {{crate_name}} {{version}}"
tag-prefix = ""
dev-version = true
dev-version-ext = "dev"
consolidate-commits = true
push = false
shared-version = true
Expand Down
22 changes: 22 additions & 0 deletions typify/tests/schemas/maps.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"$comment": "validate maps, in particular those with constrained string keys",
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"MapWithKeys": {
"type": "object",
"additionalProperties": {
"$ref": "#/definitions/Value"
},
"propertyNames": {
"$ref": "#/definitions/Eh"
}
},
"Value": {
"type": "string"
},
"Eh": {
"type": "string",
"format": "^a*$"
}
}
}
94 changes: 94 additions & 0 deletions typify/tests/schemas/maps.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#[allow(unused_imports)]
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Eh(pub String);
impl std::ops::Deref for Eh {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From<Eh> for String {
fn from(value: Eh) -> Self {
value.0
}
}
impl From<&Eh> for Eh {
fn from(value: &Eh) -> Self {
value.clone()
}
}
impl From<String> for Eh {
fn from(value: String) -> Self {
Self(value)
}
}
impl std::str::FromStr for Eh {
type Err = std::convert::Infallible;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Ok(Self(value.to_string()))
}
}
impl ToString for Eh {
fn to_string(&self) -> String {
self.0.to_string()
}
}
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct MapWithKeys(pub std::collections::HashMap<Eh, Value>);
impl std::ops::Deref for MapWithKeys {
type Target = std::collections::HashMap<Eh, Value>;
fn deref(&self) -> &std::collections::HashMap<Eh, Value> {
&self.0
}
}
impl From<MapWithKeys> for std::collections::HashMap<Eh, Value> {
fn from(value: MapWithKeys) -> Self {
value.0
}
}
impl From<&MapWithKeys> for MapWithKeys {
fn from(value: &MapWithKeys) -> Self {
value.clone()
}
}
impl From<std::collections::HashMap<Eh, Value>> for MapWithKeys {
fn from(value: std::collections::HashMap<Eh, Value>) -> Self {
Self(value)
}
}
#[derive(Clone, Debug, Deserialize, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
pub struct Value(pub String);
impl std::ops::Deref for Value {
type Target = String;
fn deref(&self) -> &String {
&self.0
}
}
impl From<Value> for String {
fn from(value: Value) -> Self {
value.0
}
}
impl From<&Value> for Value {
fn from(value: &Value) -> Self {
value.clone()
}
}
impl From<String> for Value {
fn from(value: String) -> Self {
Self(value)
}
}
impl std::str::FromStr for Value {
type Err = std::convert::Infallible;
fn from_str(value: &str) -> Result<Self, Self::Err> {
Ok(Self(value.to_string()))
}
}
impl ToString for Value {
fn to_string(&self) -> String {
self.0.to_string()
}
}
fn main() {}

0 comments on commit a25d39f

Please sign in to comment.