Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Custom attributes #11

Open
sergeysova opened this issue May 12, 2020 · 0 comments
Open

Custom attributes #11

sergeysova opened this issue May 12, 2020 · 0 comments
Labels
enhancement New feature or request

Comments

@sergeysova
Copy link
Member

sergeysova commented May 12, 2020

Single attribute:

schema:
  properties:
    demo:
      type: string
        x-rust-attribute: serde(skip_serializing_if = "Option::is_none")

Should generate something like:

struct Example {
  #[serde(skip_serializing_if = "Option::is_none")]
  demo: String,
}

Multiple attributes:

schema:
  properties:
    demo:
      type: string
        x-rust-attribute:
          - serde(skip_serializing_if = “Option::is_none”)
          - validate(url)

Output:

struct Example {
  #[serde(skip_serializing_if = "Option::is_none")]
  #[validate(url)]
  demo: String,
}
@sergeysova sergeysova added the enhancement New feature or request label May 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant