Skip to content

Conversation

@svix-mman
Copy link
Contributor

@svix-mman svix-mman commented Nov 27, 2025

Add new frontmatter parser to be used in the new v2 CLI.

Add dependency on

  • toml (for frontmatter parsing)
  • thiserror For nice error enums (I prefer to be forced to think about all possible error statuses, instead of just magically converting the error to anyhow::Error and forgetting about it)

Add dev dependency on rstest, allows me to easily test permutations of comment syntax.

@svix-mman svix-mman marked this pull request as ready for review November 27, 2025 18:54
@svix-mman svix-mman requested a review from a team as a code owner November 27, 2025 18:54
@svix-mman svix-mman changed the title Add new frontmatter for v2 cli Add new frontmatter parser for v2 cli Nov 27, 2025
Comment on lines +5 to +16
struct TemplateFrontmatter {
template_scope: TemplateScope,
}

#[derive(Debug, serde::Deserialize, PartialEq, Eq)]
#[serde(rename_all = "kebab-case")]
enum TemplateScope {
/// The template will have access to the whole openapi spec, and will evaluated once.
Spec,
/// The template will have access to a single resource, and will evaluated once per resources.
Resource,
}
Copy link
Contributor Author

@svix-mman svix-mman Nov 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This struct and enum are subject to change, I included them so I can test the toml parsing.

@svix-mman svix-mman force-pushed the mendy/add-new-frontmatter-parser branch from 616300f to b9a764d Compare December 9, 2025 01:42
@svix-mman svix-mman force-pushed the mendy/add-new-frontmatter-parser branch from b9a764d to 2fa5c19 Compare December 9, 2025 01:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants