Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Most returned struct fields are wrapped in Option

Open
#6 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Refactor
Clarity
Needs clarification
Activity status
Stale
Tech stack
rust
Domain
api

Research direction

Start with vsts-api-patcher/src/main.rs and read patch_definition_required_fields(). Identify specific returned structs and fields whose Option wrappers may be removed, then verify that the corresponding responses always contain them. Done means the selected fields are patched safely without causing deserialization failures.

Written by the indexing model from the issue text.

Description

enhancement

Most returned struct fields are wrapped in Option.

Example:

pub struct WikiPage {
    pub wiki_page_create_or_update_parameters: [WikiPageCreateOrUpdateParameters],
    pub git_item_path: Option<String>,
    pub id: Option<i32>,
    pub is_non_conformant: Option<bool>,
    pub is_parent_page: Option<bool>,
    pub order: Option<i32>,
    pub path: Option<String>,
    pub remote_url: Option<String>,
    pub sub_pages: Vec<WikiPage>,
    pub url: Option<String>,
}

This makes it tedious/verbose to access these field values, as you either need to check for Some(value) or make liberal use of unwrap().

The code generator does the Option wrapping because the OpenAPI spec does not mark these fields as "mandatory", even though many of them will always be present. For example, in the definition above it is safe to assume that every WikiPage will have an id field.

The current code generator does have the ability to remove the Option wrapper for specific struct fields that are known to always be present (see patch_definition_required_fields()). I have done this by trial and error for a small number of structs that I care about. This must be done with care because if a response does not contain a field that is always expected (not an Option), then the deserialization fails.

If you have specific structs that have Options that you think could be removed then add a comment to this issue and I'll look into fixing.

Dominant language
Rust
Stars
76
Forks
27
Avg merge
6d 8h
Merged PRs (30d)
2

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from microsoft/azure-devops-rust-api

All issues in microsoft/azure-devops-rust-api

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.