Skip to content

Commit

Permalink
Merge pull request #770 from konker/itineraries-schemas-amends
Browse files Browse the repository at this point in the history
UNI-554 Itineraries schemas amends
  • Loading branch information
konker authored Nov 27, 2023
2 parents b777310 + 9042d84 commit bacf310
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 126 deletions.
2 changes: 1 addition & 1 deletion maas-schemas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "maas-schemas",
"version": "20.10.0",
"version": "21.0.0",
"description": "Schemas for MaaS infrastructure",
"main": "index.js",
"engine": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"$ref": "#/definitions/body"
}
},
"required": ["headers", "requestContext", "body"],
"definitions": {
"body": {
"type": "object",
Expand Down Expand Up @@ -55,7 +56,8 @@
}
}
}
}
},
"required": ["itinerary"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"$ref": "#/definitions/body"
}
},
"required": ["headers", "requestContext", "body"],
"definitions": {
"body": {
"type": "object",
Expand Down Expand Up @@ -55,7 +56,8 @@
}
}
}
}
},
"required": ["itinerary"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"$ref": "#/definitions/body"
}
},
"required": ["headers", "requestContext", "body"],
"definitions": {
"body": {
"type": "object",
Expand Down Expand Up @@ -58,7 +59,8 @@
}
}
}
}
},
"required": ["itinerary"]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,67 +38,83 @@ export const schemaId =
// OutwardReturnWrapper
// The purpose of this remains a mystery
export type OutwardReturnWrapper = t.Branded<
{
({
itinerary?: Itinerary_8303_.Itinerary;
customerSelections?: Array<
{
ref?: ProductOptionV2_8170_.Ref;
customerSelection?: CustomerSelection_57c3_.CustomerSelection;
} & Record<string, unknown>
>;
} & Record<string, unknown>,
} & Record<string, unknown>) & {
itinerary: Defined;
},
OutwardReturnWrapperBrand
>;
export type OutwardReturnWrapperC = t.BrandC<
t.IntersectionC<
[
t.PartialC<{
itinerary: typeof Itinerary_8303_.Itinerary;
customerSelections: t.ArrayC<
t.IntersectionC<
[
t.PartialC<{
ref: typeof ProductOptionV2_8170_.Ref;
customerSelection: typeof CustomerSelection_57c3_.CustomerSelection;
}>,
t.RecordC<t.StringC, t.UnknownC>,
]
>
>;
t.IntersectionC<
[
t.PartialC<{
itinerary: typeof Itinerary_8303_.Itinerary;
customerSelections: t.ArrayC<
t.IntersectionC<
[
t.PartialC<{
ref: typeof ProductOptionV2_8170_.Ref;
customerSelection: typeof CustomerSelection_57c3_.CustomerSelection;
}>,
t.RecordC<t.StringC, t.UnknownC>,
]
>
>;
}>,
t.RecordC<t.StringC, t.UnknownC>,
]
>,
t.TypeC<{
itinerary: typeof Defined;
}>,
t.RecordC<t.StringC, t.UnknownC>,
]
>,
OutwardReturnWrapperBrand
>;
export const OutwardReturnWrapper: OutwardReturnWrapperC = t.brand(
t.intersection([
t.partial({
itinerary: Itinerary_8303_.Itinerary,
customerSelections: t.array(
t.intersection([
t.partial({
ref: ProductOptionV2_8170_.Ref,
customerSelection: CustomerSelection_57c3_.CustomerSelection,
}),
t.record(t.string, t.unknown),
]),
),
t.intersection([
t.partial({
itinerary: Itinerary_8303_.Itinerary,
customerSelections: t.array(
t.intersection([
t.partial({
ref: ProductOptionV2_8170_.Ref,
customerSelection: CustomerSelection_57c3_.CustomerSelection,
}),
t.record(t.string, t.unknown),
]),
),
}),
t.record(t.string, t.unknown),
]),
t.type({
itinerary: Defined,
}),
t.record(t.string, t.unknown),
]),
(
x,
): x is t.Branded<
{
({
itinerary?: Itinerary_8303_.Itinerary;
customerSelections?: Array<
{
ref?: ProductOptionV2_8170_.Ref;
customerSelection?: CustomerSelection_57c3_.CustomerSelection;
} & Record<string, unknown>
>;
} & Record<string, unknown>,
} & Record<string, unknown>) & {
itinerary: Defined;
},
OutwardReturnWrapperBrand
> => true,
'OutwardReturnWrapper',
Expand Down Expand Up @@ -178,30 +194,54 @@ export type RequestV1 = t.Branded<
headers?: ApiCommon_16a4_.StandardApiEndpointHeaders;
requestContext?: ApiCommon_16a4_.ApiGatewayAuthorizedRequestContext;
body?: Body;
} & {
headers: Defined;
requestContext: Defined;
body: Defined;
},
RequestV1Brand
>;
export type RequestV1C = t.BrandC<
t.PartialC<{
headers: typeof ApiCommon_16a4_.StandardApiEndpointHeaders;
requestContext: typeof ApiCommon_16a4_.ApiGatewayAuthorizedRequestContext;
body: typeof Body;
}>,
t.IntersectionC<
[
t.PartialC<{
headers: typeof ApiCommon_16a4_.StandardApiEndpointHeaders;
requestContext: typeof ApiCommon_16a4_.ApiGatewayAuthorizedRequestContext;
body: typeof Body;
}>,
t.TypeC<{
headers: typeof Defined;
requestContext: typeof Defined;
body: typeof Defined;
}>,
]
>,
RequestV1Brand
>;
export const RequestV1: RequestV1C = t.brand(
t.partial({
headers: ApiCommon_16a4_.StandardApiEndpointHeaders,
requestContext: ApiCommon_16a4_.ApiGatewayAuthorizedRequestContext,
body: Body,
}),
t.intersection([
t.partial({
headers: ApiCommon_16a4_.StandardApiEndpointHeaders,
requestContext: ApiCommon_16a4_.ApiGatewayAuthorizedRequestContext,
body: Body,
}),
t.type({
headers: Defined,
requestContext: Defined,
body: Defined,
}),
]),
(
x,
): x is t.Branded<
{
headers?: ApiCommon_16a4_.StandardApiEndpointHeaders;
requestContext?: ApiCommon_16a4_.ApiGatewayAuthorizedRequestContext;
body?: Body;
} & {
headers: Defined;
requestContext: Defined;
body: Defined;
},
RequestV1Brand
> => true,
Expand Down
Loading

0 comments on commit bacf310

Please sign in to comment.