All files / src/contracts/documents json.ts

100% Statements 4/4
100% Branches 0/0
100% Functions 0/0
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121                                          12x 12x   12x   12x                                                                                                                                                                                            
/*
    Copyright (C) 2017 Red Hat, Inc.
 
    Licensed 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.
*/
 
import { IDocument, IField, IStringList, InspectionType } from '../common';
 
/**
 * The JSON inspection data model contracts between frontend and backend.
 */
export const JSON_MODEL_PACKAGE_PREFIX = 'io.atlasmap.json.v2';
export const JSON_DATA_SOURCE_JSON_TYPE =
  JSON_MODEL_PACKAGE_PREFIX + '.JsonDataSource';
export const JSON_ENUM_FIELD_JSON_TYPE =
  JSON_MODEL_PACKAGE_PREFIX + '.JsonEnumField';
export const JSON_INSPECTION_REQUEST_JSON_TYPE =
  JSON_MODEL_PACKAGE_PREFIX + '.JsonInspectionRequest';
 
/**
 * The root object that carries {@link IJsonInspectionRequest}
 * when it's sent to backend.
 */
export interface IJsonInspectionRequestContainer {
  JsonInspectionRequest: IJsonInspectionRequest;
}
 
/**
 * The serialized JSON inspection request.
 */
export interface IJsonInspectionRequest {
  fieldNameExclusions?: IStringList;
  typeNameExclusions?: IStringList;
  namespaceExclusions?: IStringList;
  jsonData?: string;
  uri?: string;
  type: InspectionType;
}
 
/**
 * The root object that carries {@link IJsonInspectionResponse}
 * when it's received from backend.
 */
export interface IJsonInspectionResponseContainer {
  JsonInspectionResponse: IJsonInspectionResponse;
}
 
/**
 * The serialized JSON inspection response.
 */
export interface IJsonInspectionResponse {
  jsonDocument: IJsonDocument;
  errorMessage?: string;
  executionTime?: number;
}
 
/**
 * The root object that carries {@link IJsonDocument}
 * when it's inspected with maven plugin.
 */
export interface IJsonDocumentContainer {
  JsonDocument: IJsonDocument;
}
 
/**
 * The serialized JSON document inspection result.
 */
export interface IJsonDocument extends IDocument {}
 
/**
 * The serialized JSON primitive field in inspection result.
 */
export interface IJsonField extends IField {
  primitive: boolean;
  typeName: string;
  userCreated?: boolean;
}
 
/**
 * The serialized JSON complex field in inspection result.
 */
export interface IJsonComplexType extends IJsonField {
  jsonFields?: IJsonFields;
  jsonEnumFields?: IJsonEnumFields;
  enumeration: boolean;
  uri?: string;
}
 
/**
 * The container of JSON field.
 */
export interface IJsonFields {
  jsonField: IJsonField[];
}
 
/**
 * The container of JSON enum field.
 */
export interface IJsonEnumFields {
  jsonEnumField: IJsonEnumField[];
}
 
/**
 * The serialized JSON enum field.
 */
export interface IJsonEnumField extends IField {
  ordinal: number;
  typeName: string;
  userCreated?: boolean;
}