diff --git a/assets/json-schema/CamelCatalog.json b/assets/json-schema/CamelCatalog.json new file mode 100644 index 0000000000..1266aa1354 --- /dev/null +++ b/assets/json-schema/CamelCatalog.json @@ -0,0 +1,352 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/CamelCatalog", + "definitions": { + "CamelArtifact": { + "required": [ + "groupId", + "artifactId" + ], + "properties": { + "artifactId": { + "type": "string" + }, + "dataformats": { + "items": { + "type": "string" + }, + "type": "array" + }, + "dependencies": { + "items": { + "$ref": "#/definitions/CamelArtifact" + }, + "type": "array" + }, + "exclusions": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/CamelArtifactExclusion" + }, + "type": "array" + }, + "groupId": { + "type": "string" + }, + "languages": { + "items": { + "type": "string" + }, + "type": "array" + }, + "schemes": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/CamelScheme" + }, + "type": "array" + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "CamelArtifactExclusion": { + "required": [ + "groupId", + "artifactId" + ], + "properties": { + "artifactId": { + "type": "string" + }, + "groupId": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "CamelCatalog": { + "properties": { + "annotations": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "apiVersion": { + "type": "string" + }, + "clusterName": { + "type": "string" + }, + "creationTimestamp": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Time" + }, + "deletionGracePeriodSeconds": { + "type": "integer" + }, + "deletionTimestamp": { + "$ref": "#/definitions/Time" + }, + "finalizers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "generateName": { + "type": "string" + }, + "generation": { + "type": "integer" + }, + "initializers": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializers" + }, + "kind": { + "type": "string" + }, + "labels": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "ownerReferences": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/OwnerReference" + }, + "type": "array" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "spec": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/CamelCatalogSpec" + }, + "status": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/CamelCatalogStatus" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "CamelCatalogSpec": { + "required": [ + "version", + "artifacts" + ], + "properties": { + "artifacts": { + "patternProperties": { + ".*": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/CamelArtifact" + } + }, + "type": "object" + }, + "version": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "CamelCatalogStatus": { + "additionalProperties": false, + "type": "object" + }, + "CamelScheme": { + "required": [ + "id", + "passive", + "http" + ], + "properties": { + "http": { + "type": "boolean" + }, + "id": { + "type": "string" + }, + "passive": { + "type": "boolean" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Initializer": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Initializers": { + "required": [ + "pending" + ], + "properties": { + "pending": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializer" + }, + "type": "array" + }, + "result": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Status" + } + }, + "additionalProperties": false, + "type": "object" + }, + "OwnerReference": { + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], + "properties": { + "apiVersion": { + "type": "string" + }, + "blockOwnerDeletion": { + "type": "boolean" + }, + "controller": { + "type": "boolean" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Status": { + "properties": { + "apiVersion": { + "type": "string" + }, + "code": { + "type": "integer" + }, + "continue": { + "type": "string" + }, + "details": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusDetails" + }, + "kind": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "status": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusCause": { + "properties": { + "field": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusDetails": { + "properties": { + "causes": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusCause" + }, + "type": "array" + }, + "group": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "retryAfterSeconds": { + "type": "integer" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Time": { + "additionalProperties": false, + "type": "object" + } + } +} \ No newline at end of file diff --git a/assets/json-schema/Integration.json b/assets/json-schema/Integration.json new file mode 100644 index 0000000000..e60c5f4e87 --- /dev/null +++ b/assets/json-schema/Integration.json @@ -0,0 +1,449 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Integration", + "definitions": { + "ConfigurationSpec": { + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Failure": { + "required": [ + "reason", + "time", + "recovery" + ], + "properties": { + "reason": { + "type": "string" + }, + "recovery": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/FailureRecovery" + }, + "time": { + "$ref": "#/definitions/Time" + } + }, + "additionalProperties": false, + "type": "object" + }, + "FailureRecovery": { + "required": [ + "attempt", + "attemptMax", + "attemptTime" + ], + "properties": { + "attempt": { + "type": "integer" + }, + "attemptMax": { + "type": "integer" + }, + "attemptTime": { + "$ref": "#/definitions/Time" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Initializer": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Initializers": { + "required": [ + "pending" + ], + "properties": { + "pending": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializer" + }, + "type": "array" + }, + "result": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Status" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Integration": { + "properties": { + "annotations": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "apiVersion": { + "type": "string" + }, + "clusterName": { + "type": "string" + }, + "creationTimestamp": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Time" + }, + "deletionGracePeriodSeconds": { + "type": "integer" + }, + "deletionTimestamp": { + "$ref": "#/definitions/Time" + }, + "finalizers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "generateName": { + "type": "string" + }, + "generation": { + "type": "integer" + }, + "initializers": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializers" + }, + "kind": { + "type": "string" + }, + "labels": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "ownerReferences": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/OwnerReference" + }, + "type": "array" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "spec": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationSpec" + }, + "status": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationStatus" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationSpec": { + "properties": { + "configuration": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ConfigurationSpec" + }, + "type": "array" + }, + "context": { + "type": "string" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array" + }, + "profile": { + "type": "string" + }, + "replicas": { + "type": "integer" + }, + "repositories": { + "items": { + "type": "string" + }, + "type": "array" + }, + "resources": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ResourceSpec" + }, + "type": "array" + }, + "serviceAccountName": { + "type": "string" + }, + "sources": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/SourceSpec" + }, + "type": "array" + }, + "traits": { + "patternProperties": { + ".*": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationTraitSpec" + } + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationStatus": { + "properties": { + "camelVersion": { + "type": "string" + }, + "context": { + "type": "string" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array" + }, + "digest": { + "type": "string" + }, + "failure": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Failure" + }, + "generatedSources": { + "items": { + "$ref": "#/definitions/SourceSpec" + }, + "type": "array" + }, + "image": { + "type": "string" + }, + "phase": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationTraitSpec": { + "properties": { + "configuration": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object" + }, + "OwnerReference": { + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], + "properties": { + "apiVersion": { + "type": "string" + }, + "blockOwnerDeletion": { + "type": "boolean" + }, + "controller": { + "type": "boolean" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ResourceSpec": { + "properties": { + "compression": { + "type": "boolean" + }, + "content": { + "type": "string" + }, + "contentRef": { + "type": "string" + }, + "name": { + "type": "string" + }, + "type": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "SourceSpec": { + "properties": { + "compression": { + "type": "boolean" + }, + "content": { + "type": "string" + }, + "contentRef": { + "type": "string" + }, + "language": { + "type": "string" + }, + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Status": { + "properties": { + "apiVersion": { + "type": "string" + }, + "code": { + "type": "integer" + }, + "continue": { + "type": "string" + }, + "details": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusDetails" + }, + "kind": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "status": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusCause": { + "properties": { + "field": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusDetails": { + "properties": { + "causes": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusCause" + }, + "type": "array" + }, + "group": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "retryAfterSeconds": { + "type": "integer" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Time": { + "additionalProperties": false, + "type": "object" + } + } +} \ No newline at end of file diff --git a/assets/json-schema/IntegrationContext.json b/assets/json-schema/IntegrationContext.json new file mode 100644 index 0000000000..f5453fdc99 --- /dev/null +++ b/assets/json-schema/IntegrationContext.json @@ -0,0 +1,403 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationContext", + "definitions": { + "Artifact": { + "required": [ + "id" + ], + "properties": { + "id": { + "type": "string" + }, + "location": { + "type": "string" + }, + "target": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "ConfigurationSpec": { + "required": [ + "type", + "value" + ], + "properties": { + "type": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Failure": { + "required": [ + "reason", + "time", + "recovery" + ], + "properties": { + "reason": { + "type": "string" + }, + "recovery": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/FailureRecovery" + }, + "time": { + "$ref": "#/definitions/Time" + } + }, + "additionalProperties": false, + "type": "object" + }, + "FailureRecovery": { + "required": [ + "attempt", + "attemptMax", + "attemptTime" + ], + "properties": { + "attempt": { + "type": "integer" + }, + "attemptMax": { + "type": "integer" + }, + "attemptTime": { + "$ref": "#/definitions/Time" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Initializer": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Initializers": { + "required": [ + "pending" + ], + "properties": { + "pending": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializer" + }, + "type": "array" + }, + "result": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Status" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationContext": { + "properties": { + "annotations": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "apiVersion": { + "type": "string" + }, + "clusterName": { + "type": "string" + }, + "creationTimestamp": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Time" + }, + "deletionGracePeriodSeconds": { + "type": "integer" + }, + "deletionTimestamp": { + "$ref": "#/definitions/Time" + }, + "finalizers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "generateName": { + "type": "string" + }, + "generation": { + "type": "integer" + }, + "initializers": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializers" + }, + "kind": { + "type": "string" + }, + "labels": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "ownerReferences": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/OwnerReference" + }, + "type": "array" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "spec": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationContextSpec" + }, + "status": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationContextStatus" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationContextSpec": { + "properties": { + "configuration": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/ConfigurationSpec" + }, + "type": "array" + }, + "dependencies": { + "items": { + "type": "string" + }, + "type": "array" + }, + "image": { + "type": "string" + }, + "profile": { + "type": "string" + }, + "repositories": { + "items": { + "type": "string" + }, + "type": "array" + }, + "traits": { + "patternProperties": { + ".*": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationTraitSpec" + } + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationContextStatus": { + "properties": { + "artifacts": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Artifact" + }, + "type": "array" + }, + "baseImage": { + "type": "string" + }, + "camelVersion": { + "type": "string" + }, + "digest": { + "type": "string" + }, + "failure": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Failure" + }, + "image": { + "type": "string" + }, + "phase": { + "type": "string" + }, + "publicImage": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationTraitSpec": { + "properties": { + "configuration": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + } + }, + "additionalProperties": false, + "type": "object" + }, + "OwnerReference": { + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], + "properties": { + "apiVersion": { + "type": "string" + }, + "blockOwnerDeletion": { + "type": "boolean" + }, + "controller": { + "type": "boolean" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Status": { + "properties": { + "apiVersion": { + "type": "string" + }, + "code": { + "type": "integer" + }, + "continue": { + "type": "string" + }, + "details": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusDetails" + }, + "kind": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "status": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusCause": { + "properties": { + "field": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusDetails": { + "properties": { + "causes": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusCause" + }, + "type": "array" + }, + "group": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "retryAfterSeconds": { + "type": "integer" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Time": { + "additionalProperties": false, + "type": "object" + } + } +} \ No newline at end of file diff --git a/assets/json-schema/IntegrationPlatform.json b/assets/json-schema/IntegrationPlatform.json new file mode 100644 index 0000000000..25694d77f2 --- /dev/null +++ b/assets/json-schema/IntegrationPlatform.json @@ -0,0 +1,321 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationPlatform", + "definitions": { + "Initializer": { + "required": [ + "name" + ], + "properties": { + "name": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Initializers": { + "required": [ + "pending" + ], + "properties": { + "pending": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializer" + }, + "type": "array" + }, + "result": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Status" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationPlatform": { + "properties": { + "annotations": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "apiVersion": { + "type": "string" + }, + "clusterName": { + "type": "string" + }, + "creationTimestamp": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Time" + }, + "deletionGracePeriodSeconds": { + "type": "integer" + }, + "deletionTimestamp": { + "$ref": "#/definitions/Time" + }, + "finalizers": { + "items": { + "type": "string" + }, + "type": "array" + }, + "generateName": { + "type": "string" + }, + "generation": { + "type": "integer" + }, + "initializers": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/Initializers" + }, + "kind": { + "type": "string" + }, + "labels": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "name": { + "type": "string" + }, + "namespace": { + "type": "string" + }, + "ownerReferences": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/OwnerReference" + }, + "type": "array" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "spec": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationPlatformSpec" + }, + "status": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationPlatformStatus" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationPlatformBuildSpec": { + "properties": { + "baseImage": { + "type": "string" + }, + "camelVersion": { + "type": "string" + }, + "localRepository": { + "type": "string" + }, + "organization": { + "type": "string" + }, + "properties": { + "patternProperties": { + ".*": { + "type": "string" + } + }, + "type": "object" + }, + "publishStrategy": { + "type": "string" + }, + "pushSecret": { + "type": "string" + }, + "registry": { + "type": "string" + }, + "repositories": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationPlatformResourcesSpec": { + "properties": { + "contexts": { + "items": { + "type": "string" + }, + "type": "array" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationPlatformSpec": { + "properties": { + "build": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationPlatformBuildSpec" + }, + "cluster": { + "type": "string" + }, + "profile": { + "type": "string" + }, + "resources": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/IntegrationPlatformResourcesSpec" + } + }, + "additionalProperties": false, + "type": "object" + }, + "IntegrationPlatformStatus": { + "properties": { + "phase": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "OwnerReference": { + "required": [ + "apiVersion", + "kind", + "name", + "uid" + ], + "properties": { + "apiVersion": { + "type": "string" + }, + "blockOwnerDeletion": { + "type": "boolean" + }, + "controller": { + "type": "boolean" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Status": { + "properties": { + "apiVersion": { + "type": "string" + }, + "code": { + "type": "integer" + }, + "continue": { + "type": "string" + }, + "details": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusDetails" + }, + "kind": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + }, + "resourceVersion": { + "type": "string" + }, + "selfLink": { + "type": "string" + }, + "status": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusCause": { + "properties": { + "field": { + "type": "string" + }, + "message": { + "type": "string" + }, + "reason": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "StatusDetails": { + "properties": { + "causes": { + "items": { + "$schema": "http://json-schema.org/draft-04/schema#", + "$ref": "#/definitions/StatusCause" + }, + "type": "array" + }, + "group": { + "type": "string" + }, + "kind": { + "type": "string" + }, + "name": { + "type": "string" + }, + "retryAfterSeconds": { + "type": "integer" + }, + "uid": { + "type": "string" + } + }, + "additionalProperties": false, + "type": "object" + }, + "Time": { + "additionalProperties": false, + "type": "object" + } + } +} \ No newline at end of file diff --git a/cmd/util/json-schema-gen/jsonschemagen.go b/cmd/util/json-schema-gen/jsonschemagen.go new file mode 100644 index 0000000000..adb77a90eb --- /dev/null +++ b/cmd/util/json-schema-gen/jsonschemagen.go @@ -0,0 +1,73 @@ +/* +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. +*/ + +package main + +import ( + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path" + "reflect" + + "github.com/alecthomas/jsonschema" + "github.com/apache/camel-k/pkg/apis/camel/v1alpha1" + "github.com/spf13/cobra" +) + +// Publishes predefined images for all Camel components +func main() { + sources := []interface{}{ + v1alpha1.Integration{}, + v1alpha1.IntegrationContext{}, + v1alpha1.IntegrationPlatform{}, + v1alpha1.CamelCatalog{}, + } + + var out string + + var cmd = cobra.Command{ + Use: "jsonschemagen --out=${path}", + Run: func(_ *cobra.Command, _ []string) { + for _, source := range sources { + //pin + source := source + + schema := jsonschema.Reflect(source) + b, err := json.MarshalIndent(schema, "", " ") + if err != nil { + fmt.Println("error:", err) + } + + v := reflect.ValueOf(source) + t := reflect.Indirect(v).Type().Name() + o := path.Join(out, t+".json") + + fmt.Println("Write", t, "json-schema to:", o) + ioutil.WriteFile(o, b, 0644) + } + }, + } + + cmd.Flags().StringVar(&out, "out", ".", "the path where to generate the json schema for cr") + + if err := cmd.Execute(); err != nil { + fmt.Println("error:", err) + os.Exit(-1) + } +} diff --git a/script/Makefile b/script/Makefile index f86bed3008..c5aaef8717 100644 --- a/script/Makefile +++ b/script/Makefile @@ -15,6 +15,8 @@ build-embed-resources: ./script/build_catalog.sh ./script/build_catalog.sh 2.23.0 ./script/embed_resources.sh deploy + mkdir -p ./assets/json-schema + go run cmd/util/json-schema-gen/jsonschemagen.go --out=./assets/json-schema build-compile-integration-tests: go test -c -tags=integration ./test/*.go