Skip to content

Naming of ListElement types in JSON-Schema #1285

@cinemast

Description

@cinemast

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"]
		}
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions