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

Q: Missing type and simplify generated code

Open
#855 1 comment 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
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
cpp, rust

Research direction

Start by reading my_struct.schema.json and my_struct.schema.rs.txt, then compare the generated output with the quicktype example in the issue. Determine how the generator currently represents the schema and what changes would be needed for a my_struct type and direct primitive types; done means the generated Rust matches those requested shapes.

Written by the indexing model from the issue text.

Description

I'm experimenting with code generation based on schemas generated by the glaze C++ library.
The following C++ struct

struct my_struct {
  int i{};
  double d{};
  std::string hello{};
  std::array<uint64_t, 3> arr{};
  std::map<std::string, int> map{};
};

yields this schema:

my_struct.schema.json

And this is the generated rust code.

my_struct.schema.rs.txt

I was wondering the following:

  1. Apparently, there is no rust equivalent of my_struct being generated. Instead just for every type inside my_struct. Is there maybe an issue with the schema?
  2. Is it somehow possible to prevent generating wrapper types for types like Double etc and just use equivalent types directly?

To demonstrate the latter: I pasted the schema to quicktype and the result seems quite idiomatic:

use serde::{Serialize, Deserialize};
use std::collections::HashMap;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct MyStruct {
    arr: Option<Vec<i64>>,
    d: Option<f64>,
    hello: Option<String>,
    i: Option<i64>,
    map: Option<HashMap<String, i64>>,
}

(note: one can get rid of generating all the values as Option by adding "required": ["arr", "d", "hello", "i", "map"], )

Dominant language
Rust
Stars
898
Forks
114
Avg merge
4h 18m
Merged PRs (30d)
14

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 oxidecomputer/typify

All issues in oxidecomputer/typify

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.