glideapps / glideapps/quicktype

patternProperties loses the type of the properties

Open
#1,464 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
13.9k
Forks
1.2k
Avg merge
8h 53m
Merged PRs (30d)
369

Description

When using the patternProperties feature (https://json-schema.org/understanding-json-schema/reference/object.html#pattern-properties), I have seen that the generated code correctly creates a map to things. Unfortunately these things are of a generic json type (even if I explicitly specify a type in my schema).

input schema:
```js
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"patternProperties": {
"^[a-zA-Z]\\w*$": {
"type": "boolean"
}
}
}
```

generated C++ Code:
```cpp
#pragma once

namespace quicktype {
using PatternProperties = std::map;
}
```

expected generated C++ Code:
```cpp
#pragma once

namespace quicktype {
using PatternProperties = std::map;
}
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.