How to use the io-ts.UnknownArray function in io-ts

To help you get started, we’ve selected a few io-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github maasglobal / maas-schemas / maas-schemas-ts / src / core / components / authorization.ts View on Github external
*/

import * as t from 'io-ts';
import * as Common_ from 'maas-schemas-ts/core/components/common';
import * as Units_ from 'maas-schemas-ts/core/components/units';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId = 'http://maasglobal.com/core/components/authorization.json';

// Authorization
// The default export. More information at the top.
export type Authorization = t.Branded<
  {
    agencyId?: Common_.AgencyId;
    state?: string & ('VALID' | 'INVALID');
    validTo?: Units_.Time;
    created?: Units_.Time;
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / bookings / bookings-create / request.ts View on Github external
import * as t from 'io-ts';
import * as Units_ from 'maas-schemas-ts/core/components/units';
import * as Response_ from 'maas-schemas-ts/maas-backend/bookings/bookings-agency-options/response';
import * as CustomerSelection_ from 'maas-schemas-ts/core/components/customerSelection';
import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/bookings/bookings-create/request.json';

// Request
// The default export. More information at the top.
export type Request = t.Branded<
  {
    identityId?: Units_.IdentityId;
    payload?: {
      booking?: Response_.Option;
github maasglobal / maas-schemas / maas-schemas-ts / src / core / components / geometry.ts View on Github external
!!! AUTO GENERATED BY CONVERT.TS REFRAIN FROM MANUAL EDITING !!!

*/

import * as t from 'io-ts';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId = 'http://maasglobal.com/core/components/geometry.json';

// Position
// A single position
export type Position = t.Branded<[number, number], PositionBrand>;
export const Position = t.brand(
  t.tuple([t.number, t.number]),
  (x): x is t.Branded<[number, number], PositionBrand> =>
    Array.isArray(x) === false || x.length >= 2,
  'Position',
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / geocoding / geocoding-query / response.ts View on Github external
*/

import * as t from 'io-ts';
import * as Geolocation_ from 'maas-schemas-ts/core/components/geolocation';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/geocoding/geocoding-query/response.json';

// Response
// The default export. More information at the top.
export type Response = t.Branded<
  {
    type?: 'FeatureCollection';
    features?: Array;
    debug?: {};
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / customers / payment-sources / paymentSource.ts View on Github external
*/

import * as t from 'io-ts';
import * as Station_ from 'maas-schemas-ts/core/components/station';
import * as Address_ from 'maas-schemas-ts/core/components/address';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/customers/payment-sources/paymentSource.json';

// PaymentSourceId
// The purpose of this remains a mystery
export type PaymentSourceId = t.Branded;
export const PaymentSourceId = t.brand(
  t.string,
  (x): x is t.Branded =>
    typeof x !== 'string' || x.length >= 2,
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / invoices / invoiceLineItem.ts View on Github external
import * as t from 'io-ts';
import * as InvoiceUnits_ from 'maas-schemas-ts/maas-backend/invoices/invoiceUnits';
import * as Units_ from 'maas-schemas-ts/core/components/units';
import * as Fare_ from 'maas-schemas-ts/core/components/fare';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/invoices/invoiceLineItem.json';

// InvoiceLineItem
// The default export. More information at the top.
export type InvoiceLineItem = t.Branded;
export const InvoiceLineItem = t.brand(
  t.unknown,
  (x): x is t.Branded => true,
  'InvoiceLineItem',
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / subscriptions / subscriptions-options / request.ts View on Github external
*/

import * as t from 'io-ts';
import * as Units_ from 'maas-schemas-ts/core/components/units';
import * as ApiCommon_ from 'maas-schemas-ts/core/components/api-common';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/subscriptions/subscriptions-options/request.json';

// Request
// The default export. More information at the top.
export type Request = t.Branded<
  {
    identityId?: Units_.IdentityId;
    payload?: {
      regionId?: string;
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / bookings / bookings-create / response.ts View on Github external
*/

import * as t from 'io-ts';
import * as Booking_ from 'maas-schemas-ts/core/booking';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/bookings/bookings-create/response.json';

// Response
// The default export. More information at the top.
export type Response = t.Branded<
  {
    booking?: Booking_.Booking;
    debug?: {};
  } & {
github maasglobal / maas-schemas / maas-schemas-ts / src / maas-backend / subscriptions / subscriptionOption.ts View on Github external
*/

import * as t from 'io-ts';
import * as Common_ from 'maas-schemas-ts/core/components/common';
import * as Subscription_ from 'maas-schemas-ts/maas-backend/subscriptions/subscription';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId =
  'http://maasglobal.com/maas-backend/subscriptions/subscriptionOption.json';

// SubscriptionAdditions
// The purpose of this remains a mystery
export type SubscriptionAdditions = t.Branded<
  {
    discounts?: Array;
    requiredAuthorizations?: Array;
  } & {
github maasglobal / maas-schemas / maas-schemas-ts / src / core / components / geolocation.ts View on Github external
*/

import * as t from 'io-ts';
import * as UnitsGeo_ from 'maas-schemas-ts/core/components/units-geo';
import * as Address_ from 'maas-schemas-ts/core/components/address';

type Defined =
  | Record
  | Array
  | string
  | boolean
  | number
  | null;
const Defined = t.union([
  t.UnknownRecord,
  t.UnknownArray,
  t.string,
  t.boolean,
  t.number,
  t.null,
]);

export const schemaId = 'http://maasglobal.com/core/components/geolocation.json';

// Geometry
// The purpose of this remains a mystery
export type Geometry = t.Branded<
  {
    type?: 'Point';
    coordinates?: UnitsGeo_.ShortLocation;
  } & {
    type: Defined;