| 1 | /****************************************************************************** |
| 2 | * Copyright (c) 2000-2014 Ericsson Telecom AB |
| 3 | * All rights reserved. This program and the accompanying materials |
| 4 | * are made available under the terms of the Eclipse Public License v1.0 |
| 5 | * which accompanies this distribution, and is available at |
| 6 | * http://www.eclipse.org/legal/epl-v10.html |
| 7 | ******************************************************************************/ |
| 8 | |
| 9 | module one { |
| 10 | type record Rec { |
| 11 | integer num, |
| 12 | universal charstring str |
| 13 | } with { |
| 14 | variant(num) "JSON : default(0)"; |
| 15 | variant(str) "JSON : default(empty)"; |
| 16 | } |
| 17 | |
| 18 | type set Set { |
| 19 | octetstring os, |
| 20 | boolean buul optional, |
| 21 | verdicttype verd optional, |
| 22 | float numbr |
| 23 | } with { |
| 24 | variant(numbr) "JSON : default(-infinity)"; |
| 25 | variant(buul) "JSON:omit as null"; |
| 26 | } |
| 27 | |
| 28 | type union Uni { |
| 29 | float numbr, |
| 30 | octetstring bytes |
| 31 | } |
| 32 | |
| 33 | type record HasAny { |
| 34 | integer num, |
| 35 | anytype at |
| 36 | } |
| 37 | |
| 38 | type enumerated Height { Short, Medium, Tall }; |
| 39 | |
| 40 | type enumerated Width { Thin, Medium, Wide }; |
| 41 | |
| 42 | external function f_enc_rec(in Rec x) return octetstring |
| 43 | with { extension "prototype(convert) encode(JSON)" } |
| 44 | |
| 45 | external function f_dec_rec(in octetstring octie) return Rec |
| 46 | with { extension "prototype(convert) decode(JSON) errorbehavior(ALL:WARNING,INVAL_MSG:ERROR)" } |
| 47 | |
| 48 | } with { |
| 49 | encode "JSON"; |
| 50 | extension "anytype integer,boolean,bitstring"; |
| 51 | } |