From 19fcec84d8d7d21e796c7624e521b60d28ee21ed Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 20:45:59 +0200 Subject: Adding upstream version 16.2.11+ds. Signed-off-by: Daniel Baumann --- src/jaegertracing/thrift/lib/json/Makefile.am | 33 ++ src/jaegertracing/thrift/lib/json/schema.json | 344 +++++++++++++++++++++ src/jaegertracing/thrift/lib/json/test/Makefile.am | 26 ++ .../thrift/lib/json/test/build.properties | 10 + src/jaegertracing/thrift/lib/json/test/build.xml | 144 +++++++++ 5 files changed, 557 insertions(+) create mode 100644 src/jaegertracing/thrift/lib/json/Makefile.am create mode 100644 src/jaegertracing/thrift/lib/json/schema.json create mode 100644 src/jaegertracing/thrift/lib/json/test/Makefile.am create mode 100644 src/jaegertracing/thrift/lib/json/test/build.properties create mode 100644 src/jaegertracing/thrift/lib/json/test/build.xml (limited to 'src/jaegertracing/thrift/lib/json') diff --git a/src/jaegertracing/thrift/lib/json/Makefile.am b/src/jaegertracing/thrift/lib/json/Makefile.am new file mode 100644 index 000000000..6c8c0ce81 --- /dev/null +++ b/src/jaegertracing/thrift/lib/json/Makefile.am @@ -0,0 +1,33 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +if WITH_JAVA +# Schema validation test depends on java +SUBDIRS = test +endif + +clean-local: + $(RM) -r test/build/ + +dist-hook: + $(RM) -r $(distdir)/test/build/ + +EXTRA_DIST = \ + schema.json \ + test diff --git a/src/jaegertracing/thrift/lib/json/schema.json b/src/jaegertracing/thrift/lib/json/schema.json new file mode 100644 index 000000000..d058a7c1a --- /dev/null +++ b/src/jaegertracing/thrift/lib/json/schema.json @@ -0,0 +1,344 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + + "id": "http://thrift.apache.org/schema.json#", + "description": "Schema for Apache Thrift protocol descriptors", + + "definitions": { + "type-id": { + "title": "Any type id (name)", + "enum": [ + "void", + "string", + "bool", + "byte", + "i8", + "i16", + "i32", + "i64", + "double", + "list", + "set", + "map", + "union", + "struct", + "binary" + ] + }, + "base-type": { + "title": "Base type schema", + "type": "object", + "properties": { + "typeId": { + "enum": ["void", "string", "bool", "byte", "i8", "i16", "i32", "i64", "double", "binary" ] + } + }, + "required": [ "typeId" ] + }, + "list-type": { + "title": "List and set schema", + "type": "object", + "properties": { + "typeId": { + "enum": [ "list", "set" ] + }, + "elemTypeId": { "$ref": "#/definitions/type-id" }, + "elemType": { "$ref": "#/definitions/type-desc" } + }, + "required": [ "typeId", "elemTypeId" ] + }, + "map-type": { + "title": "Map schema", + "type": "object", + "properties": { + "typeId": { + "enum": [ "map" ] + }, + "keyTypeId": { "$ref": "#/definitions/type-id" }, + "keyType": { "$ref": "#/definitions/type-desc" }, + "valueTypeId": { "$ref": "#/definitions/type-id" }, + "valueType": { "$ref": "#/definitions/type-desc" } + }, + "required": [ "typeId", "keyTypeId", "valueTypeId" ] + }, + "struct-type": { + "title": "Struct, union and exception schema", + "type": "object", + "properties": { + "typeId": { + "enum": [ "union", "struct", "exception" ] + } + }, + "required": [ "typeId", "class" ] + }, + "type-desc": { + "title": "Type descriptor schema", + "allOf": [ + { + "type": "object", + "properties": { + "typeId": { "type": "string" }, + "class": { "type": "string" } + } + }, + { + "oneOf": + [ + { "$ref": "#/definitions/base-type" }, + { "$ref": "#/definitions/list-type" }, + { "$ref": "#/definitions/map-type" }, + { "$ref": "#/definitions/struct-type" } + ] + } + ] + }, + "name-and-doc": { + "title": "Name and documentation sub-schema", + "type": "object", + "properties": { + "name": { "type": "string" }, + "doc": { "type": "string" } + }, + "required": [ "name" ] + }, + "enum": { + "title": "Thrift 'enum' definition schema", + "type": "object", + "allOf": [ + { "$ref": "#/definitions/name-and-doc" }, + { + "required": [ "members" ], + "properties": { + "members": { + "type": "array", + "items": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "value": { "type": "integer" } + }, + "required": [ "name", "value" ] + } + } + } + } + ] + }, + "typedef": { + "title": "Thrift typedef definition schema", + "type": "object", + "allOf": [ + { "$ref": "#/definitions/name-and-doc" }, + { + "properties": { + "typeId": { "$ref": "#/definitions/type-id" }, + "type": { "$ref": "#/definitions/type-desc" } + }, + "required": [ "typeId" ] + } + ] + }, + "constant": { + "title": "Thrift constant definition schema", + "type": "object", + "allOf": [ + { "$ref": "#/definitions/name-and-doc" }, + { "$ref": "#/definitions/type-desc" }, + { + "properties": { + "value": { + "oneOf": [ + { "type": "string" }, + { "type": "number" }, + { "type": "array" }, + { "type": "object" } + ] + } + }, + "required": [ "value" ] + } + ] + }, + "field": { + "title": "Thrift struct field definition schema", + "type": "object", + "allOf": [ + { "$ref": "#/definitions/name-and-doc" }, + { + "properties": { + "key": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "required": { + "enum": [ "required", "optional", "req_out" ] + }, + "typeId": { "$ref": "#/definitions/type-id" }, + "type": { "$ref": "#/definitions/type-desc" }, + "default": { + "oneOf": [ + { "type": "string" }, + { "type": "number" }, + { "type": "array" }, + { "type": "object" } + ] + } + }, + "required": [ "key", "required" ] + } + ] + }, + "struct": { + "title": "Thrift struct definition schema", + "type": "object", + "allOf": [ + { "$ref": "#/definitions/name-and-doc" }, + { + "properties": { + "isException": { "type": "boolean" }, + "isUnion": { "type": "boolean" }, + "fields": { + "type": "array", + "items": { + "$ref": "#/definitions/field" + } + } + }, + "required": [ "isException", "isUnion", "fields" ] + } + ] + }, + "union": { + "title": "Thrift union definition schema", + "$ref": "#/definitions/struct" + }, + "exception": { + "title": "Thrift exception definition schema", + "type": "object", + "properties": { + "key": { + "type": "integer", + "minimum": 1, + "maximum": 65535 + }, + "name": { "type": "string" }, + "typeId": { "enum": [ "exception" ] }, + "type": { "$ref": "#/definitions/struct-type" } + }, + "required": [ "key", "name", "typeId" ] + }, + "function": { + "title": "Thrift service function definition schema", + "type": "object", + "allOf": [ + { "$ref": "#/definitions/name-and-doc" }, + { + "properties": { + "oneway": { + "type": "boolean" + }, + "returnType": { + "$ref": "#/definitions/type-desc" + }, + "arguments": { + "type": "array", + "items": { + "$ref": "#/definitions/field" + } + }, + "exceptions": { + "type": "array", + "items": { "$ref": "#/definitions/exception" } + } + }, + "required": [ "oneway", "arguments", "exceptions" ] + } + ] + }, + "service": { + "title": "Thrift service definition schema", + "type": "object", + "allOf": [ + { "$ref": "#/definitions/name-and-doc" }, + { + "properties": { + "functions": { + "type": "array", + "items": { + "$ref": "#/definitions/function" + } + } + }, + "required": [ "functions" ] + } + ] + }, + "annotations": { + "title": "Map of annotation names to values", + "type": "object", + "additionalProperties": { + "type": "string" + } + } + }, + + "type": "object", + "required": [ + "name", + "enums", + "typedefs", + "structs", + "constants", + "services" + ], + "properties": { + "name": { + "type": "string" + }, + "includes": { + "type": "array", + "items": { + "type": "string" + }, + "uniqueItems": true + }, + "namespaces": { + "type": "object", + "additionalProperties": { + "type": "string" + } + }, + "enums": { + "type": "array", + "items": { + "$ref": "#/definitions/enum" + } + }, + "typedefs": { + "type": "array", + "items": { + "$ref": "#/definitions/typedef" + } + }, + "structs": { + "type": "array", + "items": { + "$ref": "#/definitions/struct" + } + }, + "constants": { + "type": "array", + "items": { + "$ref": "#/definitions/constant" + } + }, + "services": { + "type": "array", + "items": { + "$ref": "#/definitions/service" + } + } + }, + "additionalProperties": false +} diff --git a/src/jaegertracing/thrift/lib/json/test/Makefile.am b/src/jaegertracing/thrift/lib/json/test/Makefile.am new file mode 100644 index 000000000..bb87a5203 --- /dev/null +++ b/src/jaegertracing/thrift/lib/json/test/Makefile.am @@ -0,0 +1,26 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +check: + $(ANT) $(ANT_FLAGS) test + +# Make sure this doesn't fail if ant is not configured. +clean-local: + ANT=$(ANT) ; if test -z "$$ANT" ; then ANT=: ; fi ; \ + $$ANT $(ANT_FLAGS) clean diff --git a/src/jaegertracing/thrift/lib/json/test/build.properties b/src/jaegertracing/thrift/lib/json/test/build.properties new file mode 100644 index 000000000..075f64001 --- /dev/null +++ b/src/jaegertracing/thrift/lib/json/test/build.properties @@ -0,0 +1,10 @@ +# Jar versions +mvn.ant.task.version=2.1.3 + +# Dependency versions +json-schema-validator.version=2.2.6 + +# Maven dependency download locations +mvn.repo=http://repo1.maven.org/maven2 +mvn.ant.task.url=${mvn.repo}/org/apache/maven/maven-ant-tasks/${mvn.ant.task.version} +mvn.ant.task.jar=maven-ant-tasks-${mvn.ant.task.version}.jar diff --git a/src/jaegertracing/thrift/lib/json/test/build.xml b/src/jaegertracing/thrift/lib/json/test/build.xml new file mode 100644 index 000000000..956a2382b --- /dev/null +++ b/src/jaegertracing/thrift/lib/json/test/build.xml @@ -0,0 +1,144 @@ + + + + JSON Schema Validation Test + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Thrift compiler is missing ! + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3