[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: [OASIS Issue Tracker] (ODATA-879) Support Arrays of Arrays
[ https://issues.oasis-open.org/browse/ODATA-879?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=63730#comment-63730 ] Michael Pizzo edited comment on ODATA-879 at 10/17/16 11:15 PM: ---------------------------------------------------------------- Hubert's idea; in the serialization, if a member has to be annotated then represent it as an object, otherwise as a primitive: For example: "numbers" : [ 1, 2, { "value":3, "@my.comment": "this is just a guess"}, }, 4 ] Note that, in JSON Schema, we would have to describe this as an array of numeric values or objects, using either a generic object, an "annotatedPrimitive" object that allowed an optional primitive value and zero or more annotations, or a specific "annotatedDecimal" object that allowed an (optional) numeric value and zero or more annotations. i.e.; "type": "array", "items": [ { "type": "numeric", "format": "decimal" }, "annotatableDecimal" ], where "annotatableDecimal is defined something like: "annotatableDecimal" : { "type": "object", "properties": { "value": { "type": "number", "format": "decimal" } }, "patternProperties": { "^([a-zA-Z_][a-zA-Z0-9_]*)?@([a-zA-Z_][a-zA-Z0-9_.]*\\.)?[a-zA-Z_][a-zA-Z0-9_.]+$" : { "type": ["array", "boolean", "number", "null", "object", "string"], "description": "An annotation on the primitive value" } } For annotating a collection within a collection of collections, this would presumably look something like: "cells": [ [ {"foo":1,"bar":1}, {"foo":2,"bar":2} ], { "value": [ {"foo":3,"bar":3}, {"foo":4,"bar":4} ], "@my.annotation":"myannotationvalue" } ] was (Author: mikep): Hubert's idea; in the serialization, if a member has to be annotated then represent it as an object, otherwise as a primitive: > Support Arrays of Arrays > ------------------------ > > Key: ODATA-879 > URL: https://issues.oasis-open.org/browse/ODATA-879 > Project: OASIS Open Data Protocol (OData) TC > Issue Type: Bug > Components: OData CSDL, OData JSON Format > Affects Versions: V4.0_ERRATA02 > Reporter: Michael Pizzo > Assignee: Michael Pizzo > Fix For: V4.01_WD01 > > > There are scenarios where it's convenient to represent something as an array of arrays. In JSON this would look as: > [["foo1","bar1"],["foo2","bar2"]] > or > [[{"foo":"foo1"},{"bar":"bar1"}],[{"foo":"foo2"},{"bar":"bar2"}]] > Currently services must represent these as arrays of complex types that have array properties. In JSON, the result looks like: > [{"value":["foo1","bar1"]},{"value":["foo2","bar2"]}] > or > [{"value":[{"foo":"foo1"},{"bar":"bar1"}]},{"value":[{"foo":"foo2"},{"bar":"bar2"}]}] > If we are trying to make JSON representation as close as possible to a custom representation we would need to support the former syntax (without the "value" objects). > One problem with arrays of arrays in JSON is that we don't have a way to annotate the (array) items within the array. For example, we couldn't add count, nextLink, etc. for the inner arrays.. -- This message was sent by Atlassian JIRA (v6.2.2#6258)
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]