oxidecomputer / oxidecomputer/typify

The "minimum" property for "integer" value is generated as float

Open
#843 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Invalid type of "minimum" property for "integer" value.

The JSON schema defines an integer property with a minimum value "123".
The doc-comment for generated Rust structure says "minimum": 123.0" that is a number value.

Input:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "title": "example",
  "properties": {
    "integer": {
      "type": "integer",
      "minimum": 105
    },
    "number": {
      "type": "number",
      "minimum": 10.5
    }
  },
  "required": [
    "integer",
    "number"
  ]
}

Output doc-comment:

///`Example`
///
/// <details><summary>JSON schema</summary>
///
/// ```json
///{
///  "title": "example",
///  "type": "object",
///  "required": [
///    "integer",
///    "number"
///  ],
///  "properties": {
///    "integer": {
///      "type": "integer",
///      "minimum": 105.0
///    },
///    "number": {
///      "type": "number",
///      "minimum": 10.5
///    }
///  }
///}
/// ```
/// </details>

typify version 0.4.2
MCVE https://github.com/akhranovsky/typify-minimum-integer-wrong.git

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.

Research direction

Start by reproducing the issue with the linked MCVE and the provided JSON Schema using typify 0.4.2, then trace how the generated Rust doc-comment preserves schema numeric values. Done means an integer minimum is emitted as 105 while the number minimum remains 10.5.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.