Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix generation for maps of integers #47

Merged
merged 4 commits into from
Apr 17, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
extract integer properties for maps - fixes #45
Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux committed Apr 17, 2022
commit 0c46be6ad06b37f75b498dc218c4fbaa0af0fbd0
4 changes: 3 additions & 1 deletion src/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ fn analyze_object_properties(
bail!("unknown empty dict type for {}", key)
}
}
"integer" => Some(extract_integer_type(s)?),
// think the type we get is the value type
x => Some(uppercase_first_letter(x)), // best guess
};
Expand Down Expand Up @@ -494,6 +495,7 @@ type: object
to:
additionalProperties:
type: integer
format: int32
description: Map of upstream localities to traffic
distribution weights.
type: object
Expand Down Expand Up @@ -525,6 +527,6 @@ type: object
assert_eq!(from.name, "from");
assert_eq!(to.name, "to");
assert_eq!(from.type_, "Option<String>");
assert_eq!(to.type_, "Option<BTreeMap<String, i64>>");
assert_eq!(to.type_, "Option<BTreeMap<String, i32>>");
}
}