Skip to content

Conversation

@connorshea
Copy link
Collaborator

This has compile errors, unfortunately.

Screenshot 2025-10-30 at 1 31 35 PM

I can get around this problem somewhat by using #[schemars(with = "Option<String>")], but it requires that I remove the Serialize/Deserialize derivations, which results in losing the ability to get the default value automatically:

#[derive(Debug, Clone, JsonSchema, Default)]
#[serde(rename_all = "camelCase", default)]
pub struct ParamNamesConfig {
    /// Regex pattern used to validate the `resolve` parameter name. If provided, this pattern
    /// is used instead of the default `^_?resolve$` check.
    #[schemars(with = "Option<String>")]
    resolve_pattern: Option<Regex>,
    /// Regex pattern used to validate the `reject` parameter name. If provided, this pattern
    /// is used instead of the default `^_?reject$` check.
    #[schemars(with = "Option<String>")]
    reject_pattern: Option<Regex>,
}

Generated docs for the above:

## Configuration

This rule accepts a configuration object with the following properties:

### rejectPattern

type: `[
  string,
  null
]`


Regex pattern used to validate the `reject` parameter name. If provided, this pattern
is used instead of the default `^_?reject$` check.


### resolvePattern

type: `[
  string,
  null
]`


Regex pattern used to validate the `resolve` parameter name. If provided, this pattern
is used instead of the default `^_?resolve$` check.

Is there a good way to resolve this? Should I create a separate config struct for representing the json schema that explicitly uses Option<String>, or is there a way to fix the lazy regex class to serialize properly?

@graphite-app
Copy link
Contributor

graphite-app bot commented Oct 30, 2025

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-linter Area - Linter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant