All files / schemas/trellis/gs1/produce/receiving_event v1.schema.cts

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

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 1151x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
/**
 * @license
 * Copyright 2022 Open Ag Data Alliance
 *
 * Use of this source code is governed by an MIT-style
 * license that can be found in the LICENSE file or at
 * https://opensource.org/licenses/MIT.
 */
 
import type { JSONSchema8 as Schema } from 'jsonschema8';
 
const schema: Schema = {
  $id: 'https://formats.openag.io/trellis/gs1/produce/receiving_event/v1.schema.json',
  $schema: 'http://json-schema.org/draft-07/schema#',
  description:
    'GS1 receiving event has certain required fields and and array element',
  properties: {
    contents_of_receipt: {
      description: 'all receiving trading items',
      type: 'array',
      items: {
        description: 'item is sold/shipped by one trading partner to the other',
      },
      required: [
        'gtin',
        'batch_or_lot_serial',
        'product_date',
        'sell_by',
        'quantity',
        'unit_of_measure',
      ],
      additionalProperties: false,
    },
    originator: {
      description: 'gln of the data originator and the data owner',
      type: 'string',
    },
    trading_partner: {
      description: 'gln of the trading partner',
      type: 'string',
    },
    activity_type: {
      description: 'defines the business process that taking place',
      type: 'string',
      examples: ['purchase_order', 'production_work_order', 'bill_of_landing'],
    },
    originator_type: {
      description: 'trading_partner_type of the originating trading partner',
      type: 'string',
      examples: [
        'grower',
        'supplier',
        'manufacturer',
        'processor',
        'distributor',
        'retailor',
      ],
    },
    receiver_type: {
      description: 'trading_partner_type of the receiving trading partner',
      type: 'string',
      examples: [
        'grower',
        'supplier',
        'manufacturer',
        'processor',
        'distributor',
        'retailor',
      ],
    },
    timestamp: {
      description: 'defines the timestamp of the data capture',
      type: 'string',
    },
    activity_no: {
      description:
        'defines a unique identifer to implicate the transaction id of the business event - purchase order id etc',
      type: 'string',
    },
    _id: {
      description: '_id identifies a resource in the OADA API.',
      type: 'string',
    },
    _rev: {
      description:
        '_rev is the revision string for a resource in the OADA API.',
      type: 'integer',
    },
    _meta: {
      description: '_meta is a link to the meta document for a resources.',
      properties: {
        _id: {
          description: '_id identifies a resource in the OADA API.',
          type: 'string',
        },
        _rev: {
          description:
            '_rev is the revision string for a resource in the OADA API.',
          type: 'integer',
        },
      },
      required: ['_id', '_rev'],
      type: 'object',
    },
    _type: {
      enum: ['application/vnd.trellis.gs1.produce.receiving_event.1+json'],
    },
  },
  additionalProperties: true,
  required: ['_type'],
  type: 'object',
  examples: [],
};
export = schema;