From a8d182e48258c289cb9fd2f9ffc642db0ba88be9 Mon Sep 17 00:00:00 2001 From: Konrad Markus Date: Mon, 24 Aug 2020 15:25:15 +0300 Subject: [PATCH 1/2] WIP --- maas-schemas-ts/package.json | 7 +- maas-schemas-ts/src/aws/s3/event.ts | 202 ++++++++++++++++++ maas-schemas-ts/src/aws/sns/notification.ts | 86 ++++++++ maas-schemas-ts/src/core/components/units.ts | 15 ++ maas-schemas-ts/translation.log | 60 ++++++ maas-schemas/package.json | 10 +- maas-schemas/schemas/aws/s3/s3-event.json | 130 +++++++++++ .../schemas/aws/sns/sns-notification.json | 40 ++++ .../schemas/core/components/units.json | 5 + 9 files changed, 550 insertions(+), 5 deletions(-) create mode 100644 maas-schemas-ts/src/aws/s3/event.ts create mode 100644 maas-schemas-ts/src/aws/sns/notification.ts create mode 100644 maas-schemas/schemas/aws/s3/s3-event.json create mode 100644 maas-schemas/schemas/aws/sns/sns-notification.json diff --git a/maas-schemas-ts/package.json b/maas-schemas-ts/package.json index 8716ba557..e20d7fd05 100644 --- a/maas-schemas-ts/package.json +++ b/maas-schemas-ts/package.json @@ -1,6 +1,9 @@ { - "name": "maas-schemas-ts", - "version": "14.11.6", + "name": "@maasglobal/maas-schemas-ts", + "publishConfig": { + "registry": "https://npm.deployment.maas.global/repository/npm-maas/" + }, + "version": "14.12.0-rc1", "description": "TypeScript types and io-ts validators for maas-schemas", "main": "index.js", "files": [ diff --git a/maas-schemas-ts/src/aws/s3/event.ts b/maas-schemas-ts/src/aws/s3/event.ts new file mode 100644 index 000000000..e53ecb457 --- /dev/null +++ b/maas-schemas-ts/src/aws/s3/event.ts @@ -0,0 +1,202 @@ +/* + +undefined +AWS S3 Event JSON Payload + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as Units_ from '../../core/components/units'; + +export const schemaId = 'http://maasglobal.com/aws/s3/event.json'; + +// S3Event +// The default export. More information at the top. +export type S3Event = t.Branded< + { + eventVersion?: number; + eventSource?: string & 'aws:s3'; + awsRegion?: string; + eventTime?: Units_.IsoDateTime; + eventName?: unknown; + userIdentity?: { + principalId?: string; + }; + requestParameters?: { + sourceIPAddress?: string; + }; + responseElements?: { + 'x-amz-request-id'?: string; + 'x-amz-id-2'?: string; + }; + s3?: { + s3SchemaVersion?: number; + configurationId?: string; + bucket?: { + name?: string; + ownerIdentity?: { + principalId?: string; + }; + arn?: Units_.Arn; + }; + object?: { + key?: string; + size?: number; + eTag?: string; + versionId?: string; + sequencer?: string; + }; + }; + glacierEventData?: { + restoreEventData?: { + lifecycleRestorationExpiryTime?: Units_.IsoDateTime; + lifecycleRestoreStorageClass?: string; + }; + }; + }, + S3EventBrand +>; +export type S3EventC = t.BrandC< + t.PartialC<{ + eventVersion: t.NumberC; + eventSource: t.IntersectionC<[t.StringC, t.LiteralC<'aws:s3'>]>; + awsRegion: t.StringC; + eventTime: typeof Units_.IsoDateTime; + eventName: t.UnknownC; + userIdentity: t.PartialC<{ + principalId: t.StringC; + }>; + requestParameters: t.PartialC<{ + sourceIPAddress: t.StringC; + }>; + responseElements: t.PartialC<{ + 'x-amz-request-id': t.StringC; + 'x-amz-id-2': t.StringC; + }>; + s3: t.PartialC<{ + s3SchemaVersion: t.NumberC; + configurationId: t.StringC; + bucket: t.PartialC<{ + name: t.StringC; + ownerIdentity: t.PartialC<{ + principalId: t.StringC; + }>; + arn: typeof Units_.Arn; + }>; + object: t.PartialC<{ + key: t.StringC; + size: t.NumberC; + eTag: t.StringC; + versionId: t.StringC; + sequencer: t.StringC; + }>; + }>; + glacierEventData: t.PartialC<{ + restoreEventData: t.PartialC<{ + lifecycleRestorationExpiryTime: typeof Units_.IsoDateTime; + lifecycleRestoreStorageClass: t.StringC; + }>; + }>; + }>, + S3EventBrand +>; +export const S3Event: S3EventC = t.brand( + t.partial({ + eventVersion: t.number, + eventSource: t.intersection([t.string, t.literal('aws:s3')]), + awsRegion: t.string, + eventTime: Units_.IsoDateTime, + eventName: t.unknown, + userIdentity: t.partial({ + principalId: t.string, + }), + requestParameters: t.partial({ + sourceIPAddress: t.string, + }), + responseElements: t.partial({ + 'x-amz-request-id': t.string, + 'x-amz-id-2': t.string, + }), + s3: t.partial({ + s3SchemaVersion: t.number, + configurationId: t.string, + bucket: t.partial({ + name: t.string, + ownerIdentity: t.partial({ + principalId: t.string, + }), + arn: Units_.Arn, + }), + object: t.partial({ + key: t.string, + size: t.number, + eTag: t.string, + versionId: t.string, + sequencer: t.string, + }), + }), + glacierEventData: t.partial({ + restoreEventData: t.partial({ + lifecycleRestorationExpiryTime: Units_.IsoDateTime, + lifecycleRestoreStorageClass: t.string, + }), + }), + }), + ( + x, + ): x is t.Branded< + { + eventVersion?: number; + eventSource?: string & 'aws:s3'; + awsRegion?: string; + eventTime?: Units_.IsoDateTime; + eventName?: unknown; + userIdentity?: { + principalId?: string; + }; + requestParameters?: { + sourceIPAddress?: string; + }; + responseElements?: { + 'x-amz-request-id'?: string; + 'x-amz-id-2'?: string; + }; + s3?: { + s3SchemaVersion?: number; + configurationId?: string; + bucket?: { + name?: string; + ownerIdentity?: { + principalId?: string; + }; + arn?: Units_.Arn; + }; + object?: { + key?: string; + size?: number; + eTag?: string; + versionId?: string; + sequencer?: string; + }; + }; + glacierEventData?: { + restoreEventData?: { + lifecycleRestorationExpiryTime?: Units_.IsoDateTime; + lifecycleRestoreStorageClass?: string; + }; + }; + }, + S3EventBrand + > => true, + 'S3Event', +); +export interface S3EventBrand { + readonly S3Event: unique symbol; +} + +export default S3Event; + +// Success diff --git a/maas-schemas-ts/src/aws/sns/notification.ts b/maas-schemas-ts/src/aws/sns/notification.ts new file mode 100644 index 000000000..8eb72e376 --- /dev/null +++ b/maas-schemas-ts/src/aws/sns/notification.ts @@ -0,0 +1,86 @@ +/* + +undefined +AWS SNS Notification JSON Payload + +!!! AUTO GENERATED BY IOTSFJS REFRAIN FROM MANUAL EDITING !!! +See https://www.npmjs.com/package/io-ts-from-json-schema + +*/ + +import * as t from 'io-ts'; +import * as Units_ from '../../core/components/units'; + +export const schemaId = 'http://maasglobal.com/aws/sns/notification.json'; + +// SnsNotification +// The default export. More information at the top. +export type SnsNotification = t.Branded< + { + Type?: string & 'Notification'; + MessageId?: Units_.Uuid; + TopicArn?: Units_.Arn; + Subject?: string; + Message?: string; + Timestamp?: Units_.IsoDateTime; + SignatureVersion?: number; + Signature?: string; + SigningCertURL?: Units_.Url; + UnsubscribeURL?: Units_.Url; + }, + SnsNotificationBrand +>; +export type SnsNotificationC = t.BrandC< + t.PartialC<{ + Type: t.IntersectionC<[t.StringC, t.LiteralC<'Notification'>]>; + MessageId: typeof Units_.Uuid; + TopicArn: typeof Units_.Arn; + Subject: t.StringC; + Message: t.StringC; + Timestamp: typeof Units_.IsoDateTime; + SignatureVersion: t.NumberC; + Signature: t.StringC; + SigningCertURL: typeof Units_.Url; + UnsubscribeURL: typeof Units_.Url; + }>, + SnsNotificationBrand +>; +export const SnsNotification: SnsNotificationC = t.brand( + t.partial({ + Type: t.intersection([t.string, t.literal('Notification')]), + MessageId: Units_.Uuid, + TopicArn: Units_.Arn, + Subject: t.string, + Message: t.string, + Timestamp: Units_.IsoDateTime, + SignatureVersion: t.number, + Signature: t.string, + SigningCertURL: Units_.Url, + UnsubscribeURL: Units_.Url, + }), + ( + x, + ): x is t.Branded< + { + Type?: string & 'Notification'; + MessageId?: Units_.Uuid; + TopicArn?: Units_.Arn; + Subject?: string; + Message?: string; + Timestamp?: Units_.IsoDateTime; + SignatureVersion?: number; + Signature?: string; + SigningCertURL?: Units_.Url; + UnsubscribeURL?: Units_.Url; + }, + SnsNotificationBrand + > => true, + 'SnsNotification', +); +export interface SnsNotificationBrand { + readonly SnsNotification: unique symbol; +} + +export default SnsNotification; + +// Success diff --git a/maas-schemas-ts/src/core/components/units.ts b/maas-schemas-ts/src/core/components/units.ts index 151b08fc9..1ddcdace9 100644 --- a/maas-schemas-ts/src/core/components/units.ts +++ b/maas-schemas-ts/src/core/components/units.ts @@ -255,6 +255,21 @@ export interface IsoDateBrand { readonly IsoDate: unique symbol; } +// IsoDateTime +// A date in the form YYYY-MM-DDTHH:MM:SS.mmmZ +export type IsoDateTime = t.Branded; +export type IsoDateTimeC = t.BrandC; +export const IsoDateTime: IsoDateTimeC = t.brand( + t.string, + (x): x is t.Branded => + typeof x !== 'string' || + x.match(RegExp('^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z')) !== null, + 'IsoDateTime', +); +export interface IsoDateTimeBrand { + readonly IsoDateTime: unique symbol; +} + // Units // The default export. More information at the top. export type Units = t.Branded; diff --git a/maas-schemas-ts/translation.log b/maas-schemas-ts/translation.log index e075897d5..0603bc5e5 100644 --- a/maas-schemas-ts/translation.log +++ b/maas-schemas-ts/translation.log @@ -1,3 +1,63 @@ +INFO: primitive type "number" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +WARNING: pattern field not supported outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +WARNING: unexpected key in a $ref object + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +WARNING: pattern field not supported outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "number" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +WARNING: pattern field not supported outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +WARNING: pattern field not supported outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +WARNING: unexpected key in a $ref object + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "number" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +WARNING: unexpected key in a $ref object + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/s3/s3-event.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/sns/sns-notification.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/sns/sns-notification.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/sns/sns-notification.json +INFO: primitive type "integer" used outside top-level definitions + in ../maas-schemas/schemas/aws/sns/sns-notification.json +WARNING: minimum field not supported outside top-level definitions + in ../maas-schemas/schemas/aws/sns/sns-notification.json +INFO: primitive type "string" used outside top-level definitions + in ../maas-schemas/schemas/aws/sns/sns-notification.json INFO: primitive type "string" used outside top-level definitions in ../maas-schemas/schemas/core/booking-option.json WARNING: minLength field not supported outside top-level definitions diff --git a/maas-schemas/package.json b/maas-schemas/package.json index 4a2e0f517..b02680bb5 100644 --- a/maas-schemas/package.json +++ b/maas-schemas/package.json @@ -1,6 +1,9 @@ { - "name": "maas-schemas", - "version": "14.11.6", + "name": "@maasglobal/maas-schemas", + "publishConfig": { + "registry": "https://npm.deployment.maas.global/repository/npm-maas/" + }, + "version": "14.12.0-rc2", "description": "Schemas for MaaS infrastructure", "main": "index.js", "engine": { @@ -19,7 +22,8 @@ "contributors": [ "James Nguyen", "Klaus Dahlen", - "Lauri Svan" + "Lauri Svan", + "Konrad Markus" ], "license": "MIT", "bugs": { diff --git a/maas-schemas/schemas/aws/s3/s3-event.json b/maas-schemas/schemas/aws/s3/s3-event.json new file mode 100644 index 000000000..911630667 --- /dev/null +++ b/maas-schemas/schemas/aws/s3/s3-event.json @@ -0,0 +1,130 @@ +{ + "$id": "http://maasglobal.com/aws/s3/event.json", + "description": "AWS S3 Event JSON Payload", + "type": "object", + "properties": { + "eventVersion": { + "type": "number" + }, + "eventSource": { + "type": "string", + "const": "aws:s3" + }, + "awsRegion": { + "type": "string", + "pattern": "[\\w\\-]+" + }, + "eventTime": { + "description": "The time when Amazon S3 finished processing the request", + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/isoDateTime" + }, + "eventName": { + "description": "Event type, see: https://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html#notification-how-to-event-types-and-destinations" + }, + "userIdentity": { + "type": "object", + "properties": { + "principalId": { + "type": "string", + "description": "Amazon customer ID of the user who caused the event", + "pattern": "\\w+" + } + } + }, + "requestParameters": { + "type": "object", + "properties": { + "sourceIPAddress": { + "description": "IP address where request came from", + "type": "string" + } + } + }, + "responseElements": { + "type": "object", + "properties": { + "x-amz-request-id": { + "description": "Amazon S3 generated request ID", + "type": "string" + }, + "x-amz-id-2": { + "description": "Amazon S3 host that processed the request", + "type": "string" + } + } + }, + "s3": { + "type": "object", + "properties": { + "s3SchemaVersion": { + "type": "number" + }, + "configurationId": { + "description": "ID found in the bucket notification configuration", + "type": "string" + }, + "bucket": { + "type": "object", + "properties": { + "name": { + "type": "string", + "pattern": "[\\w-]+" + }, + "ownerIdentity": { + "type": "object", + "properties": { + "principalId": { + "description": "Amazon customer ID of the bucket owner", + "type": "string", + "pattern": "\\w+" + } + } + }, + "arn": { + "description": "bucket ARN", + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/arn" + } + } + }, + "object": { + "type": "object", + "properties": { + "key": { + "type": "string" + }, + "size": { + "type": "number" + }, + "eTag": { "description": "object eTag", "type": "string" }, + "versionId": { + "description": "object version if bucket is versioning-enabled, otherwise null", + "type": "string" + }, + "sequencer": { + "description": "a string representation of a hexadecimal value used to determine event sequence, only used with PUTs and DELETEs", + "type": "string" + } + } + } + } + }, + "glacierEventData": { + "type": "object", + "properties": { + "restoreEventData": { + "type": "object", + "properties": { + "lifecycleRestorationExpiryTime": { + "description": "The time of Restore Expiry", + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/isoDateTime" + }, + "lifecycleRestoreStorageClass": { + "description": "Source storage class for restore", + "type": "string" + } + } + } + } + } + } +} diff --git a/maas-schemas/schemas/aws/sns/sns-notification.json b/maas-schemas/schemas/aws/sns/sns-notification.json new file mode 100644 index 000000000..00ea8d96a --- /dev/null +++ b/maas-schemas/schemas/aws/sns/sns-notification.json @@ -0,0 +1,40 @@ +{ + "$id": "http://maasglobal.com/aws/sns/notification.json", + "description": "AWS SNS Notification JSON Payload", + "type": "object", + "properties": { + "Type": { + "type": "string", + "const": "Notification" + }, + "MessageId": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/uuid" + }, + "TopicArn": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/arn" + }, + "Subject": { + "type": "string" + }, + "Message": { + "type": "string" + }, + "Timestamp": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/isoDateTime" + }, + "SignatureVersion": { + "type": "integer", + "minimum": 1 + }, + "Signature": { + "type": "string", + "description": "base64" + }, + "SigningCertURL": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/url" + }, + "UnsubscribeURL": { + "$ref": "http://maasglobal.com/core/components/units.json#/definitions/url" + } + } +} diff --git a/maas-schemas/schemas/core/components/units.json b/maas-schemas/schemas/core/components/units.json index 49f5826f8..b35eb7469 100644 --- a/maas-schemas/schemas/core/components/units.json +++ b/maas-schemas/schemas/core/components/units.json @@ -72,6 +72,11 @@ "description": "A date in the form YYYY-MM-DD without a time component", "type": "string", "pattern": "^\\d{4}-\\d{2}-\\d{2}" + }, + "isoDateTime": { + "description": "A date in the form YYYY-MM-DDTHH:MM:SS.mmmZ", + "type": "string", + "pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z" } } } From 7a11b53854cf8c9287bcb683644c81039d3ad356 Mon Sep 17 00:00:00 2001 From: Konrad Markus Date: Sat, 9 Jan 2021 15:57:33 +0200 Subject: [PATCH 2/2] WIP2 --- maas-schemas-ts/package.json | 2 +- .../verification/initiate/request.ts | 70 ++++++++----------- maas-schemas/package.json | 2 +- .../verification/initiate/request.json | 43 +++++------- 4 files changed, 48 insertions(+), 69 deletions(-) diff --git a/maas-schemas-ts/package.json b/maas-schemas-ts/package.json index e20d7fd05..0bff06331 100644 --- a/maas-schemas-ts/package.json +++ b/maas-schemas-ts/package.json @@ -3,7 +3,7 @@ "publishConfig": { "registry": "https://npm.deployment.maas.global/repository/npm-maas/" }, - "version": "14.12.0-rc1", + "version": "14.12.0-rc7", "description": "TypeScript types and io-ts validators for maas-schemas", "main": "index.js", "files": [ diff --git a/maas-schemas-ts/src/maas-backend/customers/verification/initiate/request.ts b/maas-schemas-ts/src/maas-backend/customers/verification/initiate/request.ts index ececf725f..729d1d8ec 100644 --- a/maas-schemas-ts/src/maas-backend/customers/verification/initiate/request.ts +++ b/maas-schemas-ts/src/maas-backend/customers/verification/initiate/request.ts @@ -41,17 +41,17 @@ export type Request = t.Branded< identityId?: Units_.IdentityId; payload?: { location?: UnitsGeo_.ShortLocationString; - metadata?: - | ({ - agencyId?: Common_.AgencyId; - } & { + metadata?: { + agencyId?: Common_.AgencyId; + planId?: string; + } & ( + | { agencyId: Defined; - }) - | ({ - planId?: string; - } & { + } + | { planId: Defined; - }); + } + ); } & { location: Defined; }; @@ -74,23 +74,17 @@ export type RequestC = t.BrandC< [ t.PartialC<{ location: typeof UnitsGeo_.ShortLocationString; - metadata: t.UnionC< + metadata: t.IntersectionC< [ - t.IntersectionC< + t.PartialC<{ + agencyId: typeof Common_.AgencyId; + planId: t.StringC; + }>, + t.UnionC< [ - t.PartialC<{ - agencyId: typeof Common_.AgencyId; - }>, t.TypeC<{ agencyId: typeof Defined; }>, - ] - >, - t.IntersectionC< - [ - t.PartialC<{ - planId: t.StringC; - }>, t.TypeC<{ planId: typeof Defined; }>, @@ -124,19 +118,15 @@ export const Request: RequestC = t.brand( payload: t.intersection([ t.partial({ location: UnitsGeo_.ShortLocationString, - metadata: t.union([ - t.intersection([ - t.partial({ - agencyId: Common_.AgencyId, - }), + metadata: t.intersection([ + t.partial({ + agencyId: Common_.AgencyId, + planId: t.string, + }), + t.union([ t.type({ agencyId: Defined, }), - ]), - t.intersection([ - t.partial({ - planId: t.string, - }), t.type({ planId: Defined, }), @@ -164,17 +154,17 @@ export const Request: RequestC = t.brand( identityId?: Units_.IdentityId; payload?: { location?: UnitsGeo_.ShortLocationString; - metadata?: - | ({ - agencyId?: Common_.AgencyId; - } & { + metadata?: { + agencyId?: Common_.AgencyId; + planId?: string; + } & ( + | { agencyId: Defined; - }) - | ({ - planId?: string; - } & { + } + | { planId: Defined; - }); + } + ); } & { location: Defined; }; diff --git a/maas-schemas/package.json b/maas-schemas/package.json index b02680bb5..6e1c06fe5 100644 --- a/maas-schemas/package.json +++ b/maas-schemas/package.json @@ -3,7 +3,7 @@ "publishConfig": { "registry": "https://npm.deployment.maas.global/repository/npm-maas/" }, - "version": "14.12.0-rc2", + "version": "14.12.0-rc7", "description": "Schemas for MaaS infrastructure", "main": "index.js", "engine": { diff --git a/maas-schemas/schemas/maas-backend/customers/verification/initiate/request.json b/maas-schemas/schemas/maas-backend/customers/verification/initiate/request.json index ec043b875..c1e576eb9 100644 --- a/maas-schemas/schemas/maas-backend/customers/verification/initiate/request.json +++ b/maas-schemas/schemas/maas-backend/customers/verification/initiate/request.json @@ -1,7 +1,7 @@ { "$id": "http://maasglobal.com/maas-backend/customers/verification/initiate/request.json", - "additionalProperties": false, "description": "MaaS customer verification initiate", + "type": "object", "properties": { "customerId": { "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" @@ -13,41 +13,30 @@ "$ref": "http://maasglobal.com/core/components/units.json#/definitions/identityId" }, "payload": { + "type": "object", "properties": { "location": { "$ref": "http://maasglobal.com/core/components/units-geo.json#/definitions/shortLocationString" }, "metadata": { - "oneOf": [ - { - "type": "object", - "properties": { - "agencyId": { - "$ref": "http://maasglobal.com/core/components/common.json#/definitions/agencyId" - } - }, - "required": ["agencyId"], - "additionalProperties": false + "type": "object", + "properties": { + "agencyId": { + "$ref": "http://maasglobal.com/core/components/common.json#/definitions/agencyId" }, - { - "type": "object", - "properties": { - "planId": { - "type": "string", - "minLength": 2, - "maxLength": 255 - } - }, - "required": ["planId"], - "additionalProperties": false + "planId": { + "type": "string", + "minLength": 2, + "maxLength": 255 } - ] + }, + "additionalProperties": false, + "oneOf": [{ "required": ["agencyId"] }, { "required": ["planId"] }] } }, - "required": ["location"], - "type": "object" + "required": ["location"] } }, - "required": ["identityId", "customerId", "payload", "headers"], - "type": "object" + "additionalProperties": false, + "required": ["identityId", "customerId", "payload", "headers"] }