glideapps / glideapps/quicktype

Naming of ListElement types in JSON-Schema

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

Description

Is ist possible to customize the type names for ListElements?

Id like to get three types out of this:
- Order
- Product
- ProductList

Input Schema:
```
{
"$schema": "http://json-schema.org/draft-07/schema#",
"anyOf": [
{"$ref": "#/types/ProductList"},
{"$ref": "#/types/Product"},
{"$ref": "#/types/Order"}
],
"types": {
"ProductList": {
"type": "array",
"title": "ProductList",
"items": {
"$ref": "#/types/Product"
}
},
"Product": {
"type": "object",
"title": "Product",
"properties": {
"id": {"type": "string"},
"name": {"type": "string"},
"price": {"type": "number"}

},
"required": ["id", "name", "price"]
},
"Order": {
"type": "object",
"title": "Order",
"properties": {
"id": {"type": "string"},
"timestamp": {"type": "string", "format": "date-time"} ,
"customerId": {"type": "string"},
"products": { "type": "array", "items": {"$ref": "#/types/Product"}}
},
"required": ["id", "timestamp", "customerId", "products"]
}
}
}
```

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.